fix(ipa): allow Operations endpoint paths in IPA-102 alternation check - #1406
Merged
Conversation
The LRO standardization work introduces read-only Operations endpoints
nested under a parent resource:
<parent>/operations
<parent>/operations/{operationId}
<parent>/{resourceId}/operations
<parent>/{resourceId}/operations/{operationId}
xgen-IPA-102-path-alternate-resource-name-path-param rejected the
collection-scoped shapes, because `operations` sits where the rule
expects a path parameter.
Treat a trailing `operations` or `operations/{operationId}` as a
parity-neutral suffix: strip it, then run the existing alternation check
unchanged. A positional carve-out is not sufficient, since an
odd-indexed non-param segment shifts the parity of every segment after
it, so `<parent>/operations/{operationId}` would still fail.
The exemption requires a parent segment, so a bare `/operations` at the
API root is unaffected; rejecting unscoped Operations endpoints belongs
to IPA-132, not IPA-102.
Verified additive: replaying the old and new logic over all 367 paths in
openapi/.raw/v2.yaml produces zero behaviour changes.
The Operations exemption is described by its own bullet, so the existing 'must follow a pattern where resource names and path parameters strictly alternate' line does not need softening.
…comment The two unauth paths are collection-scoped, not instance-scoped, so they sat under the wrong comment.
julius-jogela
marked this pull request as ready for review
July 29, 2026 10:36
julius-jogela
requested review from
andmatei,
andreaangiolillo,
drinkbird,
matt-condon,
saisundar,
wtrocki and
yelizhenden-mdb
July 29, 2026 10:36
Slicing an unscoped Operations path down to no segments already passes the alternation check vacuously, so the ternary fallback and the comment explaining it were describing a distinction with no observable effect.
lovisaberggren
approved these changes
Jul 29, 2026
An Operations path that now passes but still carries an x-xgen-IPA-exception gets an unnecessary-exception error, which is a direct consequence of this change and worth pinning. Drop the customAction case, which duplicates the existing resourceName1/ resourceName2 coverage.
This was referenced Jul 29, 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.
Proposed changes
Problem: LRO standardization (IPA-132) needs read-only Operations endpoints nested under a parent resource, at both collection and instance scope:
<parent>/operations<parent>/operations/{operationId}<parent>/{resourceId}/operations<parent>/{resourceId}/operations/{operationId}xgen-IPA-102-path-alternate-resource-name-path-paramrejects the two collection-scoped shapes today, because the rule expects path segments to alternate resource-name / path-param, andoperationssits where a{param}is expected.Fix: treat a trailing
operationsoroperations/{operationId}as a parity-neutral suffix, strip it off the path first, then run the existing alternation check unchanged on what's left.Verification: replaying the old and new rule logic over all 367 paths in
openapi/.raw/v2.yamlproduces zero behavior changes on existing paths, confirming the change is additive.Jira ticket: CLOUDP-429009
Checklist
Changes to Spectral