From 3283f3779dca1ba5817201560fab155153d351da Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Sat, 25 Jul 2026 12:23:50 -0700 Subject: [PATCH] Add a global parameters field This just adds the field without any special handling. It is already possible with the Path Item Object's parameters field to specify parameters that don't make sense for all of the operations, and we don't attempt to compensate for it. The only truly new situation is that there is no one path to which path parameters would correspond. I suspect that global path parameters will be rare, and mostly used in a prefix as more powerful analogues of Server Variables. --- src/oas.md | 1 + src/schemas/validation/schema.yaml | 2 ++ .../schema/pass/openapi_object_parameters.yaml | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/schema/pass/openapi_object_parameters.yaml diff --git a/src/oas.md b/src/oas.md index 19afd85e5e..d281c0de29 100644 --- a/src/oas.md +++ b/src/oas.md @@ -103,6 +103,7 @@ In addition to the required fields, at least one of the `components`, `paths`, o | webhooks | Map[`string`, [Path Item Object](#path-item-object)] | The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](https://learn.openapis.org/examples/v3.1/webhook-example.html) is available. | | components | [Components Object](#components-object) | An element to hold various Objects for the OpenAPI Description. | | security | [[Security Requirement Object](#security-requirement-object)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative Security Requirement Objects that can be used. Only one of the Security Requirement Objects need to be satisfied to authorize a request. Individual operations can override this definition. The list can be incomplete, up to being empty or absent. To make security explicitly optional, an empty security requirement (`{}`) can be included in the array. | +| parameters | [[Parameter Object](#parameter-object) \| [Reference Object](#reference-object)] | A list of parameters that are applicable for all operations in this API. These parameters can be overridden at the path item or operation levels, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameter-name) and [location](#parameter-in). The list can use the [Reference Object](#reference-object) to link to parameters that are defined in the [OpenAPI Object's `components.parameters`](#components-parameters). | | tags | [[Tag Object](#tag-object)] | A list of tags used by the OpenAPI Description with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operation-object) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. | | externalDocs | [External Documentation Object](#external-documentation-object) | Additional external documentation. | diff --git a/src/schemas/validation/schema.yaml b/src/schemas/validation/schema.yaml index 702e73c11e..9815118db3 100644 --- a/src/schemas/validation/schema.yaml +++ b/src/schemas/validation/schema.yaml @@ -37,6 +37,8 @@ properties: type: array items: $ref: '#/$defs/security-requirement' + parameters: + $ref: '#/$defs/parameters' tags: type: array items: diff --git a/tests/schema/pass/openapi_object_parameters.yaml b/tests/schema/pass/openapi_object_parameters.yaml new file mode 100644 index 0000000000..f62cb094c8 --- /dev/null +++ b/tests/schema/pass/openapi_object_parameters.yaml @@ -0,0 +1,18 @@ +openapi: 3.3.0 +info: + title: API + version: 1.0.0 +parameters: + - name: limit + in: query + schema: + type: integer + minimum: 0 +paths: + /things: + summary: Lots of things + get: + summary: Get a list of things + responses: + default: + description: A list of things