diff --git a/tools/spectral/.spectral.yaml b/tools/spectral/.spectral.yaml index eb4614f05..78017c105 100644 --- a/tools/spectral/.spectral.yaml +++ b/tools/spectral/.spectral.yaml @@ -184,6 +184,17 @@ rules: field: allow_diff pattern: "^true$" + no-slash-before-custom-method: + description: "Custom methods (e.g., ':applyItem') should not be preceded by a '/'." + message: "The path '{{path}}' contains a '/' before a custom method. Custom methods should not start with a '/'." + severity: error + given: "$.paths" + then: + field: "@key" + function: pattern + functionOptions: + notMatch: "/[^/]+/:[a-zA-Z]+$" + overrides: - files: # load sample data has an issue with different path param names for different VERBS - "*.yaml#/paths/~1api~1atlas~1v1.0~1groups~1%7BgroupId%7D~1sampleDatasetLoad~1%7BsampleDatasetId%7D"