Skip to content

fix: remove x-codeSamples so playground examples update live - #1015

Merged
RiskeyL merged 1 commit into
mainfrom
fix/api-playground-codesamples
Sep 1, 2026
Merged

fix: remove x-codeSamples so playground examples update live#1015
RiskeyL merged 1 commit into
mainfrom
fix/api-playground-codesamples

Conversation

@RiskeyL

@RiskeyL RiskeyL commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Why

On the 11 endpoints carrying hand-written x-codeSamples (Send Chat Message, Run Workflow, the upload endpoints, …), the API playground's request example never reflected typed values, and readers got no language tab other than cURL: a static sample replaces Mintlify's auto-generated snippets for the whole operation. The samples date from when autogen couldn't express multipart bodies or SSE flags. Headless-browser tests against the live site and the local preview show autogen now covers all of it: proper --form samples for multipart, typed values appearing live, and the full set of language tabs.

Changes

  • {en,zh,ja}/api-reference/openapi_service.json: remove all 11 x-codeSamples blocks per language, and link the SSE Streaming guide inline from the Stream Workflow Events description (its removed sample was that page's only route to the curl streaming flag).
  • {en,zh,ja}/api-reference/guides/streaming.mdx: add a Tip — pass -N (--no-buffer) when testing with curl — the one piece of content the removed SSE samples uniquely carried.
  • tools/api-pipeline/lint_specs.py: invert the guard; it used to require x-codeSamples on GETs with required query params, it now flags any occurrence so the freeze can't be reintroduced.
  • .claude/skills/dify-docs-api-reference/references/spec-conventions.md: rewrite the x-codeSamples rule to match.

Verification

  • lint_specs.pyTOTAL ISSUES: 0 (54 links validated); parity_check.pyTOTAL PARITY ISSUES: 0; coverage check clean.
  • Headless-browser checks on the local preview: multipart (Upload File), SSE (Send Chat Message), and required-query GET (Stream Workflow Events) all regenerate their snippets live as values are typed; the streaming Tip renders in all three languages.
  • Accepted trade-off: a pristine snippet omits query parameters that have no schema default (they appear once typed); the parameter panel's Required badges and the parameter descriptions carry required-ness.

Notes

Closes DC-271

Hand-written x-codeSamples blocks on 11 endpoints replaced Mintlify's auto-generated request samples with static cURL, so the playground ignored typed values and offered no other language tabs. Headless-browser tests confirmed autogen now covers every case they were added for: multipart renders --form samples and typed values appear live in all snippet languages.

Remove all 33 blocks (en/zh/ja), invert the lint guard to flag any x-codeSamples occurrence, rewrite the spec-conventions rule, add a curl -N tip to the SSE streaming guide (the only content the removed samples uniquely carried), and link the guide from the Stream Workflow Events description.
Copilot AI lite review requested due to automatic review settings September 1, 2026 03:53
@mintlify

mintlify Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
dify-ce-cloud-docs 🟢 Ready View Preview Sep 1, 2026, 3:54 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes operation-level x-codeSamples from the localized Service API OpenAPI specs so Mintlify’s API playground can resume generating live, multi-language request snippets (reflecting typed values), and it adds/updates guardrails and guidance to prevent x-codeSamples from being reintroduced.

Changes:

  • Remove all x-codeSamples blocks from {en,zh,ja}/api-reference/openapi_service.json and add an inline link to the Streaming guide from “Stream Workflow Events”.
  • Add a Streaming guide Tip in all three languages documenting curl -N/--no-buffer for real-time SSE output.
  • Update tools/api-pipeline/lint_specs.py and the internal spec conventions to flag and forbid any x-codeSamples usage.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
en/api-reference/openapi_service.json Removes x-codeSamples and links Stream Workflow Events to the Streaming guide so the playground can autogenerate live snippets.
zh/api-reference/openapi_service.json Same as English: removes x-codeSamples and adds the Streaming guide link in the Stream Workflow Events description.
ja/api-reference/openapi_service.json Same as English: removes x-codeSamples and adds the Streaming guide link in the Stream Workflow Events description.
en/api-reference/guides/streaming.mdx Adds a Tip to use curl -N/--no-buffer when testing SSE streams.
zh/api-reference/guides/streaming.mdx Adds the localized Tip for curl -N/--no-buffer.
ja/api-reference/guides/streaming.mdx Adds the localized Tip for curl -N/--no-buffer.
tools/api-pipeline/lint_specs.py Inverts the previous guard: now emits an issue whenever an operation includes x-codeSamples.
.claude/skills/dify-docs-api-reference/references/spec-conventions.md Updates the spec conventions to prohibit x-codeSamples and points SSE guidance to the Streaming guide.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@RiskeyL

RiskeyL commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
release/1.16.0
release/1.16.1
release/1.17.0

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

RiskeyL added a commit that referenced this pull request Sep 1, 2026
…1018)

Hand-written x-codeSamples blocks on 11 endpoints replaced Mintlify's auto-generated request samples with static cURL, so the playground ignored typed values and offered no other language tabs. Headless-browser tests confirmed autogen now covers every case they were added for: multipart renders --form samples and typed values appear live in all snippet languages.

Remove all 33 blocks (en/zh/ja), invert the lint guard to flag any x-codeSamples occurrence, rewrite the spec-conventions rule, add a curl -N tip to the SSE streaming guide (the only content the removed samples uniquely carried), and link the guide from the Stream Workflow Events description.

(cherry picked from commit 236fcaa)
RiskeyL added a commit that referenced this pull request Sep 1, 2026
…1017)

Hand-written x-codeSamples blocks on 11 endpoints replaced Mintlify's auto-generated request samples with static cURL, so the playground ignored typed values and offered no other language tabs. Headless-browser tests confirmed autogen now covers every case they were added for: multipart renders --form samples and typed values appear live in all snippet languages.

Remove all 33 blocks (en/zh/ja), invert the lint guard to flag any x-codeSamples occurrence, rewrite the spec-conventions rule, add a curl -N tip to the SSE streaming guide (the only content the removed samples uniquely carried), and link the guide from the Stream Workflow Events description.

(cherry picked from commit 236fcaa)
RiskeyL added a commit that referenced this pull request Sep 1, 2026
…1016)

Hand-written x-codeSamples blocks on 11 endpoints replaced Mintlify's auto-generated request samples with static cURL, so the playground ignored typed values and offered no other language tabs. Headless-browser tests confirmed autogen now covers every case they were added for: multipart renders --form samples and typed values appear live in all snippet languages.

Remove all 33 blocks (en/zh/ja), invert the lint guard to flag any x-codeSamples occurrence, rewrite the spec-conventions rule, add a curl -N tip to the SSE streaming guide (the only content the removed samples uniquely carried), and link the guide from the Stream Workflow Events description.

(cherry picked from commit 236fcaa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants