-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
refactor(schema): support properly Literal
in generated JSON schema
#2348
Conversation
46dae1b
to
577d8c3
Compare
Codecov Report
@@ Coverage Diff @@
## master #2348 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 4485 4489 +4
Branches 909 910 +1
=========================================
+ Hits 4485 4489 +4
Continue to review full report at Codecov.
|
'a': {'title': 'A', 'type': 'integer', 'enum': [1]}, | ||
'b': {'title': 'B', 'type': 'string', 'enum': ['a']}, | ||
'c': {'title': 'C', 'anyOf': [{'type': 'string', 'enum': ['a']}, {'type': 'integer', 'enum': [1]}]}, | ||
'd': { |
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.
Worth comparing with the first commit 3a14c72 😉
great, thank you. 🙇 🐗 |
Change Summary
Currently we don't support properly
Literal
with multi valuesFollowing this comment I feel like it could be good to support them properly.
Using
enum
even with one value should not have any impact and work everywhere sinceconst
is just syntactic sugar forenum
with a single element (see ref)ReDoc
q: Literal["pika"]
q: Literal["pika", Literal["chu"]]
Swagger
q: Literal["pika"]
q: Literal["pika", Literal["chu"]]
Related issue number
Closes #1350
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)