Enforces valid use of querystring parameters.
| OAS | Compatibility |
|---|---|
| 2.0 | ❌ |
| 3.0 | ❌ |
| 3.1 | ❌ |
| 3.2 | ✅ |
OpenAPI 3.2 introduces the querystring parameter location for representing the full query string as a single schema (e.g. application/x-www-form-urlencoded).
This rule ensures that:
- There is at most one
querystringparameter. Parameters within: querystringmay be defined only once per path/operation parameter set. - No mixing
querystringwithquery. Parameters within: querycannot be used together within: querystringin the same operation/path parameter set.
| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default error (in recommended configuration). |
An example configuration:
rules:
spec-querystring-parameters: errorGiven this configuration:
rules:
spec-querystring-parameters: errorExample of incorrect use (mixing query and querystring):
paths:
/events:
get:
summary: List events
parameters:
- name: timezone
in: query
schema:
type: string
default: UTC
- name: criteria
in: querystring
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
startDate: { type: string, format: date }
endDate: { type: string, format: date }
status: { type: string, enum: [scheduled, cancelled, completed] }Example of incorrect use (multiple querystring parameters):
paths:
/events:
get:
summary: List events
parameters:
- name: filters
in: querystring
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
startDate: { type: string, format: date }
status: { type: string }
- name: pagination
in: querystring
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
limit: { type: integer }
offset: { type: integer }Example of correct use (single querystring parameter, no query):
paths:
/events:
get:
summary: List events
parameters:
- name: params
in: querystring
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
startDate: { type: string, format: date }
endDate: { type: string, format: date }
status: { type: string, enum: [scheduled, cancelled, completed] }
limit: { type: integer, default: 20 }
offset: { type: integer, default: 0 }