Repository navigation
Conversation
Collaborator
|
Hi @ybai08, we'll fix it in |
Author
|
Makes sense, thanks. Closing this in favour of a fix in |
Collaborator
|
here is a fix in openapi-sampler Redocly/openapi-sampler#224 |
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.
What/Why/How?
Since OpenAPI 3.1 a Schema Object
$refcan have sibling keywords, and Redoc's schema view already shows them. Generated samples did not: openapi-sampler follows the$refand drops its siblings, so forthe sample was
{ "Min": 0, "Max": 0 }instead of{ "Min": 10, "Max": 55 }.applyActiveVariantsToSchemaalready prepares the schema store for the sampler. When a$refnode has anexampleorexamplessibling, it now replaces the node with its siblings, plus the target'stype,xml,readOnlyandwriteOnly. The sampler then uses the sibling value. The XML element name and read-only/write-only filtering stay the same as when it follows the$ref. Siblings take precedence, as in the schema view. A$refwithout an example sibling is left as it is.Reference
Fixes #2609
Tests
src/jotai/__tests__/examples.test.ts:example/examplessiblings on properties (JSON and XML samples), and anexamplenext to a$refat the schema root. Without the change todiscriminator.ts, all three fail ({ min: 0, max: 0, step: 0 },<min>0</min>,0).npx vitest rungives 290 files passed, 1 skipped (3289 tests passed).npm run lintandnpm run ts:checkpass.npm run e2e(Playwright) andnpm run build.Screenshots (optional)
Check yourself