Limit Path Length
limit-path-length
info
experience: usabilityexperience: consistency
spec: paths
APIs SHOULD NOT expand their total URL length beyond a few hundred characters.
APIs SHOULD NOT expand their total URL length beyond a few hundred characters.
Rule definition
The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.
limit-path-length:
title: Limit Path Length
reference: https://spotlight-rules.com/spec/rules/openapi/limit-path-length/
description: APIs SHOULD NOT expand their total URL length beyond a few hundred
characters.
message: APIs SHOULD NOT expand their total URL length beyond a few hundred
characters.
severity: info
given: $.paths.*~
then:
function: length
functionOptions:
max: 100
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-length' (Limit Path Length). Requirement: APIs
SHOULD NOT expand their total URL length beyond a few hundred characters. To
fix: Ensure the length of the targeted value is at most 100. 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-length' (Limit Path Length). Requirement: APIs SHOULD NOT expand their total URL length beyond a few hundred characters. To fix: Ensure the length of the targeted value is at most 100. 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-length/ |