Skip to content

v3.3: Add a global parameters field - #5446

Open
handrews wants to merge 2 commits into
OAI:v3.3-devfrom
handrews:global-params
Open

v3.3: Add a global parameters field#5446
handrews wants to merge 2 commits into
OAI:v3.3-devfrom
handrews:global-params

Conversation

@handrews

@handrews handrews commented Jul 25, 2026

Copy link
Copy Markdown
Member

Fixes #5320 : Add global parameters field without changing any of the ways in which parameters behave at different levels.

This is the simplest expansion, and should support known use cases like universal request headers or cookies.

This feature does not interact productively with in: querystring, and that should be fine for now. We can add complexity there if and when clear use cases emerge. It is not even entirely clear how common a global in: query parameter (which would prevent use of in: querystring everywhere) would be.

Global path parameters would also be odd, but could be used somewhat like Server Variables. The oddness of them does not seem sufficient reason to forbid them, although I could be persuaded given that they would not be clearly associated with any one path template.

  • schema changes are included in this pull request

@handrews
handrews marked this pull request as ready for review July 25, 2026 19:39
@handrews
handrews requested review from a team as code owners July 25, 2026 19:39
@handrews handrews changed the title Add a global parameters field v3.3: Add a global parameters field Jul 25, 2026

@karenetheridge karenetheridge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Perhaps add a failing test that shows that query+querystring are prohibited at the global level also (should be able to just copy an existing test)?

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.
@handrews

handrews commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

The rebase was a clean rebase with no changes.
The subsequent commit addresses @karenetheridge 's request for additional schema tests.

Comment thread src/oas.md
| <a name="oas-webhooks"></a>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. |
| <a name="oas-components"></a>components | [Components Object](#components-object) | An element to hold various Objects for the OpenAPI Description. |
| <a name="oas-security"></a>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. |
| <a name="path-item-parameters"></a>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). |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How does this interact with definitions split across multiple files? The restriction

cannot be removed there

Makes me worried that this will not be useful outside of very narrow use cases, though if it is scoped to the file it is defined in then it might be fine (though bring it's own complexities).

Eg: I could imagine using this for authentication related headers, but often you might have a handful of authentication related routes (for login, token refresh, password reset) that don't want those headers.

The other main use case I picture is flow control/rate limit related headers which might be ok without any scoping.

By multiple files, I mean I normally structure things like

openapi.yaml <- all routes exposed by the service using $ref to the other files
docs/auth.yaml <- auth related routes
docs/foo.yaml <- routes/schemas for the foo domain
...
docs/common.yaml <- cross cutting schemas like error responses

I'd wonder if being able to specify (name, in, schema: null) or similar on a route/operation level to remove the parameter would be worthwhile.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good point. Can we consider the overriding mechanism as a way to "remove" by nulling it out down stream?

@mikekistler mikekistler Aug 12, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I shudder at the idea of schema: null. But I think schema: false should probably do just what you want.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mikekistler is correct. null is not a valid schema but false is.

@mnahkies We expect this to have a fairly narrow use case, and probably more for request headers or cookies than query params (or certainly path params).

Document vs API scope is a mess, currently, and there's really no way to fix it until 4.0. Things at the root level (except the Info Object) are all scoped at API level (security and servers), so parameters should probably follow that rather than create yet another usage pattern (as @baywet has noted, we have too many already).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does this interact with definitions split across multiple files?

I'm hoping to clarify some of this a bit in 3.3. But currently I would say that global parameters applies in exactly the same way as global servers, securitySchemes and tags do. I have my own personal interpretation of how this works today, but this may differ from others' interpretations, which is why I hope to clarify the current state and then use that to move forward with more features to allow more flexibility in how APIs are defined with multiple documents.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That all makes sense.

To be clear my concern on the narrow use case is that even for headers and cookies, it may often not be useable if there is no way to remove it from a few specific operations.

schema: false would work for me.

(I can think of ways to hack around being unable to remove parameters from operations but I don't particularly like them and think it would muddy the conversation)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mnahkies While technically the spec does say that you can't remove a parameter at the Operation Object level (and therefore with this new addition, also at the Path Item Object level), setting schema: false effectively does this. The UX isn't great because documentation tools will still show it, but a false schema forbids all values so even if it is there it is not usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants