spectral:oas warn on by default

path-not-include-query

Path must not include query string.

Applies to
paths
Selects
$.paths
Function
pattern
Specs
OpenAPI 2.0OpenAPI 3.0OpenAPI 3.1OpenAPI 3.2

Use it

This rule ships with OpenLint in spectral:oas. Extending the ruleset turns it on:

extends: spectral:oas
rules:
  path-not-include-query: warn   # or off, or another severity

Definition

As defined in @openlint/openlint-rulesets. Functions show by name.

path-not-include-query:
  description: Path must not include query string.
  recommended: true
  given: $.paths
  then:
    field: '@key'
    function: pattern
    functionOptions:
      notMatch: \?

About this rule

Don’t put query string items in the path, they belong in parameters with in: query.

Sources