Skip to content
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

UI: Parse OpenAPI response correctly if schema includes $ref #14508

Merged
merged 3 commits into from
Mar 16, 2022

Conversation

hashishaw
Copy link
Contributor

@hashishaw hashishaw commented Mar 15, 2022

This PR adds UI support for the changes in #14217

Before this change, the UI was broken where we try to generate the form based on OpenAPI:
image

After, the form is rendered as expected:
image

let props = {};
const schema = pathInfo?.post?.requestBody?.content['application/json'].schema;
if (schema.$ref) {
// $ref will be shaped like `#/component/schema/MyResponseType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super small comment but components and schemas are plural in the $ref
"$ref": "#/components/schemas/KvLookupRequest"

...but does that affect your mapping?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nope! it doesn't, since you're using reduce and setting the keys on 212

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, but I should probably be accurate in my comment 😄

Copy link
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! Thanks for the quick fix! 🚀

@vercel vercel bot temporarily deployed to Preview – vault March 15, 2022 20:52 Inactive
@hashishaw hashishaw merged commit 49d44a9 into main Mar 16, 2022
@hashishaw hashishaw deleted the ui/consume-openapi-schema-ref branch March 16, 2022 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants