Skip to main content

path-not-include-query

Disallows ? in an OpenAPI path key.

AttributeValue
CategoryOperations
MaturityBaseline
OpenAPISwagger 2.0; OpenAPI 3.0, 3.1, 3.2
StarterWarning
Lenient–CompleteError

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.