Skip to content

Conversation

@sserrata
Copy link
Member

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

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@sserrata sserrata self-assigned this Dec 19, 2025
@sserrata sserrata added the enhancement New feature or request label Dec 19, 2025
@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Size Change: 0 B

Total Size: 2.18 MB

ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/docusaurus.config.mjs 14.6 kB
demo/.docusaurus/globalData.json 60.6 kB
demo/.docusaurus/i18n.json 267 B
demo/.docusaurus/registry.js 87.8 kB
demo/.docusaurus/routes.js 83 kB
demo/.docusaurus/routesChunkNames.json 34.4 kB
demo/.docusaurus/site-metadata.json 1.51 kB
demo/build/assets/css/styles.********.css 146 kB
demo/build/assets/js/main.********.js 726 kB
demo/build/assets/js/runtime~main.********.js 21.2 kB
demo/build/index.html 91.3 kB
demo/build/petstore/add-pet/index.html 27.8 kB
demo/build/petstore/create-user/index.html 22.5 kB
demo/build/petstore/create-users-with-array-input/index.html 22.6 kB
demo/build/petstore/create-users-with-list-input/index.html 22.6 kB
demo/build/petstore/delete-order/index.html 22.5 kB
demo/build/petstore/delete-pet/index.html 22.6 kB
demo/build/petstore/delete-user/index.html 22.8 kB
demo/build/petstore/find-pets-by-status/index.html 23.2 kB
demo/build/petstore/find-pets-by-tags/index.html 23.9 kB
demo/build/petstore/get-inventory/index.html 21.8 kB
demo/build/petstore/get-order-by-id/index.html 22.8 kB
demo/build/petstore/get-pet-by-id/index.html 23.3 kB
demo/build/petstore/get-user-by-name/index.html 22.9 kB
demo/build/petstore/login-user/index.html 23.4 kB
demo/build/petstore/logout-user/index.html 22.2 kB
demo/build/petstore/new-pet/index.html 22.7 kB
demo/build/petstore/pet/index.html 21 kB
demo/build/petstore/place-order/index.html 22 kB
demo/build/petstore/schemas/apiresponse/index.html 23.3 kB
demo/build/petstore/schemas/cat/index.html 37.3 kB
demo/build/petstore/schemas/category/index.html 24.3 kB
demo/build/petstore/schemas/dog/index.html 37.7 kB
demo/build/petstore/schemas/honeybee/index.html 37.7 kB
demo/build/petstore/schemas/id/index.html 21.4 kB
demo/build/petstore/schemas/order/index.html 25.5 kB
demo/build/petstore/schemas/pet/index.html 37.2 kB
demo/build/petstore/schemas/tag/index.html 22.7 kB
demo/build/petstore/schemas/user/index.html 45 kB
demo/build/petstore/store/index.html 20.2 kB
demo/build/petstore/subscribe-to-the-store-events/index.html 28.8 kB
demo/build/petstore/swagger-petstore-yaml/index.html 29 kB
demo/build/petstore/update-pet-with-form/index.html 22.7 kB
demo/build/petstore/update-pet/index.html 23.1 kB
demo/build/petstore/update-user/index.html 22.8 kB
demo/build/petstore/upload-file/index.html 22.6 kB
demo/build/petstore/user/index.html 20.7 kB

compressed-size-action

@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Visit the preview URL for this PR (updated for commit c5daa50):

https://docusaurus-openapi-36b86--pr1270-saufjde8.web.app

(expires Sun, 18 Jan 2026 20:56:50 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

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]>
@sserrata sserrata force-pushed the fix/schema-examples-generator branch from ea44142 to c5daa50 Compare December 19, 2025 20:52
@sserrata sserrata merged commit 91c5dcc into main Dec 19, 2025
6 checks passed
@sserrata sserrata deleted the fix/schema-examples-generator branch December 19, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants