From 31d821058fe2102a7a2cdf6cbd013c4432a66dfe Mon Sep 17 00:00:00 2001 From: ravindrapalaskar17 <117813163+ravindrapalaskar17@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:05:36 +0530 Subject: [PATCH 1/5] Update-Camara-path-param-id-rule --- artifacts/linting_rules/.spectral.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artifacts/linting_rules/.spectral.yml b/artifacts/linting_rules/.spectral.yml index 0042b3c4..94ddba07 100644 --- a/artifacts/linting_rules/.spectral.yml +++ b/artifacts/linting_rules/.spectral.yml @@ -84,12 +84,12 @@ rules: description: | This rule ensures consistent and descriptive naming for path parameters in your OpenAPI specification. Please use 'resource_id' instead of just 'id' for your path parameters. - given: "$..parameters[?(@.in == 'path')]" + given: "$.paths[*][*].parameters[?(@.in == 'path')].name" then: field: name function: pattern functionOptions: - notMatch: \b(id|Id|ID|iD)\b + match: "^(?!.*\\b(id|Id|ID|iD)\\b).*$" recommended: true # Set to true/false to enable/disable this rule camara-security-no-secrets-in-path-or-query-parameters: From 2ee64cd5dae086975193bd069bdc255622f266a9 Mon Sep 17 00:00:00 2001 From: ravindrapalaskar17 <117813163+ravindrapalaskar17@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:07:05 +0530 Subject: [PATCH 2/5] Update camara-discriminator-use rule --- artifacts/linting_rules/.spectral.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/artifacts/linting_rules/.spectral.yml b/artifacts/linting_rules/.spectral.yml index 94ddba07..59a5c477 100644 --- a/artifacts/linting_rules/.spectral.yml +++ b/artifacts/linting_rules/.spectral.yml @@ -219,13 +219,20 @@ rules: description: | Ensure that API definition YAML files with oneOf or anyOf sections include a discriminator object for serialization, deserialization, and validation. severity: hint - given: "$..[?(@.oneOf || @.anyOf)]" + given: "$.components.schemas[*]" then: - field: discriminator - function: truthy - description: "Discriminator object is required when using oneOf or anyOf." + - field: oneOf + function: truthy + message: "Schemas with 'oneOf' should include a 'discriminator' for type identification." + - field: anyOf + function: truthy + message: "Schemas with 'anyOf' should include a 'discriminator' for type identification." + - field: discriminator + function: truthy + message: "A 'discriminator' object is required when using 'oneOf' or 'anyOf'." recommended: true # Set to true/false to enable/disable this rule + camara-operationid-casing-convention: message: Operation Id must be in Camel case "{{error}}" severity: hint From 63dde2625b9b89c43e9a94a5233b5683f7c80dbd Mon Sep 17 00:00:00 2001 From: ravindrapalaskar17 <117813163+ravindrapalaskar17@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:18:39 +0530 Subject: [PATCH 3/5] Update the line space --- artifacts/linting_rules/.spectral.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/artifacts/linting_rules/.spectral.yml b/artifacts/linting_rules/.spectral.yml index 59a5c477..90d256a1 100644 --- a/artifacts/linting_rules/.spectral.yml +++ b/artifacts/linting_rules/.spectral.yml @@ -232,7 +232,6 @@ rules: message: "A 'discriminator' object is required when using 'oneOf' or 'anyOf'." recommended: true # Set to true/false to enable/disable this rule - camara-operationid-casing-convention: message: Operation Id must be in Camel case "{{error}}" severity: hint From 4eeffbc912773b066c80052dc55ab3e71011db18 Mon Sep 17 00:00:00 2001 From: ravindrapalaskar17 <117813163+ravindrapalaskar17@users.noreply.github.com> Date: Tue, 3 Dec 2024 00:19:09 +0530 Subject: [PATCH 4/5] Update Changelog --- artifacts/linting_rules/.spectral.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/artifacts/linting_rules/.spectral.yml b/artifacts/linting_rules/.spectral.yml index 90d256a1..6db6d3e0 100644 --- a/artifacts/linting_rules/.spectral.yml +++ b/artifacts/linting_rules/.spectral.yml @@ -3,6 +3,7 @@ # Changelog: # - 31.01.2024: Initial version # - 19.03.2024: Corrected camara-http-methods rule +# - 03.12.2021: Corrected camara-path-param-id and camara-discriminator-use to handle null values error in example fields extends: "spectral:oas" From aa4244ff80b789803daab857ebedf9ce3833148d Mon Sep 17 00:00:00 2001 From: Rafal Artych <121048129+rartych@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:08:57 +0100 Subject: [PATCH 5/5] Update .spectral.yml Date correction --- artifacts/linting_rules/.spectral.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/linting_rules/.spectral.yml b/artifacts/linting_rules/.spectral.yml index 6db6d3e0..03eb5348 100644 --- a/artifacts/linting_rules/.spectral.yml +++ b/artifacts/linting_rules/.spectral.yml @@ -3,7 +3,7 @@ # Changelog: # - 31.01.2024: Initial version # - 19.03.2024: Corrected camara-http-methods rule -# - 03.12.2021: Corrected camara-path-param-id and camara-discriminator-use to handle null values error in example fields +# - 03.12.2024: Corrected camara-path-param-id and camara-discriminator-use to handle null values error in example fields extends: "spectral:oas"