fix(validation): spectral r4.x ruleset stabilization fixes#146
Conversation
…d $ref The OWASP string-restricted rule's deep recursive JSONPath traverses Spectral's internally-resolved $ref copies, producing phantom findings with no source file and zeroed range. Filter these specifically for the string-restricted rule in parse_spectral_output(). Observed: 44 phantom warnings on ReleaseTest (actions/runs/23941828563).
…ssion Add proposed_changes section to rule-inventory.yaml for: - oas3-unused-component: downgrade to hint (discriminator false positives) - owasp:api4:2023-string-restricted: downgrade to hint (free-text strings cannot have format/pattern without backward-compatibility risk; resource consumption already covered by string-limit) - camara-schema-casing-convention: overrides for CloudEvents abbreviations (HTTPSettings, HTTPSubscriptionRequest/Response, PrivateKeyJWTCredential) All three require Commonalities discussion before implementation.
S-016 (schema-type-check): mark as partial — needs recursive rewrite. Proposed changes (preliminary decisions, tbc in PR): - S-211 (oas3-unused-component): post-filter downgrade to hint - S-313 (string-restricted): post-filter downgrade to hint + hint text - S-015 (schema-casing): custom JS function with CloudEvents exceptions
7feeeb2 to
0aa101c
Compare
S-211 (oas3-unused-component): post-filter downgrade to hint — Spectral does not follow discriminator mappings, producing false positives. S-313 (string-restricted): post-filter downgrade to hint — free-text fields cannot have format/pattern without backward-compatibility risk. S-015 (schema-casing): custom JS function replaces built-in casing:pascal in .spectral-r4.yaml. Exact exception list for 4 CloudEvents schema names (HTTPSettings, HTTPSubscriptionRequest/Response, PrivateKeyJWTCredential). r3.4 and fallback rulesets unchanged.
|
Updated with additional rule changes Beyond the original phantom findings fix, this PR now includes three rule adjustments based on ReleaseTest validation analysis: Post-filter severity changes (Spectral config unchanged, Linting-rules.md preserved):
Spectral rule change (r4.x ruleset only):
Also tracked All decisions are tracked in |
Replace inline pattern rule with custom JS function in .spectral-r4.yaml. Recursively checks type presence and value through properties, items, and additionalProperties. Accepts allOf/anyOf/oneOf as valid alternatives to type, marks combiner children as partial (no type required). Original inline rule preserved in r3.4 and fallback rulesets.
|
S-016 ( The original inline rule only checked top-level
Applied to |
|
Merging the fixes now to avoid merge conflicts with the upcoming next bunch of Spectral rules; and to be able to test the changes. |
What type of PR is this?
bug, correction
What this PR does / why we need it:
Follow-up fixes after OWASP rule integration (#145), based on ReleaseTest validation runs (dispatch, PR):
.spectral-r4.yamlheaderstring-restrictedfindings produced by Spectral's internal$refdereferencing (44 phantom warnings observed on ReleaseTest dispatch run)rule-inventory.yaml:oas3-unused-component→ hint (false positives from discriminator mappings)owasp:api4:2023-string-restricted→ hint (free-text strings can't have format/pattern without backward-compatibility risk; resource consumption already covered bystring-limit)camara-schema-casing-convention→ overrides for CloudEvents abbreviation prefixes (HTTP,JWT)Which issue(s) this PR fixes:
Related: #145 (OWASP rules integration)
Related: ReleaseManagement#448 (validation framework umbrella)
Special notes for reviewers:
This PR also serves as a place to collect feedback on the OWASP rule configuration from #145. The severity levels follow Commonalities Linting-rules.md section 5 — proposed deviations are tracked in
rule-inventory.yamlfor upstream discussion.The phantom findings issue affects only unbundled specs with
$reftocode/common/files. On snapshot branches (bundled specs), no phantoms occur.Changelog input
Additional documentation
This section can be blank.