add custom tool with openapi protocol failed #2563

Closed
opened 2026-02-21 17:47:19 -05:00 by yindo · 0 comments
Owner

Originally created by @luoweb on GitHub (Apr 24, 2024).

Originally assigned to: @Yeuoly on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a quesion, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.6.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

custom tool with openapi protocol

{
    "openapi": "3.0.2",
    "info": {
        "title": "FastAPI",
        "version": "0.1.0"
    },
    "servers":[
        {
            "url": "abc"
        }
    ],
    "paths": {
        "/api/dify/receive": {
            "post": {
                "summary": "Dify Receive",
                "description": "Receive API query data from Dify.",
                "operationId": "dify_receive_api_dify_receive_post",
                "parameters": [
                    {
                        "required": false,
                        "schema": {
                            "title": "Authorization",
                            "type": "string"
                        },
                        "name": "authorization",
                        "in": "header"
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/InputData"
                            }
                        }
                    },
                    "required": true
                },
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    },
                    "422": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HTTPValidationError"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "HTTPValidationError": {
                "title": "HTTPValidationError",
                "type": "object",
                "properties": {
                    "detail": {
                        "title": "Detail",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ValidationError"
                        }
                    }
                }
            },
            "InputData": {
                "title": "InputData",
                "required": [
                    "point"
                ],
                "type": "object",
                "properties": {
                    "point": {
                        "title": "Point",
                        "type": "string"
                    },
                    "params": {
                        "title": "Params",
                        "type": "object",
                        "default": {}
                    }
                }
            },
            "ValidationError": {
                "title": "ValidationError",
                "required": [
                    "loc",
                    "msg",
                    "type"
                ],
                "type": "object",
                "properties": {
                    "loc": {
                        "title": "Location",
                        "type": "array",
                        "items": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "integer"
                                }
                            ]
                        }
                    },
                    "msg": {
                        "title": "Message",
                        "type": "string"
                    },
                    "type": {
                        "title": "Error Type",
                        "type": "string"
                    }
                }
            }
        }
    }
}

✔️ Expected Behavior

success add custom tools with openapi

Actual Behavior

error:
invalid schema: invalid schema: 2 validation errors for ToolParameter default value is not a valid integer (type=type_error.integer) default str type expected (type=type_error.str)

Originally created by @luoweb on GitHub (Apr 24, 2024). Originally assigned to: @Yeuoly on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a quesion, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.6.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce custom tool with openapi protocol ``` { "openapi": "3.0.2", "info": { "title": "FastAPI", "version": "0.1.0" }, "servers":[ { "url": "abc" } ], "paths": { "/api/dify/receive": { "post": { "summary": "Dify Receive", "description": "Receive API query data from Dify.", "operationId": "dify_receive_api_dify_receive_post", "parameters": [ { "required": false, "schema": { "title": "Authorization", "type": "string" }, "name": "authorization", "in": "header" } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InputData" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "HTTPValidationError": { "title": "HTTPValidationError", "type": "object", "properties": { "detail": { "title": "Detail", "type": "array", "items": { "$ref": "#/components/schemas/ValidationError" } } } }, "InputData": { "title": "InputData", "required": [ "point" ], "type": "object", "properties": { "point": { "title": "Point", "type": "string" }, "params": { "title": "Params", "type": "object", "default": {} } } }, "ValidationError": { "title": "ValidationError", "required": [ "loc", "msg", "type" ], "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] } }, "msg": { "title": "Message", "type": "string" }, "type": { "title": "Error Type", "type": "string" } } } } } } ``` ### ✔️ Expected Behavior success add custom tools with openapi ### ❌ Actual Behavior error: invalid schema: invalid schema: 2 validation errors for ToolParameter default value is not a valid integer (type=type_error.integer) default str type expected (type=type_error.str)
yindo added the 🐞 bug label 2026-02-21 17:47:19 -05:00
yindo closed this issue 2026-02-21 17:47:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#2563