feat: align service api with generated contract - #989
Closed
hyoban wants to merge 10 commits into
Closed
Conversation
Pin the reviewed Dify source revision and add a deterministic three-language alignment pipeline while preserving documentation presentation fields.
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
hyoban
marked this pull request as draft
August 26, 2026 00:45
Keep the generated root operation in the wire contract without publishing Mintlify metadata, and preserve redirect ordering during navigation regeneration.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Service API documentation pipeline to align {en,zh,ja}/api-reference/openapi_service.json with a Dify-generated service-openapi.json wire contract, while preserving docs-owned presentation fields and adjusting navigation to hide deprecated operations.
Changes:
- Add a migration-stage aligner (
align_service_api.py) plus unit tests to deterministically merge generated wire fields with localized presentation. - Record the pinned upstream source (repo/commit) and generated contract digest in
service_api_source.json, and document the alignment workflow in the API pipeline README. - Update navigation/redirect wiring to surface
GET /(API info) and remove deprecated operations from menus.
Reviewed changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/api-pipeline/test_align_service_api.py | Adds unit tests covering wire-vs-presentation ownership, root endpoint metadata, translation fallback behavior, and deprecated alias handling. |
| tools/api-pipeline/service_api_source.json | Records the upstream Dify commit and the expected SHA-256 of the generated service-openapi.json. |
| tools/api-pipeline/README.md | Updates pipeline documentation to describe generated-contract alignment and new tooling inputs. |
| tools/api-pipeline/merge_specs.py | Excludes deprecated operations from the operation iterator used for docs navigation wiring/coverage checks. |
| tools/api-pipeline/align_service_api.py | Introduces the alignment tool that merges generated wire contract with locale presentation fields and verifies alignment determinism. |
| docs.json | Adjusts API navigation pages and redirect ordering, including adding GET / and removing deprecated operations from menus. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep documented deprecated operations in navigation and use x-mint as the publication boundary, avoiding an unrelated docs.json diff.
This was referenced Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
1c6f0a0388262976aa34f8e6a5e3a788cea13f14(dify#41274)x-mintnavigation or docs-authored presentation; only prefix their generated internal links for locale-aware validationopenapi_service.jsonfilesValidation
mint validatex-mint, andGET /remains hiddengit diff --checkUpstream ownership
dify#41274 is merged. The generated contract now owns the selected runtime semantics that were previously recovered from dify-docs, including:
404or503response declarationsuserbehaviorThe docs repository continues to own Mintlify navigation (
x-mint), localized navigation and links, localized presentation, reviewed examples, tutorial-oriented code samples, and deployment-specific server presentation. The file-preview media type remains*/*because that is the generated contract; changing it toapplication/octet-streamshould happen upstream if the runtime contract is narrowed later. Canonical test-backed examples can also move upstream incrementally.Remaining upstream candidates
This PR intentionally preserves the existing docs overlay. Follow-up changes in the Dify repository could further reduce that overlay and prevent the generated contract from drifting:
GET /from the public Service API specification if it is not a supported API operation. For the five underscore-form compatibility aliases, either exclude them or mark them as deprecated and document their canonical replacements upstream.x-dify-app-modes, the distinction between app and knowledge API keys, and canonical request/response examples. The docs overlay currently carries 275 example blocks and 3 single-value examples.Locale-specific links and translations,
x-mint, tutorial-oriented code samples, and the deployment-specifichttps://{api_base_url}server presentation should remain in dify-docs.