feat: allow following examples array#1219
Closed
entropitor wants to merge 2 commits intoPaloAltoNetworks:mainfrom
Closed
feat: allow following examples array#1219entropitor wants to merge 2 commits intoPaloAltoNetworks:mainfrom
entropitor wants to merge 2 commits intoPaloAltoNetworks:mainfrom
Conversation
|
Visit the preview URL for this PR (updated for commit bac3099): https://docusaurus-openapi-36b86--pr1219-amaxrixw.web.app (expires Sun, 18 Jan 2026 20:43:54 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
08646f5 to
938d7be
Compare
Member
|
Hi @entropitor, Supporting schema examples is a nice addition, but the implementation needs to guard against empty arrays so we don’t drop back to undefined examples. If a schema or property sets examples: [], the new checks return examples[0] (undefined) instead of falling back to the generator. JSON Schema allows an empty array, so request/response examples (and property values) that previously rendered will now disappear. |
938d7be to
a62dace
Compare
a62dace to
bac3099
Compare
Contributor
Author
|
Thanks for the review. Good catch, I've fixed it 👍 |
sserrata
pushed a commit
that referenced
this pull request
Dec 19, 2025
Adds support for the OpenAPI 3.1 / JSON Schema 'examples' array in the schema example generator (createSchemaExample.ts): - Check schema.examples after schema.example in sampleFromSchema - Check property.examples after property.example in sampleFromProp - Uses first example from array when examples is non-empty - Guards against empty arrays to prevent fallback issues Closes #1219 Co-authored-by: Jens Claes <896093+entropitor@users.noreply.github.com>
4 tasks
sserrata
pushed a commit
that referenced
this pull request
Dec 19, 2025
Adds support for the OpenAPI 3.1 / JSON Schema 'examples' array in the schema example generator (createSchemaExample.ts): - Check schema.examples after schema.example in sampleFromSchema - Check property.examples after property.example in sampleFromProp - Uses first example from array when examples is non-empty - Guards against empty arrays to prevent fallback issues Closes #1219 Co-authored-by: Jens Claes <896093+entropitor@users.noreply.github.com>
omonk
pushed a commit
to omonk/docusaurus-openapi-docs
that referenced
this pull request
Dec 23, 2025
…works#1270) Adds support for the OpenAPI 3.1 / JSON Schema 'examples' array in the schema example generator (createSchemaExample.ts): - Check schema.examples after schema.example in sampleFromSchema - Check property.examples after property.example in sampleFromProp - Uses first example from array when examples is non-empty - Guards against empty arrays to prevent fallback issues Closes PaloAltoNetworks#1219 Co-authored-by: Jens Claes <896093+entropitor@users.noreply.github.com>
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.
Description
examplesis the official openapi standard so it makes sense to support that as well