-
Notifications
You must be signed in to change notification settings - Fork 300
feat: allow following examples array #1219
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
feat: allow following examples array #1219
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
|
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
|
Thanks for the review. Good catch, I've fixed it 👍 |
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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
Description
examplesis the official openapi standard so it makes sense to support that as well