You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Schemas in query parameters don't work #1022
Such a pattern is described here and I've had confirmation on the OpenAPI slack here that this is the current best approach to describing pattern-based query parameter names.
This may be related to #250 but isn't completely related as it should work with the query default style of form.
@p1c2u Are you sure about that? As linked in the references above, I asked about this on the OpenAPI slack and was told by one of the spec maintainers that this should work.
Path templating refers to the usage of template expressions, delimited by curly braces ({}), to mark a section of a URL path as replaceable using path parameters.
Each template expression in the path MUST correspond to a path parameter that is included in the Path Item itself and/or in each of the Path Item's Operations. An exception is if the path item is empty, for example due to ACL constraints, matching path parameters are not required.
Specification states clearly the Path templating refers to Path Item only.
Unfortunately I have no access to the OpenAPI slack.
This isn't using path templating, though, as far as I'm aware. The curly braces in the name aren't serialised, but are used in my example above to consistently convey the variable component to a human user. The templating is actually carried out by the patternProperties part of the schema. I believe schemas are allowed here as they are called out in the allowEmptyValue description with regards to its interaction with Schema Objects, and stating that allowEmptyValues is only valid for Query Parameters.
@j616
Unfortunately I didn't find any references in the slack to the specification that would validate your approach.
Per OAS 3.x there's no provision for:
Pattern-based parameter names
Templated parameter names (outside of path parameters using RFC 6570)
Using schemas to define dynamic parameter names
When OAS references "Schema Objects" in parameter definitions (like with allowEmptyValue), it refers to the value validation of the parameter NOT the parameter name itself.
patternProperties works on object properties in request/response bodies, not on parameter names. The OAS specification doesn't define any mechanism for patternProperties to dynamically generate parameter names.
Your pattern is clear and would make sense but this approach is not supported by the OpenAPI specification.
Activity
p1c2u commentedon Dec 16, 2025
OpenAPI specification doesn't let
Parameter object's name to be a template with schema patterm.j616 commentedon Dec 17, 2025
@p1c2u Are you sure about that? As linked in the references above, I asked about this on the OpenAPI slack and was told by one of the spec maintainers that this should work.
p1c2u commentedon Dec 17, 2025
@j616
https://swagger.io/specification/#path-templating
Specification states clearly the Path templating refers to Path Item only.
Unfortunately I have no access to the OpenAPI slack.
j616 commentedon Dec 17, 2025
This isn't using path templating, though, as far as I'm aware. The curly braces in the name aren't serialised, but are used in my example above to consistently convey the variable component to a human user. The templating is actually carried out by the
patternPropertiespart of the schema. I believe schemas are allowed here as they are called out in theallowEmptyValuedescription with regards to its interaction with Schema Objects, and stating thatallowEmptyValuesis only valid for Query Parameters.j616 commentedon Dec 17, 2025
There is a link for joining the OpenAPI slack in the "Participate" menu on the OpenAPI website.
p1c2u commentedon Dec 20, 2025
@j616
Unfortunately I didn't find any references in the slack to the specification that would validate your approach.
Per OAS 3.x there's no provision for:
When OAS references "Schema Objects" in parameter definitions (like with
allowEmptyValue), it refers to the value validation of the parameter NOT the parameter name itself.patternPropertiesworks on object properties in request/response bodies, not on parameter names. The OAS specification doesn't define any mechanism forpatternPropertiesto dynamically generate parameter names.Your pattern is clear and would make sense but this approach is not supported by the OpenAPI specification.
j616 commentedon Dec 20, 2025
https://open-api.slack.com/archives/C0EDH2QKD/p1755211848023869?thread_ts=1754309646.541589&cid=C0EDH2QKD is the thread where I was told by one of the maintainers that this is the approach to use in 3.1 . I wonder if that thread is the better place for this discussion so that the spec maintainers can be involved?