Skip to content

Disallow fragments in uri-references that point elsewhere in the OpenAPI description #4423

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions schemas/v3.1/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ properties:
info:
$ref: '#/$defs/info'
jsonSchemaDialect:
type: string
format: uri-reference
$ref: '#/$defs/uri-reference-no-fragment'
Copy link
Member

Choose a reason for hiding this comment

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

As with $schema, a fragment is allowed. It is not particularly good practice, and if matching a $id there are limits on what fragment, but $schema (and therefore jsonSchemaDialect) is not restricted to only targeting $id values.

default: 'https://spec.openapis.org/oas/3.1/dialect/WORK-IN-PROGRESS'
servers:
type: array
Expand Down Expand Up @@ -972,3 +971,9 @@ $defs:
properties:
explode:
default: false

uri-reference-no-fragment:
$comment: a uri-reference used to refer to an entire document, not a position in an OpenAPI description
type: string
format: uri-reference
pattern: '^[^#]*$'