Missing schema details in OpenAPI output from template/ affecting dify-docs #15522

Closed
opened 2026-02-21 19:22:07 -05:00 by yindo · 2 comments
Owner

Originally created by @lyzno1 on GitHub (Jul 21, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

main

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. In the dify-docs project, navigate to the en/ directory and open any of the OpenAPI JSON files, such as openapi_chat.json.

  2. Inspect the schema at components.schemas.ChatAppParametersResponse.properties.

  3. You will notice that it only includes the image field under the file_upload object, even though logically there should be more fields.

  4. The OpenAPI file is generated from templates in the main dify repository, specifically in the web/app/components/develop/template/ directory.

  5. Check the corresponding YAML-style template definition (e.g. for chat apps) and you will find that it only defines:

    - `file_upload` (object) File upload configuration
      - `image` (object) Image settings
        Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`
        - `enabled` (bool) Whether it is enabled
        - `number_limits` (int) Image number limit, default is 3
        - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one
    
  6. Other expected fields under file_upload (e.g. audio, video, PDF, etc.) are completely missing from both the template and the generated OpenAPI schema.

  7. As a result, downstream tools (such as openapi-typescript or datamodel-codegen) generate incomplete types, and the API documentation is misleading.

✔️ Expected Behavior

All available upload types supported by the Dify backend (such as audio, video, document, etc.) should be fully represented in both:

  1. The OpenAPI schema files (e.g. openapi_chat.json) under dify-docs/en/, particularly in components.schemas.ChatAppParametersResponse.properties.file_upload.
  2. The corresponding YAML-based templates in the dify/web/app/components/develop/template/ directory, which are used to generate the docs.

Actual Behavior

No response

Originally created by @lyzno1 on GitHub (Jul 21, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, 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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version main ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1. In the `dify-docs` project, navigate to the `en/` directory and open any of the OpenAPI JSON files, such as `openapi_chat.json`. 2. Inspect the schema at `components.schemas.ChatAppParametersResponse.properties`. 3. You will notice that it only includes the `image` field under the `file_upload` object, even though logically there should be more fields. 4. The OpenAPI file is generated from templates in the main `dify` repository, specifically in the `web/app/components/develop/template/` directory. 5. Check the corresponding YAML-style template definition (e.g. for chat apps) and you will find that it only defines: ```yaml - `file_upload` (object) File upload configuration - `image` (object) Image settings Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif` - `enabled` (bool) Whether it is enabled - `number_limits` (int) Image number limit, default is 3 - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one ``` 6. Other expected fields under `file_upload` (e.g. audio, video, PDF, etc.) are completely missing from both the template and the generated OpenAPI schema. 7. As a result, downstream tools (such as `openapi-typescript` or `datamodel-codegen`) generate incomplete types, and the API documentation is misleading. ### ✔️ Expected Behavior All available upload types supported by the Dify backend (such as `audio`, `video`, `document`, etc.) should be fully represented in both: 1. The OpenAPI schema files (e.g. `openapi_chat.json`) under `dify-docs/en/`, particularly in `components.schemas.ChatAppParametersResponse.properties.file_upload`. 2. The corresponding YAML-based templates in the `dify/web/app/components/develop/template/` directory, which are used to generate the docs. ### ❌ Actual Behavior _No response_
yindo added the 📚 documentation label 2026-02-21 19:22:07 -05:00
yindo closed this issue 2026-02-21 19:22:07 -05:00
Author
Owner

@lyzno1 commented on GitHub (Jul 21, 2025):

Hi @dosubot, thanks for your work on this!

I'm reviewing the file [web/app/components/base/features/types.ts](https://github.com/langgenius/dify/blob/main/web/app/components/base/features/types.ts), and I noticed that in the FileUpload type definition, only the image field is present:

export type FileUpload = {
  image?: EnabledOrDisabled & { ... }
} & EnabledOrDisabled

However, in the application behavior and OpenAPI spec (InputFileObject), it appears that other upload types such as document, video, or audio may also be supported.

Is this an intentional limitation, or could it be a missing feature/bug?
If additional upload types are supported, should the types.ts file and related templates (e.g. dify/web/app/components/develop/template/) be updated to reflect all valid types?

Would appreciate clarification. Happy to help contribute a fix if needed.

Thanks again!

@lyzno1 commented on GitHub (Jul 21, 2025): Hi @dosubot, thanks for your work on this! I'm reviewing the file [`[web/app/components/base/features/types.ts](https://github.com/langgenius/dify/blob/main/web/app/components/base/features/types.ts)`](https://github.com/langgenius/dify/blob/main/web/app/components/base/features/types.ts), and I noticed that in the `FileUpload` type definition, only the `image` field is present: ```ts export type FileUpload = { image?: EnabledOrDisabled & { ... } } & EnabledOrDisabled ``` However, in the application behavior and OpenAPI spec (`InputFileObject`), it appears that other upload types such as `document`, `video`, or `audio` may also be supported. Is this an intentional limitation, or could it be a missing feature/bug? If additional upload types are supported, should the `types.ts` file and related templates (e.g. `dify/web/app/components/develop/template/`) be updated to reflect all valid types? Would appreciate clarification. Happy to help contribute a fix if needed. Thanks again!
Author
Owner

@dosubot[bot] commented on GitHub (Jul 21, 2025):

This isn't an intentional limitation—it's an oversight. The Dify backend supports multiple file upload types (image, document, audio, video, custom) as defined in the backend models and enums (example), and the advanced chat/workflow templates document these types at the operation level (example). However, only the image field is currently exposed in the OpenAPI schema and the main frontend type definitions (example), which leads to incomplete types and misleading docs.

To resolve this, both the frontend types (types.ts), the YAML templates, and the OpenAPI generation logic should be updated to reflect all supported file types. The codebase is already structured to allow for this extension, so it should be a matter of surfacing the existing backend capabilities in the schema and UI. If you're interested in contributing, expanding the type definitions and updating the templates to match backend support would be a valuable fix!

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 21, 2025): <!-- Answer --> This isn't an intentional limitation—it's an oversight. The Dify backend supports multiple file upload types (image, document, audio, video, custom) as defined in the backend models and enums ([example](https://github.com/langgenius/dify/blob/74981a65c6c70b4c552ffdceca7f5f81c17d7ad8/api/core/file/enums.py)), and the advanced chat/workflow templates document these types at the operation level ([example](https://github.com/langgenius/dify/blob/74981a65c6c70b4c552ffdceca7f5f81c17d7ad8/web/app/components/develop/template/template_advanced_chat.en.mdx)). However, only the `image` field is currently exposed in the OpenAPI schema and the main frontend type definitions ([example](https://github.com/langgenius/dify/blob/74981a65c6c70b4c552ffdceca7f5f81c17d7ad8/web/app/components/base/features/types.ts)), which leads to incomplete types and misleading docs. To resolve this, both the frontend types (`types.ts`), the YAML templates, and the OpenAPI generation logic should be updated to reflect all supported file types. The codebase is already structured to allow for this extension, so it should be a matter of surfacing the existing backend capabilities in the schema and UI. If you're interested in contributing, expanding the type definitions and updating the templates to match backend support would be a valuable fix! <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/31609e56-1393-4905-9b94-186d85970cb0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/31609e56-1393-4905-9b94-186d85970cb0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/31609e56-1393-4905-9b94-186d85970cb0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/31609e56-1393-4905-9b94-186d85970cb0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/31609e56-1393-4905-9b94-186d85970cb0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/31609e56-1393-4905-9b94-186d85970cb0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/31609e56-1393-4905-9b94-186d85970cb0?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/22700)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15522