You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to override Spectral rules for specific paths within an OpenAPI file using JSON Pointer notation, the override does not take effect.
Test Case
The test case includes:
A simple rule checking for Cache-Control headers
An attempt to override this rule for a specific endpoint using path notation
A minimal OpenAPI specification demonstrating the issue
Setup
Install Spectral CLI:
npm install -g @stoplight/spectral-cli
Run the test:
spectral lint reference/api.yaml
Expected Behavior
The rule should be disabled for the /resources/details endpoint due to the override in .spectral.yaml.
Actual Behavior
The rule is still applied despite the override configuration.
Expected Output
(base) david.lance@David-Lance spectral-rule-override-for-endpoint-failure % spectral lint test-cases/failing/api.yaml --verbose
Found 57 rules (46 enabled)
Linting /Users/david.lance/Workspace/spectral-rule-override-for-endpoint-failure/reference/api.yaml
No results with a severity of 'error' found!
Actual Output
bash-3.2$ spectral lint reference/api.yaml
/Users/david.lance/Workspace/spectral/spectral-rule-no-store/test-cases/shared/common.yaml
5:20 error cache-control-header-rule Success responses should contain a `Cache-Control` header value of `no-store`. components.headers.CacheControlHeader.description
Additional Notes
File-level overrides (without path specification) work as expected. Also found that the ** prefix was necessary to target the file.:
overrides:
- files:
- "**/reference/api.yaml"# This works
Spectral Override Test Case
This repository demonstrates a potential issue with Spectral's override functionality when targeting specific paths within OpenAPI files.
Sample project: https://github.com/david-lance/spectral-rule-override-for-endpoint-failure.git
Issue Description
When attempting to override Spectral rules for specific paths within an OpenAPI file using JSON Pointer notation, the override does not take effect.
Test Case
The test case includes:
Setup
Install Spectral CLI:
Run the test:
Expected Behavior
The rule should be disabled for the
/resources/details
endpoint due to the override in.spectral.yaml
.Actual Behavior
The rule is still applied despite the override configuration.
Expected Output
Actual Output
Additional Notes
File-level overrides (without path specification) work as expected. Also found that the
**
prefix was necessary to target the file.:Directory Structure
Environment
Spectral Version: 6.13.0
The text was updated successfully, but these errors were encountered: