-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE-249: [update] Spectral & OAS, add obj properties and array item…
…s to linter + fixes (#254) <!-- Ticket number or summary of work --> * #249 ## What changed? <!-- Provide a bulleted list in the present tense --> * Update spectral linter to remove old caveats * Update spectral linter to add the following requirements * all objects have a properties attribute * all arrays have an items attribute * all schemas with a properties attribute have type: object * Update the spec files to meet the new linting requirements ## Release notes draft <!-- Provide an entry for the release notes using simple, conversational language. Don't be too technical. Explain how the change will benefit the merchant and link to the feature. Examples: * The newly-released [X feature] is now available to use. Now, you’ll be able to [perform Y action]. * We're happy to announce [X feature], which can help you [perform Y action]. * [X feature] helps you to create [Y response] using the [Z query parameter]. Now, you can deliver [ex, localized shopping experiences for your customers]. * Fixed a bug in the [X endpoint]. Now the [Y field] will appear when you click [Z option]. --> * ## Anything else? <!-- Add related PRs, salient notes, additional ticket numbers, etc. --> ping @jb-gourav
- Loading branch information
Sarah Riehl
authored
May 6, 2024
1 parent
7a92b37
commit 20525cb
Showing
49 changed files
with
1,170 additions
and
1,294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,44 @@ | ||
extends: spectral:oas | ||
rules: | ||
info-contact: off | ||
oas3-unused-component: off | ||
oas2-unused-definition: off | ||
except: | ||
'reference/tax_provider.yml': | ||
- oas3-schema | ||
'reference/carts.v3.yml': | ||
- oas2-oneOf | ||
- oas2-valid-schema-example | ||
- operation-tag-defined | ||
'reference/catalog.v3.yml': | ||
- oas2-operation-security-defined | ||
- oas3-schema | ||
- oas2-schema | ||
- oas2-valid-media-example | ||
- oas2-valid-schema-example | ||
'reference/channels.v3.yml': | ||
- oas3-schema | ||
- oas3-valid-media-example | ||
'reference/current_customer.yml': | ||
- operation-success-response | ||
'reference/custom-template-associations.v3.yml': | ||
- openapi-tags | ||
- operation-tag-defined | ||
'reference/customer_login.yml': | ||
- operation-success-response | ||
'reference/email_templates.v3.yml': | ||
- oas3-schema | ||
'reference/geography.v2.yml': | ||
- oas2-valid-media-example | ||
'reference/orders.v2.oas2.yml': | ||
- oas3-valid-schema-example | ||
- oas3-valid-media-example | ||
- oas3-schema | ||
'reference/orders.v3.yml': | ||
- oas2-valid-schema-example | ||
- oas2-valid-media-example | ||
- oas2-anyOf | ||
'reference/settings.v3.yml': | ||
- oas3-valid-media-example | ||
'reference/sites.v3.yml': | ||
- oas2-valid-media-example | ||
'reference/store_information.v2.yml': | ||
- oas2-valid-media-example | ||
- oas2-valid-schema-example | ||
'reference/themes.v3.yml': | ||
- oas3-schema | ||
'reference/webhooks.v3.yml': | ||
- oas3-valid-media-example | ||
'carts.v3.yml': | ||
- oas2-oneOf | ||
- oas2-valid-schema-example | ||
'catalog.v3.yml': | ||
- oas2-operation-security-defined | ||
- oas3-schema | ||
- oas2-schema | ||
- oas2-valid-media-example | ||
- oas2-valid-schema-example | ||
'channels.v3.yml': | ||
- oas3-schema | ||
- oas3-valid-media-example | ||
'current_customer.yml': | ||
- operation-success-response | ||
'customer_login.yml': | ||
- operation-success-response | ||
'email_templates.v3.yml': | ||
- oas3-schema | ||
'geography.v2.yml': | ||
- oas2-valid-media-example | ||
'orders.v2.oas2.yml': | ||
- oas3-valid-schema-example | ||
- oas3-valid-media-example | ||
- oas3-schema | ||
'orders.v3.yml': | ||
- oas2-valid-schema-example | ||
- oas2-valid-media-example | ||
- oas2-anyOf | ||
'settings.v3.yml': | ||
- oas3-valid-media-example | ||
'sites.v3.yml': | ||
- oas2-valid-media-example | ||
'store_information.v2.yml': | ||
- oas2-valid-media-example | ||
- oas2-valid-schema-example | ||
'themes.v3.yml': | ||
- oas3-schema | ||
'webhooks.v3.yml': | ||
- oas3-valid-media-example | ||
'pages.v3.yml': | ||
- oas3-valid-media-example | ||
- oas3-valid-schema-example | ||
properties-type-object: | ||
description: "type: object must have a properties sibling." | ||
given: "$..[?(@ && @.type == 'object')]" | ||
severity: error | ||
# must not be resolved because $ref-defined objects shall have its type | ||
# defined in the referenced schema, not the referencing field (and $ref | ||
# must be the only property, anyway) | ||
resolved: false | ||
# type field must be defined and contain the value object | ||
then: | ||
- field: "properties" | ||
function: "truthy" | ||
items-type-array: | ||
description: "type: array must have an items sibling." | ||
given: "$..[?(@ && @.type == 'array')]" | ||
severity: error | ||
# must not be resolved because $ref-defined objects shall have its type | ||
# defined in the referenced schema, not the referencing field (and $ref | ||
# must be the only property, anyway) | ||
resolved: false | ||
# type field must be defined and contain the value object | ||
then: | ||
- field: "items" | ||
function: "truthy" | ||
type-object-properties: | ||
description: "Objects with properties must have type: object." | ||
given: "$..[?(@ && @.properties)]" | ||
severity: error | ||
# must not be resolved because $ref-defined objects shall have its type | ||
# defined in the referenced schema, not the referencing field (and $ref | ||
# must be the only property, anyway) | ||
resolved: false | ||
# type field must be defined and contain the value object | ||
then: | ||
- field: "type" | ||
function: defined | ||
- field: "type" | ||
function: enumeration | ||
functionOptions: | ||
values: | ||
- object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
extends: | ||
- spectral:oas | ||
- ../.spectral.yaml | ||
rules: | ||
info-contact: off | ||
oas3-unused-components: off | ||
oas2-unused-definition: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,6 +227,7 @@ paths: | |
required: | ||
- locale | ||
- keys | ||
type: object | ||
properties: | ||
locale: | ||
type: string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.