-
Notifications
You must be signed in to change notification settings - Fork 102
Only add x-codeSamples extensions to docs builds of openapi #4582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+83
−30,282
Conversation
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
l-trotta
approved these changes
Jun 17, 2025
68cab92
to
fb9be3e
Compare
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-9.0 9.0
# Navigate to the new working tree
cd .worktrees/backport-9.0
# Create a new branch
git switch --create backport-4582-to-9.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 688cb3447d94699a50f1ca5b89324caf922e11d5
# Push it to GitHub
git push --set-upstream origin backport-4582-to-9.0
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-9.0 Then, create a pull request where the |
miguelgrinberg
added a commit
that referenced
this pull request
Jun 17, 2025
miguelgrinberg
added a commit
that referenced
this pull request
Jun 17, 2025
miguelgrinberg
added a commit
that referenced
this pull request
Jun 17, 2025
miguelgrinberg
added a commit
that referenced
this pull request
Jun 18, 2025
miguelgrinberg
added a commit
that referenced
this pull request
Jun 18, 2025
* Add request details to examples (#4445) * add request heading line to request examples * add request heading line to response examples * changes to the compiler to include the request heading * add example requests for endpoints that do not use bodies (#4489) * add a few example requests for endpoints that do not use bodies * Remove x-codeSamples from overlay * restructure existing examples w/o bodies as request examples * skip examples w/o bodies when generating openapi examples * add a lot of missing examples * remove duplicate test * more examples missed in previous commit --------- Co-authored-by: lcawl <lcawley@elastic.co> * add language client examples to YAML files (#4514) * expand model to include language versions of examples * add language client examples to YAML files * use $ELASTICSEARCH_URL in curl examples * remove unnecessary generate-language-examples task from the openapi generation * upgrade request converter to latest * Only add x-codeSamples extensions to docs builds of openapi (#4582) * address example errors --------- Co-authored-by: lcawl <lcawley@elastic.co>
miguelgrinberg
added a commit
that referenced
this pull request
Jun 18, 2025
* Add request details to examples (#4445) * add request heading line to request examples * add request heading line to response examples * changes to the compiler to include the request heading * add example requests for endpoints that do not use bodies (#4489) * add a few example requests for endpoints that do not use bodies * Remove x-codeSamples from overlay * restructure existing examples w/o bodies as request examples * skip examples w/o bodies when generating openapi examples * add a lot of missing examples * remove duplicate test * more examples missed in previous commit --------- Co-authored-by: lcawl <lcawley@elastic.co> * add language client examples to YAML files (#4514) * expand model to include language versions of examples * add language client examples to YAML files * use $ELASTICSEARCH_URL in curl examples * remove unnecessary generate-language-examples task from the openapi generation * upgrade request converter to latest * Only add x-codeSamples extensions to docs builds of openapi (#4582) * address example errors --------- Co-authored-by: lcawl <lcawley@elastic.co>
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.
This change moves the generation of the
x-codeSamples
OpenAPI extension to the docs-specific builds. Themake transform-to-openapi-for-docs
reruns the request converter on all examples, then regeneratesschema.json
so that the new examples are included. Then it calls the OpenAPI generator with the new--include-language-examples
option to request that thex-codeSamples
extension is included.The regular OpenAPI builds do not include the new CLI option, so they will not have
x-codeSamples
. Themake generate
command does not regenerate examples anymore, since this is only needed for the docs workflow now.In addition to the above, the
generate-language-examples.js
script was changed so that it performs a non-destructive update of the language examples. This is to allow code examples for other languages with no request converter support to be added manually, or through custom builds of the request converter, such as the one supporting Java.