path-not-include-query
Disallows ? in an OpenAPI path key.
| Attribute | Value |
|---|---|
| Category | Operations |
| Maturity | Baseline |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Warning |
| Lenient–Complete | Error |
Intent
OpenAPI models query inputs as parameters, keeping the route identity separate from optional query data.
Flags
Any path key containing a question mark anywhere.
Does not flag
Paths without ?. The rule does not verify that removed query items have corresponding parameter definitions.
See it fail
paths:
/payments?status={status}:
get:
responses:
'200': {description: OK}
Diagnostic: Don't put query string items in the path, they belong in parameters with `in: query`.
Fix it
paths:
/payments:
get:
parameters:
- name: status
in: query
schema:
type: string
responses:
'200': {description: OK}
Configure
profiles:
default:
rules:
extends: [recommended]
override:
path-not-include-query: warn
Nearby: path-parameters-defined, query-parameter-camel-case.