APIMGMT-1888: Add new rule to validate versionDetailsMap keys against versionEnd#69
Merged
Merged
Conversation
Linting ReportLast updated: 4/7/2026, 2:42:17 PM Found 12 total issues:
OpenAPI Specs❌ Invalid Ref (8)
❌ Paths Must Not Reference Documents Outside Of Their Version (2)
❌ Root Tags Must Be In Alphabetical Order (1)
Gateway❌ Gateway Route Version Details Map Keys Must Not Exceed Version End (1)
|
…in sp-gateway-routes.yaml
| const year = yearFromVersionDetailsKey(key); | ||
| if (year !== null && year > endVersion) { | ||
| results.push({ | ||
| message: `versionDetailsMap key "${key}" (API version ${year}) cannot be greater than versionEnd (${endVersion}); that entry is ignored by sp-gateway.`, |
There was a problem hiding this comment.
So, will this message include the variables from the route? Will this appear in the linter report?
Or will the user only see generic message "versionDetailsMap keys for yearly API versions (v20XX) must not be greater than versionEnd, or sp-gateway will ignore them"?
I think specific message is better, but I don't see that in your pr example.
…in gateway-ruleset.yaml
lori-vangulick-sp
approved these changes
Apr 7, 2026
prateek-lohani-sp
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Spectral rule for gateway route specs so that versionDetailsMap does not contain yearly API version keys (v20XX) above versionEnd. Entries whose version is greater than versionEnd are ignored by sp-gateway, so this catches silent misconfiguration in sp-gateway-routes.yaml (and related files) at lint time.
spectral lint on a gateway YAML using gateway-ruleset.yaml completes successfully against the current sp-gateway-routes.yaml in consuming repos (no new violations for valid configs). Then, I modified the test YAML file to include an entry that would result in a violation, obtaining the following result: