Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions tools/spectral/.spectral.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: xgen-docs-parameter-examples-or-schema legacy rule will be removed after xgen-IPA-117-parameter-has-examples-or-schema rolled out

Do we have a ticket for this? Or is it covered in one of the existing tickets?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created the ticket for the last rollout, and included this one there. Let me know how it sounds

Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ aliases:
- "$.components.schemas[*]..properties[?(@ && @.type)]"

rules:
xgen-schema-properties-camel-case:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if there are overrides for these below that can be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overrides removed for all the removed legacy Spectral rules 👍

description:
All properties in the schema must be camelCase. http://go/ipa/112
severity: error
recommended: true
message: "`{{property}}` MUST follow camelCase"
given: "$.components.schemas..properties[*]~"
then:
function: pattern # casing?
functionOptions:
match: "/^[a-z$_]{1}[A-Z09$_]*/" # type: camel ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[To ensure] Is that regexp exactly the same that the one we have or it is least restrictive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using Spectral's camel casing rule, such as
[CasingType.camel]: '[a-z][a-z{__DIGITS__}]*(?:[A-Z{__DIGITS__}](?:[a-z{__DIGITS__}]+|$))*',
Only difference I can see is that Spectral one does not allow underscores


xgen-schema-name-pascal-case:
description: OpenAPI Schema names should use PascalCase. PascalCase ensures consistency with OpenAPI generated code.
message: "`{{property}}` name must follow PascalCase. Please verify if you have provided valid @Schema(name='') annotation"
Expand All @@ -38,41 +26,6 @@ rules:
functionOptions:
match: "^[A-Z].*" # type: pascal ?

xgen-description:
description: "Use this field to describe the action performed by each specific API endpoint or property, to provide context for how to use it to the users of the API."
message: "{{error}}."
severity: error
given: "#DescribableObjects"
then:
- field: "description"
function: truthy
- field: "description"
function: pattern
functionOptions:
match: "/^[A-Z]/"
- field: "description"
function: pattern
functionOptions:
match: "\\.|\|$"

xgen-request-GET-no-body:
description: "A 'GET' request MUST NOT accept a 'body` parameter. http://go/ipa/104"
severity: error
given: $.paths..get.parameters..in
then:
function: pattern
functionOptions:
notMatch: "/^body$/"

xgen-request-DELETE-no-body:
description: "A 'DELETE' request MUST NOT accept a 'body` parameter. http://go/ipa/108"
severity: error
given: $.paths..delete.parameters..in
then:
function: pattern
functionOptions:
notMatch: "/^body$/"

xgen-docs-tags-alphabetical:
message: "Tags should be defined in alphabetical order."
description: "Many documentation tools show tags in the order they are defined, so defining them not in alphabetical order can look funny to API consumers."
Expand Down Expand Up @@ -185,17 +138,6 @@ rules:
match: "^mms(,[a-zA-Z0-9_-]+)*$"
message: "'additionalServices' must start with 'mms' and can include additional services in a comma-separated format."

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]+$"

xgen-security-override:
description: "Security must not be set at resource or method level because it is set globally. Use @Unauthenticated annotation to set no security. https://go/openapi-unauthenticated-annotation"
severity: error
Expand Down Expand Up @@ -248,20 +190,6 @@ overrides:
- "*.yaml#/components/schemas/tokenFiltertrim"
rules:
xgen-schema-name-pascal-case: "off"
- files:
- "*.yaml#/components/schemas/charFiltermapping"
rules:
xgen-description: "off"
- files:
- "*.yaml#/components/schemas/IndexOptions"
- "*.yaml#/components/schemas/NetworkPermissionEntryStatus"
rules:
xgen-schema-properties-camel-case: "off"
- files:
- "*.yaml#/components/schemas/DataLakeStoreSettings/properties/provider" # dynamic field which can't be documented
- "*.yaml#/components/schemas/ClusterProviderSettings/properties/providerName" # dynamic field which can't be documented
rules:
xgen-description: "off"
- files:
- "**#/components/schemas/ApiError/properties/parameters" # see https://github.com/stoplightio/spectral/issues/2592
rules:
Expand Down
Loading