Limit Path Parameter
limit-path-parameter
info
experience: usabilityexperience: consistency
spec: paths
The URL path should not contain more than 3 dynamic path parameters.
The URL path should not contain more than 3 dynamic path parameters.
Rule definition
The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.
limit-path-parameter:
title: Limit Path Parameter
reference: https://spotlight-rules.com/spec/rules/openapi/limit-path-parameter/
description: The URL path should not contain more than 3 dynamic path parameters.
message: The URL path should not contain more than 3 dynamic path parameters.
severity: info
given: $.paths.*~
then:
function: pattern
functionOptions:
notMatch: ^(.*{{1}.*){4,}
tags:
- format:openapi
- spec:paths
- experience:usability
- experience:consistency
prompt: "You are editing an OpenAPI document to satisfy the Spotlight API
governance rule 'limit-path-parameter' (Limit Path Parameter). Requirement:
The URL path should not contain more than 3 dynamic path parameters. To fix:
Ensure the targeted value does NOT match the regular expression
`^(.*{{1}.*){4,}`; rename or rewrite any value that does. This rule is
evaluated at the JSONPath `$.paths.*~` — inspect every location it matches
and correct only what violates the rule. Make the smallest change that
satisfies the rule, leave all unrelated content, key order, comments, and
formatting unchanged, and keep the document valid OpenAPI. Return only the
complete corrected document, with no commentary."
AI fix prompt — send this to Claude, Gemini, or ChatGPT with your artifact to auto-fix this rule
You are editing an OpenAPI document to satisfy the Spotlight API governance rule 'limit-path-parameter' (Limit Path Parameter). Requirement: The URL path should not contain more than 3 dynamic path parameters. To fix: Ensure the targeted value does NOT match the regular expression `^(.*{{1}.*){4,}`; rename or rewrite any value that does. This rule is evaluated at the JSONPath `$.paths.*~` — inspect every location it matches and correct only what violates the rule. Make the smallest change that satisfies the rule, leave all unrelated content, key order, comments, and formatting unchanged, and keep the document valid OpenAPI. Return only the complete corrected document, with no commentary.
| Artifact | OpenAPI |
|---|---|
| Applies at (given) | $.paths.*~ |
| Severity | info — educational by default; raise to warn/error to enforce |
| Reference | https://spotlight-rules.com/spec/rules/openapi/limit-path-parameter/ |