-
Notifications
You must be signed in to change notification settings - Fork 286
Support schema property examples (extract) #1198
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
base: main
Are you sure you want to change the base?
Support schema property examples (extract) #1198
Conversation
What do you think about adding an auto example to Response Example if examples is 1? let { type, example, allOf, properties, items, oneOf, anyOf, examples } = schemaCopy;
if ((examples !== undefined && examples.length === 1) || example !== undefined) {
return examples[0] || example;
} |
Hi @arloktev, would that be to avoid including the "auto" example if the spec already contains static examples? |
Visit the preview URL for this PR (updated for commit 1591b79): https://docusaurus-openapi-36b86--pr1198-wwaf79ov.web.app (expires Wed, 24 Sep 2025 14:50:12 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
Hi @dsuket, thanks for that...although I'm not sure we're ready to include the "request schema samples" I think property examples is a good options to have. |
Visual Diff SummaryTotal: 77, Matches: 75, Diffs: 2, Skipped: 0
|
Hi @dsuket, the functionality looks good to me but what are your thoughts on the amount of padding between the example tab and the example itself? I was thinking we should maybe reduce it but I recognize it may be coming from a tab component style. ![]() |
@sserrata Sorry for the late response. I've made some adjustments to the design.
How does it look now? |
Hi @dsuket, it looks better in my opinion but I think this also changes the global styles for tabs component: Before: ![]() As you can see, there is no longer any padding After: ![]() |
Description
Original request : #1165 (comment)
I extracted only the handling of property examples.
Additionally, I fixed an issue where a runtime error would occur if there was no schema definition for a mediaObject.
Motivation and Context
There was an issue with property examples not being displayed. I've made it so they are now visible.
How Has This Been Tested?
npm run build
npm run test
Screenshots (if appropriate)
Before
[before] examples in request parameters schema

[before] examples of properties in requestBody schema

[before] examples of schema properties in response

After
[after] examples in request parameters schema

[after] examples of properties in requestBody schema

[after] examples of schema properties in response

Types of changes
Checklist