-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
Rule array-items does not support prefixItems keyword #2646
Labels
Comments
@mnaumanali94 this sounds like a bug. Where OAS 3.1, supports |
ponelat
added
s/needs-info
t/bug
Something isn't working
p/medium
and removed
p/medium
labels
Aug 23, 2024
I just encountered this on a FastAPI project, which generates OpenAPI 3.1 schemas by default and uses SortItem = tuple[str, SortDirection]
…
sort: list[SortItem] | None = Field(
title="Sort Results",
default=[("score", SortDirection.desc)],
) … will produce a schema definition like this: {
"anyOf": [
{
"items": {
"prefixItems": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/SortDirection"
}
],
"type": "array",
"maxItems": 2,
"minItems": 2
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Sort Results",
"default": [
[
"score",
"desc"
]
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
OpenAPI 3.1 inherits data types from JSON Schema 2020-12, where we can use
prefixItems
keyword to define tuple value, instead ofitems
keyword.After changes from #2638 we got an error, when schema contains
prefixItems
:To Reproduce
test.yaml
:Run validation:
Expected behavior
Field
items
should not be required whenprefixItems
field is defined.Environment (remove any that are not applicable):
Additional context
This issue related to #2638.
The text was updated successfully, but these errors were encountered: