-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Handle structure difference #8231
Handle structure difference #8231
Conversation
@ishuen Thanks for the issue and PR. I made a comment in issue #8218 for additional information. That said, I also did a quick test in SwaggerUI of the provided definition (both json and yaml formats), and I don't reach the non-
|
Hi @tim-lai . Could you provide your test json file? |
from the linked issue: https://github.com/cywhale/test_swagger/blob/main/public/test.json
Ok, I see the "progression" to the non-schema case now. Imo, adding the fallback to Basically, I think the definition provider should provide a |
Hi. Thanks for the suggestion, the fallback is replaced by an empty map. |
b34fde7
to
d953ec4
Compare
Fixed the dev env issue. |
d953ec4
to
39c7a73
Compare
src/core/json-schema-components.jsx
Outdated
@@ -85,7 +85,7 @@ export class JsonSchema_string extends Component { | |||
const Select = getComponent("Select") | |||
return (<Select className={ errors.length ? "invalid" : ""} | |||
title={ errors.length ? errors : ""} | |||
allowedValues={ enumValue } | |||
allowedValues={ Array(...enumValue) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer spread array shorthand
allowedValues={ Array(...enumValue) } | |
allowedValues={ [...enumValue] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks.
src/core/json-schema-components.jsx
Outdated
const Select = getComponent("Select") | ||
|
||
return (<Select className={ errors.length ? "invalid" : ""} | ||
title={ errors.length ? errors : ""} | ||
value={ String(value) } | ||
disabled={ disabled } | ||
allowedValues={ enumValue || booleanValue } | ||
allowedValues={ enumValue ? Array(...enumValue) : booleanValue } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer spread array shorthand
allowedValues={ enumValue ? Array(...enumValue) : booleanValue } | |
allowedValues={ enumValue ? [...enumValue] : booleanValue } |
Nice! I added a small suggestion to update, otherwise almost there! |
Thanks, the change is applied. |
@ishuen PR merged! Thanks for the investigation and fix! |
Description
See #8218
Motivation and Context
The current json parsing logic is not able to handle OAS3's structure well.
How Has This Been Tested?
Manual test plus unit test
Screenshots (if appropriate):
Screenshot1 https://ibb.co/DLLqygT
Screenshot2 https://ibb.co/HKvSfzL
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests