From faf5477bab184da93d7880310eb9527b53b60b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Barr=C3=A9?= Date: Thu, 5 Mar 2026 14:09:52 -0500 Subject: [PATCH 1/2] Revert backend rule names --- .spectral.backend.yaml | 8 ++++---- .workleap.rules.yaml | 8 ++++---- test.ps1 | 32 ++++++++++++++++---------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.spectral.backend.yaml b/.spectral.backend.yaml index b63091a..33234d2 100644 --- a/.spectral.backend.yaml +++ b/.spectral.backend.yaml @@ -15,10 +15,10 @@ rules: oas3-schema: true oas3-operation-security-defined: true schema-ids-must-have-alphanumeric-characters-only: true - schemas-properties-must-have-a-type-backend: true - path-schema-properties-must-have-a-type-backend: true - schema-object-must-have-a-type-backend: true - items-must-have-a-type-backend: true + schemas-properties-must-have-a-type: true + path-schema-properties-must-have-a-type: true + schema-object-must-have-a-type: true + items-must-have-a-type: true schema-name-length-must-be-short: true must-not-use-base-server-url: true # Backend to Backend specific rules diff --git a/.workleap.rules.yaml b/.workleap.rules.yaml index b6f2f45..4fca865 100644 --- a/.workleap.rules.yaml +++ b/.workleap.rules.yaml @@ -25,7 +25,7 @@ rules: functionOptions: match: '^[a-zA-Z0-9]+$' - schemas-properties-must-have-a-type-backend: + schemas-properties-must-have-a-type: description: "All schemas properties must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" recommended: true severity: warn @@ -56,7 +56,7 @@ rules: - required: ["anyOf"] - required: ["oneOf"] - path-schema-properties-must-have-a-type-backend: + path-schema-properties-must-have-a-type: description: "All path schema properties must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" recommended: true severity: warn @@ -70,7 +70,7 @@ rules: given: $..schema.properties.* then: *type-or-composition-check - schema-object-must-have-a-type-backend: + schema-object-must-have-a-type: description: "All schema objects must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schema-object-must-have-a-type" recommended: true severity: warn @@ -84,7 +84,7 @@ rules: given: $.components.schemas.* then: *type-or-composition-check - items-must-have-a-type-backend: + items-must-have-a-type: description: "All items must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#items-must-have-a-type" recommended: true severity: warn diff --git a/test.ps1 b/test.ps1 index 37f3a8f..6024b57 100644 --- a/test.ps1 +++ b/test.ps1 @@ -8,10 +8,10 @@ spectral --version $ruleset = Join-Path $PSScriptRoot ".workleap.rules.yaml" $testSpecs = @( - @{ rule = "items-must-have-a-type-backend"; expectError = $false; filename = "items-must-have-a-type-valid.yaml" }, - @{ rule = "items-must-have-a-type-backend"; expectError = $false; filename = "items-must-have-a-type-valid-ref.yaml" }, - @{ rule = "items-must-have-a-type-backend"; expectError = $true; filename = "items-must-have-a-type-valid-composition.yaml" }, - @{ rule = "items-must-have-a-type-backend"; expectError = $true; filename = "items-must-have-a-type-invalid.yaml" }, + @{ rule = "items-must-have-a-type"; expectError = $false; filename = "items-must-have-a-type-valid.yaml" }, + @{ rule = "items-must-have-a-type"; expectError = $false; filename = "items-must-have-a-type-valid-ref.yaml" }, + @{ rule = "items-must-have-a-type"; expectError = $true; filename = "items-must-have-a-type-valid-composition.yaml" }, + @{ rule = "items-must-have-a-type"; expectError = $true; filename = "items-must-have-a-type-invalid.yaml" }, @{ rule = "items-must-have-a-type-frontend"; expectError = $false; filename = "items-must-have-a-type-valid.yaml" }, @{ rule = "items-must-have-a-type-frontend"; expectError = $false; filename = "items-must-have-a-type-valid-ref.yaml" }, @{ rule = "items-must-have-a-type-frontend"; expectError = $false; filename = "items-must-have-a-type-valid-composition.yaml" }, @@ -26,28 +26,28 @@ $testSpecs = @( @{ rule = "must-support-client-credentials-oauth2"; expectError = $true; filename = "must-support-client-credentials-oauth2-invalid.yaml" }, @{ rule = "must-use-get-post-methods"; expectError = $false; filename = "must-use-get-post-methods-valid.yaml" }, @{ rule = "must-use-get-post-methods"; expectError = $true; filename = "must-use-get-post-methods-invalid.yaml" }, - @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid.yaml" }, - @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-ref.yaml" }, - @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $true; filename = "path-schema-properties-must-have-a-type-valid-composition.yaml" }, - @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $true; filename = "path-schema-properties-must-have-a-type-invalid.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-ref.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type"; expectError = $true; filename = "path-schema-properties-must-have-a-type-valid-composition.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type"; expectError = $true; filename = "path-schema-properties-must-have-a-type-invalid.yaml" }, @{ rule = "path-schema-properties-must-have-a-type-frontend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid.yaml" }, @{ rule = "path-schema-properties-must-have-a-type-frontend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-ref.yaml" }, @{ rule = "path-schema-properties-must-have-a-type-frontend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-composition.yaml" }, @{ rule = "path-schema-properties-must-have-a-type-frontend"; expectError = $true; filename = "path-schema-properties-must-have-a-type-invalid.yaml" }, - @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid.yaml" }, - @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-ref.yaml" }, - @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $true; filename = "schemas-properties-must-have-a-type-valid-composition.yaml" }, - @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $true; filename = "schemas-properties-must-have-a-type-invalid.yaml" }, + @{ rule = "schemas-properties-must-have-a-type"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid.yaml" }, + @{ rule = "schemas-properties-must-have-a-type"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-ref.yaml" }, + @{ rule = "schemas-properties-must-have-a-type"; expectError = $true; filename = "schemas-properties-must-have-a-type-valid-composition.yaml" }, + @{ rule = "schemas-properties-must-have-a-type"; expectError = $true; filename = "schemas-properties-must-have-a-type-invalid.yaml" }, @{ rule = "schemas-properties-must-have-a-type-frontend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid.yaml" }, @{ rule = "schemas-properties-must-have-a-type-frontend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-ref.yaml" }, @{ rule = "schemas-properties-must-have-a-type-frontend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-composition.yaml" }, @{ rule = "schemas-properties-must-have-a-type-frontend"; expectError = $true; filename = "schemas-properties-must-have-a-type-invalid.yaml" }, @{ rule = "schema-ids-must-have-alphanumeric-characters-only"; expectError = $false; filename = "schema-ids-must-have-alphanumeric-characters-only-valid.yaml" }, @{ rule = "schema-ids-must-have-alphanumeric-characters-only"; expectError = $true; filename = "schema-ids-must-have-alphanumeric-characters-only-invalid.yaml" }, - @{ rule = "schema-object-must-have-a-type-backend"; expectError = $false; filename = "schema-object-must-have-a-type-valid.yaml" }, - @{ rule = "schema-object-must-have-a-type-backend"; expectError = $false; filename = "schema-object-must-have-a-type-valid-ref.yaml" }, - @{ rule = "schema-object-must-have-a-type-backend"; expectError = $true; filename = "schema-object-must-have-a-type-valid-composition.yaml" }, - @{ rule = "schema-object-must-have-a-type-backend"; expectError = $true; filename = "schema-object-must-have-a-type-invalid.yaml" }, + @{ rule = "schema-object-must-have-a-type"; expectError = $false; filename = "schema-object-must-have-a-type-valid.yaml" }, + @{ rule = "schema-object-must-have-a-type"; expectError = $false; filename = "schema-object-must-have-a-type-valid-ref.yaml" }, + @{ rule = "schema-object-must-have-a-type"; expectError = $true; filename = "schema-object-must-have-a-type-valid-composition.yaml" }, + @{ rule = "schema-object-must-have-a-type"; expectError = $true; filename = "schema-object-must-have-a-type-invalid.yaml" }, @{ rule = "schema-object-must-have-a-type-frontend"; expectError = $false; filename = "schema-object-must-have-a-type-valid.yaml" }, @{ rule = "schema-object-must-have-a-type-frontend"; expectError = $false; filename = "schema-object-must-have-a-type-valid-ref.yaml" }, @{ rule = "schema-object-must-have-a-type-frontend"; expectError = $false; filename = "schema-object-must-have-a-type-valid-composition.yaml" }, From 6239bcd940380d79677eae63f883142f2e422dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Barr=C3=A9?= Date: Thu, 5 Mar 2026 14:12:51 -0500 Subject: [PATCH 2/2] wip --- .spectral.backend.yaml | 8 ++++---- .workleap.rules.yaml | 32 ++++++++++++++++++++++++++++++++ test.ps1 | 16 ++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/.spectral.backend.yaml b/.spectral.backend.yaml index 33234d2..b63091a 100644 --- a/.spectral.backend.yaml +++ b/.spectral.backend.yaml @@ -15,10 +15,10 @@ rules: oas3-schema: true oas3-operation-security-defined: true schema-ids-must-have-alphanumeric-characters-only: true - schemas-properties-must-have-a-type: true - path-schema-properties-must-have-a-type: true - schema-object-must-have-a-type: true - items-must-have-a-type: true + schemas-properties-must-have-a-type-backend: true + path-schema-properties-must-have-a-type-backend: true + schema-object-must-have-a-type-backend: true + items-must-have-a-type-backend: true schema-name-length-must-be-short: true must-not-use-base-server-url: true # Backend to Backend specific rules diff --git a/.workleap.rules.yaml b/.workleap.rules.yaml index 4fca865..bc9a745 100644 --- a/.workleap.rules.yaml +++ b/.workleap.rules.yaml @@ -25,6 +25,7 @@ rules: functionOptions: match: '^[a-zA-Z0-9]+$' + # For backward compatibility schemas-properties-must-have-a-type: description: "All schemas properties must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" recommended: true @@ -39,6 +40,13 @@ rules: - required: ["type"] - required: ["$ref"] + schemas-properties-must-have-a-type-backend: + description: "All schemas properties must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" + recommended: true + severity: warn + given: $..schemas.*.properties.* + then: *type-or-ref-check + schemas-properties-must-have-a-type-frontend: description: "All schemas properties must have a type, schema reference, or composition keyword (allOf/anyOf/oneOf). Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" recommended: true @@ -56,6 +64,7 @@ rules: - required: ["anyOf"] - required: ["oneOf"] + # For backward compatibility path-schema-properties-must-have-a-type: description: "All path schema properties must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" recommended: true @@ -63,6 +72,13 @@ rules: given: $..schema.properties.* then: *type-or-ref-check + path-schema-properties-must-have-a-type-backend: + description: "All path schema properties must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" + recommended: true + severity: warn + given: $..schema.properties.* + then: *type-or-ref-check + path-schema-properties-must-have-a-type-frontend: description: "All path schema properties must have a type, schema reference, or composition keyword (allOf/anyOf/oneOf). Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schemas-properties-must-have-a-type-and-path-schema-properties-must-have-a-type" recommended: true @@ -70,6 +86,7 @@ rules: given: $..schema.properties.* then: *type-or-composition-check + # For backward compatibility schema-object-must-have-a-type: description: "All schema objects must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schema-object-must-have-a-type" recommended: true @@ -77,6 +94,13 @@ rules: given: $.components.schemas.* then: *type-or-ref-check + schema-object-must-have-a-type-backend: + description: "All schema objects must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schema-object-must-have-a-type" + recommended: true + severity: warn + given: $.components.schemas.* + then: *type-or-ref-check + schema-object-must-have-a-type-frontend: description: "All schema objects must have a type, schema reference, or composition keyword (allOf/anyOf/oneOf). Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#schema-object-must-have-a-type" recommended: true @@ -84,6 +108,7 @@ rules: given: $.components.schemas.* then: *type-or-composition-check + # For backward compatibility items-must-have-a-type: description: "All items must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#items-must-have-a-type" recommended: true @@ -91,6 +116,13 @@ rules: given: $.components.schemas..items then: *type-or-ref-check + items-must-have-a-type-backend: + description: "All items must have a type or schema reference. Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#items-must-have-a-type" + recommended: true + severity: warn + given: $.components.schemas..items + then: *type-or-ref-check + items-must-have-a-type-frontend: description: "All items must have a type, schema reference, or composition keyword (allOf/anyOf/oneOf). Refer to: https://gsoftdev.atlassian.net/wiki/spaces/TEC/pages/3858235678/IDP+OpenAPI+Rulesets#items-must-have-a-type" recommended: true diff --git a/test.ps1 b/test.ps1 index 6024b57..884bf0e 100644 --- a/test.ps1 +++ b/test.ps1 @@ -12,6 +12,10 @@ $testSpecs = @( @{ rule = "items-must-have-a-type"; expectError = $false; filename = "items-must-have-a-type-valid-ref.yaml" }, @{ rule = "items-must-have-a-type"; expectError = $true; filename = "items-must-have-a-type-valid-composition.yaml" }, @{ rule = "items-must-have-a-type"; expectError = $true; filename = "items-must-have-a-type-invalid.yaml" }, + @{ rule = "items-must-have-a-type-backend"; expectError = $false; filename = "items-must-have-a-type-valid.yaml" }, + @{ rule = "items-must-have-a-type-backend"; expectError = $false; filename = "items-must-have-a-type-valid-ref.yaml" }, + @{ rule = "items-must-have-a-type-backend"; expectError = $true; filename = "items-must-have-a-type-valid-composition.yaml" }, + @{ rule = "items-must-have-a-type-backend"; expectError = $true; filename = "items-must-have-a-type-invalid.yaml" }, @{ rule = "items-must-have-a-type-frontend"; expectError = $false; filename = "items-must-have-a-type-valid.yaml" }, @{ rule = "items-must-have-a-type-frontend"; expectError = $false; filename = "items-must-have-a-type-valid-ref.yaml" }, @{ rule = "items-must-have-a-type-frontend"; expectError = $false; filename = "items-must-have-a-type-valid-composition.yaml" }, @@ -30,6 +34,10 @@ $testSpecs = @( @{ rule = "path-schema-properties-must-have-a-type"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-ref.yaml" }, @{ rule = "path-schema-properties-must-have-a-type"; expectError = $true; filename = "path-schema-properties-must-have-a-type-valid-composition.yaml" }, @{ rule = "path-schema-properties-must-have-a-type"; expectError = $true; filename = "path-schema-properties-must-have-a-type-invalid.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-ref.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $true; filename = "path-schema-properties-must-have-a-type-valid-composition.yaml" }, + @{ rule = "path-schema-properties-must-have-a-type-backend"; expectError = $true; filename = "path-schema-properties-must-have-a-type-invalid.yaml" }, @{ rule = "path-schema-properties-must-have-a-type-frontend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid.yaml" }, @{ rule = "path-schema-properties-must-have-a-type-frontend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-ref.yaml" }, @{ rule = "path-schema-properties-must-have-a-type-frontend"; expectError = $false; filename = "path-schema-properties-must-have-a-type-valid-composition.yaml" }, @@ -38,6 +46,10 @@ $testSpecs = @( @{ rule = "schemas-properties-must-have-a-type"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-ref.yaml" }, @{ rule = "schemas-properties-must-have-a-type"; expectError = $true; filename = "schemas-properties-must-have-a-type-valid-composition.yaml" }, @{ rule = "schemas-properties-must-have-a-type"; expectError = $true; filename = "schemas-properties-must-have-a-type-invalid.yaml" }, + @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid.yaml" }, + @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-ref.yaml" }, + @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $true; filename = "schemas-properties-must-have-a-type-valid-composition.yaml" }, + @{ rule = "schemas-properties-must-have-a-type-backend"; expectError = $true; filename = "schemas-properties-must-have-a-type-invalid.yaml" }, @{ rule = "schemas-properties-must-have-a-type-frontend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid.yaml" }, @{ rule = "schemas-properties-must-have-a-type-frontend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-ref.yaml" }, @{ rule = "schemas-properties-must-have-a-type-frontend"; expectError = $false; filename = "schemas-properties-must-have-a-type-valid-composition.yaml" }, @@ -48,6 +60,10 @@ $testSpecs = @( @{ rule = "schema-object-must-have-a-type"; expectError = $false; filename = "schema-object-must-have-a-type-valid-ref.yaml" }, @{ rule = "schema-object-must-have-a-type"; expectError = $true; filename = "schema-object-must-have-a-type-valid-composition.yaml" }, @{ rule = "schema-object-must-have-a-type"; expectError = $true; filename = "schema-object-must-have-a-type-invalid.yaml" }, + @{ rule = "schema-object-must-have-a-type-backend"; expectError = $false; filename = "schema-object-must-have-a-type-valid.yaml" }, + @{ rule = "schema-object-must-have-a-type-backend"; expectError = $false; filename = "schema-object-must-have-a-type-valid-ref.yaml" }, + @{ rule = "schema-object-must-have-a-type-backend"; expectError = $true; filename = "schema-object-must-have-a-type-valid-composition.yaml" }, + @{ rule = "schema-object-must-have-a-type-backend"; expectError = $true; filename = "schema-object-must-have-a-type-invalid.yaml" }, @{ rule = "schema-object-must-have-a-type-frontend"; expectError = $false; filename = "schema-object-must-have-a-type-valid.yaml" }, @{ rule = "schema-object-must-have-a-type-frontend"; expectError = $false; filename = "schema-object-must-have-a-type-valid-ref.yaml" }, @{ rule = "schema-object-must-have-a-type-frontend"; expectError = $false; filename = "schema-object-must-have-a-type-valid-composition.yaml" },