-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Allow referencing Path Item only via Reference Object (#2635) #2657
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
Allow referencing Path Item only via Reference Object (#2635) #2657
Conversation
Signed-off-by: Vladimir Gorej <[email protected]>
@char0n @MikeRalphson paths:
$ref: foo.yaml
$ref: bar.yaml |
@gimbimloki YAML does not allow for duplicate keys, so no (and that's not something OAS can change). Duplicate keys in JSON are a more complex topic, but the TL;DR is that most JSON implementations don't support them in a usable way. |
@handrews Thank you for your reply. |
@gimbimloki Keys must be unique in YAML. Non-unique keys in JSON do not have consistent behavior (usually one is discarded). Therefore it is impossible to have two |
This change feels incomplete, as it's now allowing a path-item entry to be a regular reference, but then not changing the definition of a path-item itself to disallow So now (in 3.2.0), this is still legal: paths:
/pets/{petId}:
$ref: "#/components/pathItems/one_pet"
components:
pathItems:
one_pet:
$ref: "#/components/pathItems/more_pet_things"
summary: a single pet
get:
... operation things here
more_pet_things:
$ref: "#/components/pathItems/even_more_pet_things"
description: ...
post:
... operation things here
even_more_pet_things:
put:
... ...which means that when processing a request for To fix this, I think we need to remove the Additionally, the reference under (I can submit a PR to make this change for 3.2.) addendum: I misread the schema in the 3.2 branch -- it did not get the |
See OAI#2657 - this was added to the specification but not the schema.
See OAI#2657 - this was added to the specification but not the schema.
See OAI#2657 - this was added to the specification but not the schema.
Schemathesis uses static version of the current published version of the OpenApi 3.1 spec metaschema (https://spec.openapis.org/oas/3.1/schema/2022-10-07) to validate openapi 3.1 spec documents. Unfortunately, the published version has at least one known bug in which the schema for `paths` references the definition of a concrete `path-item` instead of `path-item-or-reference`, which might still be technically incorrect when it comes handling the case of ref and sibling fields, but is correct according to the documented definition of a pathItemObject. This oversight has been noticed multiple times OAI/OpenAPI-Specification#3298 OAI/OpenAPI-Specification#2635 (comment) OAI/OpenAPI-Specification#2635 (comment) OAI/OpenAPI-Specification#3513 OAI/OpenAPI-Specification#2657 (comment) And finally fixed in Feb 2024 OAI/OpenAPI-Specification#3355 with a slightly bigger rework of the pathItem schema. Sadly, due to confusion about how to release fixes in schemas OAI/OpenAPI-Specification#151 (comment) this change has not been published anywhere except schema.yaml in the git repo, not even in schema.json, which appearantly only gets refreshed once per release of the metaschema OAI/OpenAPI-Specification#3355 (comment) This commit updates the stored schema from the most up-to-date 3.1.0 schema.yaml from 0035208 to close the bug and make spec-valid openapi spec files that use $ref under path finally validate correctly in schemathesis. It also adds a corresponding regression test
Signed-off-by: Vladimir Gorej [email protected]