Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support schemas with array of types #1017

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

Merged
sserrata merged 2 commits into PaloAltoNetworks:main from MarcL01:marc-fix-schema-type
Nov 8, 2024

Conversation

@MarcL01
Copy link
Contributor

@MarcL01 MarcL01 commented Nov 7, 2024
edited
Loading

Description

Support an array of schema types (IE string & null)

Motivation and Context

  • We are trying to switch away from readme.com which supports array of schema types

How Has This Been Tested?

Used the pet store demo to test - http://localhost:3000/petstore_versioned/1.0.0/update-pet-with-form

type:
 - string
 - 'null'
"type": [
 "string",
 "null"
]

Before the above schemas would result in stringnull, now they result in string | null

Screenshots (if appropriate)

Before:
Screenshot 2024年11月07日 at 1 14 30 PM

After:
Screenshot 2024年11月07日 at 12 54 41 PM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

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.

Copy link

github-actions bot commented Nov 8, 2024

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

https://docusaurus-openapi-36b86--pr1017-4gdj0s5q.web.app

(expires 2024年12月08日 16:35:37 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

Copy link
Member

sserrata commented Nov 8, 2024

Hi @MarcL01, thanks for the PR. I think this is only officially supported in OpenAPI 3.1, according to the spec? How do you see this interacting with nullable or OpenAPI 3.0 in general?

@sserrata sserrata changed the title (削除) Fix schemas with multiple types (削除ここまで) (追記) Support schemas with array of types (追記ここまで) Nov 8, 2024
@sserrata sserrata added the enhancement New feature or request label Nov 8, 2024
@sserrata sserrata merged commit 6e55849 into PaloAltoNetworks:main Nov 8, 2024
11 checks passed
Copy link
Contributor

robbieaverill commented Nov 28, 2024
edited
Loading

@sserrata OpenAPI 3.1 actually removes nullable (from 3.0) entirely - see https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0 -> "Swap nullable type for arrays".

This PR is good but we also need to add support for it in anyOf, allOf, oneOf, etc, as well in the type definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sserrata sserrata sserrata approved these changes

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /