[PR #31490] refactor: generate orpc contract from openapi #33264

Open
opened 2026-02-21 20:52:58 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/31490

State: open
Merged: No


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

close #31448

While most interfaces remain in Swagger v2, the OpenAPI v3 migration has already begun.
However, it is in its early stages, and many have not yet been migrated.

Category Status Details
Console API Not work Unable to render schema
Service API Not work Missing $ref pointer "#/components/schemas/DocumentMetadataOperation". Token "DocumentMetadataOperation" does not exist. Missing $ref pointer "#/components/schemas/SegmentUpdateArgs". Token "SegmentUpdateArgs" does not exist. Missing $ref pointer "#/components/schemas/RetrievalMethod". Token "RetrievalMethod" does not exist.
Web API Partial It can generate them, but many of the types are unknown.

related pull request

Flask-RESTX Swagger UI (Legacy)

Each Blueprint using ExternalApi has its own Swagger UI at {url_prefix}/swagger-ui.html:

API Name Swagger UI Path OpenAPI JSON Path
Console API /console/api/swagger-ui.html /console/api/swagger.json
Service API /v1/swagger-ui.html /v1/swagger.json
Web API /api/swagger-ui.html /api/swagger.json
Files API /files/swagger-ui.html /files/swagger.json
Inner API /inner/api/swagger-ui.html /inner/api/swagger.json

FastOpenAPI Documentation (New)

Configured in extensions/ext_fastopenapi.py:

Doc Type Path
Swagger UI /fastopenapi/docs
ReDoc /fastopenapi/redoc
OpenAPI JSON /fastopenapi/openapi.json

FastOpenAPI is currently a PoC and only covers a subset of /console/api endpoints.

Configuration

Controlled via environment variables:

  • SWAGGER_UI_ENABLED: Enable/disable docs (default true)
  • SWAGGER_UI_PATH: Custom path (default /swagger-ui.html)

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/31490 **State:** open **Merged:** No --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> close #31448 While most interfaces remain in Swagger v2, the OpenAPI v3 migration has already begun. However, it is in its early stages, and many have not yet been migrated. Category | Status | Details -- | -- | -- Console API | Not work | Unable to render schema Service API | Not work | ~~Missing $ref pointer "#/components/schemas/DocumentMetadataOperation". Token "DocumentMetadataOperation" does not exist.~~ ~~Missing $ref pointer "#/components/schemas/SegmentUpdateArgs". Token "SegmentUpdateArgs" does not exist.~~ Missing $ref pointer "#/components/schemas/RetrievalMethod". Token "RetrievalMethod" does not exist. Web API | Partial | It can generate them, but many of the types are unknown. related pull request - https://github.com/hey-api/openapi-ts/pull/3264 - https://github.com/kubb-labs/kubb/pull/2367 ## Flask-RESTX Swagger UI (Legacy) Each Blueprint using `ExternalApi` has its own Swagger UI at `{url_prefix}/swagger-ui.html`: | API Name | Swagger UI Path | OpenAPI JSON Path | |----------|-----------------|-------------------| | Console API | `/console/api/swagger-ui.html` | `/console/api/swagger.json` | | Service API | `/v1/swagger-ui.html` | `/v1/swagger.json` | | Web API | `/api/swagger-ui.html` | `/api/swagger.json` | | Files API | `/files/swagger-ui.html` | `/files/swagger.json` | | Inner API | `/inner/api/swagger-ui.html` | `/inner/api/swagger.json` | ## FastOpenAPI Documentation (New) Configured in `extensions/ext_fastopenapi.py`: | Doc Type | Path | |----------|------| | Swagger UI | `/fastopenapi/docs` | | ReDoc | `/fastopenapi/redoc` | | OpenAPI JSON | `/fastopenapi/openapi.json` | FastOpenAPI is currently a PoC and only covers a subset of `/console/api` endpoints. ## Configuration Controlled via environment variables: - `SWAGGER_UI_ENABLED`: Enable/disable docs (default `true`) - `SWAGGER_UI_PATH`: Custom path (default `/swagger-ui.html`) ## Screenshots | Before | After | |--------|-------| | ... | ... | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `make lint` and `make type-check` (backend) and `cd web && npx lint-staged` (frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:52:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33264