Skip to content

Latest commit

 

History

History

path-excludes-pattern

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Paths should not match a pattern

Authors:

What this does and why

The no-http-verbs-in-paths rule is pre-built for a very specific set of patterns. This rule is the general Swiss army knife version. If you absolutely know something should not be in the path (for example foo), then add the pattern to prevent it.

Some common things to check using this rule: other common CRUD verbs, bad words, and internal code or terminology.

Code

Add this to the rules section of your redocly.yaml:

rules:
  rule/path-exclude-pattern:
    subject:
      type: Paths
    assertions:
      notPattern: \/wrong

If you want to exclude multiple patterns, you may write several rules like this each with a different pattern.

Examples

Here's an example of an OpenAPI description:

openapi: 3.1.0
info:
  title: Title
  version: 1.0.0
paths:
  /good:
    $ref: ./good.yaml
  /wrong: # <-- This will error
    $ref: ./wrong.yaml

References

Built-in no-http-verbs-in-paths rule.