Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ testRule('xgen-IPA-117-create-operation-summary-starts-with', [
code: 'xgen-IPA-117-create-operation-summary-starts-with',
message: 'Operation summary must start with one of the words [Create,Add].',
path: ['paths', '/resource', 'post'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-create-operation-summary-starts-with',
message: 'Operation summary must start with one of the words [Create,Add].',
path: ['paths', '/projects/{id}/users', 'post'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ testRule('xgen-IPA-117-delete-operation-summary-starts-with', [
code: 'xgen-IPA-117-delete-operation-summary-starts-with',
message: 'Operation summary must start with one of the words [Delete,Remove].',
path: ['paths', '/resource', 'delete'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-delete-operation-summary-starts-with',
message: 'Operation summary must start with one of the words [Delete,Remove].',
path: ['paths', '/projects/{id}/users', 'delete'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ testRule('xgen-IPA-117-operation-summary-format', [
code: 'xgen-IPA-117-operation-summary-format',
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
path: ['paths', '/resource/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-operation-summary-format',
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
path: ['paths', '/resource', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-operation-summary-format',
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
path: ['paths', '/resource/{id}/child', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-operation-summary-format',
message: 'Operation summaries must be in Title Case, must not end with a period and must not use CommonMark.',
path: ['paths', '/resource/{id}/child/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ testRule('xgen-IPA-117-get-operation-summary-starts-with', [
code: 'xgen-IPA-117-get-operation-summary-starts-with',
message: 'Operation summary must start with the word "Return".',
path: ['paths', '/resource/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-get-operation-summary-starts-with',
message: 'Operation summary must start with the word "Return".',
path: ['paths', '/resource', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-get-operation-summary-starts-with',
message: 'Operation summary must start with the word "Return".',
path: ['paths', '/resource/{id}/child', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@ testRule('xgen-IPA-117-operation-summary-single-item-wording', [
code: 'xgen-IPA-117-operation-summary-single-item-wording',
message: 'Operation summary referring to a single item must use "one" instead of "provided".',
path: ['paths', '/resource1/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-operation-summary-single-item-wording',
message: 'Operation summary referring to a single item must use "one" instead of "specified".',
path: ['paths', '/resource2/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-operation-summary-single-item-wording',
message: 'Operation summary referring to a single item must use "one" instead of "a".',
path: ['paths', '/resource3/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-operation-summary-single-item-wording',
message: 'Operation summary referring to a single item must use "one" instead of "a".',
path: ['paths', '/resource4/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-operation-summary-single-item-wording',
message: 'Operation summary referring to a single item must use "one" instead of "provided".',
path: ['paths', '/resource4/{id}', 'get'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ testRule('xgen-IPA-117-update-operation-summary-starts-with', [
code: 'xgen-IPA-117-update-operation-summary-starts-with',
message: 'Operation summary must start with the word "Update".',
path: ['paths', '/resource', 'patch'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-update-operation-summary-starts-with',
message: 'Operation summary must start with the word "Update".',
path: ['paths', '/projects/{id}/users', 'put'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ testRule('xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf', [
code: 'xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf',
message: "Each discriminator property must be accompanied by a 'oneOf', 'anyOf' or 'allOf' property.",
path: ['components', 'schemas', 'Schema'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf',
message: "Each discriminator property must be accompanied by a 'oneOf', 'anyOf' or 'allOf' property.",
path: ['components', 'schemas', 'NestedSchema', 'properties', 'name'],
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
message: "Property 'id' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down Expand Up @@ -96,13 +96,13 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
message: "Property 'id' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
message: "Property 'age' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down Expand Up @@ -239,13 +239,13 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
message: "Property 'name' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchemaInvalid'],
message: "Property 'address' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down Expand Up @@ -388,7 +388,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchema', 'properties', 'name'],
message: "Property 'first' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down Expand Up @@ -539,7 +539,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchema'],
message: "Property 'counter' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down Expand Up @@ -682,7 +682,7 @@ testRule('xgen-IPA-125-oneOf-schema-property-same-type', [
code: 'xgen-IPA-125-oneOf-schema-property-same-type',
path: ['components', 'schemas', 'ExampleSchema'],
message: "Property 'threshold' has different types or schemas in oneOf items.",
severity: DiagnosticSeverity.Warning,
severity: DiagnosticSeverity.Error,
},
],
},
Expand Down
16 changes: 16 additions & 0 deletions tools/spectral/ipa/ipa-spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,19 @@ overrides:
- '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1streamsTransitGatewayInvitations%3Areject/post'
rules:
xgen-IPA-109-valid-operation-id: 'off'
- files: # To be removed in CLOUDP-344586
- '**#/components/schemas/ThirdPartyIntegration'
rules:
xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf: 'off'
- files: # To be removed in CLOUDP-344586
- '**#/paths/~1api~1atlas~1v2~1openapi~1info/get'
- '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1sandboxConfig~1%7BsandboxConfigId%7D/delete'
- '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1sandboxConfig~1%7BsandboxConfigId%7D/get'
- '**#/paths/~1api~1atlas~1v2~1unauth~1openapi~1versions/get'
rules:
xgen-IPA-117-operation-summary-format: 'off'
- files: # To be removed in CLOUDP-344586
- '**#/paths/~1api~1atlas~1v2~1unauth~1openapi~1versions/get'
rules:
xgen-IPA-117-get-operation-summary-starts-with: 'off'
xgen-IPA-117-operation-summary-single-item-wording: 'off'
12 changes: 6 additions & 6 deletions tools/spectral/ipa/rulesets/IPA-117.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ rules:
- `ignoreList`: Words that are allowed to maintain their specific casing (e.g., "API", "AWS", "DNS")
- `grammaticalWords`: Common words that can remain lowercase in titles (e.g., "and", "or", "the")
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-operation-summary-format'
severity: warn
severity: error
given:
- '#OperationObject.summary'
then:
Expand Down Expand Up @@ -295,7 +295,7 @@ rules:
This rule includes a configuration option:
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Return']`
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-get-operation-summary-starts-with'
severity: warn
severity: error
given:
- '$.paths[*][get].summary'
then:
Expand All @@ -314,7 +314,7 @@ rules:
This rule includes a configuration option:
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Update']`
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-update-operation-summary-starts-with'
severity: warn
severity: error
given:
- '$.paths[*][put,patch].summary'
then:
Expand All @@ -333,7 +333,7 @@ rules:
This rule includes a configuration option:
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Create', 'Add']`
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-create-operation-summary-starts-with'
severity: warn
severity: error
given:
- '$.paths[*][post].summary'
then:
Expand All @@ -353,7 +353,7 @@ rules:
This rule includes a configuration option:
- `allowedStartVerbs`: Allow list of verb that the operation summary can start with, defaults to `['Delete', 'Remove']`
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-delete-operation-summary-starts-with'
severity: warn
severity: error
given:
- '$.paths[*][delete].summary'
then:
Expand All @@ -374,7 +374,7 @@ rules:
- `preferredWords`: List of words that the operation summary should use for single items, defaults to `['one']`. Only used for error messages
- `forbiddenWords`: List of words (lowercase) that the operation summary should not use, defaults to `['a', 'specified']`
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-operation-summary-single-item-wording'
severity: warn
severity: error
given:
- '#OperationObject.summary'
then:
Expand Down
4 changes: 2 additions & 2 deletions tools/spectral/ipa/rulesets/IPA-125.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ rules:
- Ensures that if a property is defined in multiple `oneOf` schemas, it must have the same type in each schema (base type or object schema)

message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-125-oneOf-schema-property-same-type'
severity: warn
severity: error
given: '$.components.schemas..oneOf'
then:
function: 'IPA125OneOfSchemaPropertySameType'
Expand All @@ -88,7 +88,7 @@ rules:
##### Implementation details
- Rule checks that a `discriminator` property has a `oneOf`, `anyOf` or `allOf` sibling
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf'
severity: warn
severity: error
given: '$..discriminator'
then:
function: 'IPA125DiscriminatorMustAccompanyOneOfAnyOfAllOf'
16 changes: 8 additions & 8 deletions tools/spectral/ipa/rulesets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ The rule checks for the presence of the `schema`, `examples` or `example` proper

#### xgen-IPA-117-operation-summary-format

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
Operation summaries must use Title Case, must not end with a period and must not use CommonMark.

##### Implementation details
Expand All @@ -896,7 +896,7 @@ This rule includes two configuration options:

#### xgen-IPA-117-get-operation-summary-starts-with

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
In operation summaries, use 'Return' instead of 'Get' or 'List'. For example "Return One Identity Provider".

##### Implementation details
Expand All @@ -908,7 +908,7 @@ This rule includes a configuration option:

#### xgen-IPA-117-update-operation-summary-starts-with

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
In operation summaries, use 'Update' instead of 'Modify' or 'Change'. For example "Update One Identity Provider".

##### Implementation details
Expand All @@ -920,7 +920,7 @@ This rule includes a configuration option:

#### xgen-IPA-117-create-operation-summary-starts-with

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
In operation summaries, use 'Create' when the operation is creating a resource, and use 'Add' when the resource itself isn't being created. For example "Create One Identity Provider" or "Add One MongoDB Cloud User to One Project".

##### Implementation details
Expand All @@ -932,7 +932,7 @@ This rule includes a configuration option:

#### xgen-IPA-117-delete-operation-summary-starts-with

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
In operation summaries, use 'Delete' when the operation is destroying a resource, and use 'Remove' when the resource itself isn't being destroyed. For example "Delete One Identity Provider" or "Remove One MongoDB Cloud User from One Project".

##### Implementation details
Expand All @@ -944,7 +944,7 @@ This rule includes a configuration option:

#### xgen-IPA-117-operation-summary-single-item-wording

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
API Producers must use "One" when referring to a single item instead of "a" or "specified".

##### Implementation details
Expand Down Expand Up @@ -1103,7 +1103,7 @@ object types with clear discriminators.

#### xgen-IPA-125-oneOf-schema-property-same-type

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
If multiple `oneOf` models define a property with the same name, that property **must** have the same base type or schema in each model

##### Implementation details
Expand All @@ -1113,7 +1113,7 @@ Rule checks for the following conditions:

#### xgen-IPA-125-discriminator-must-accompany-oneOf-anyOf-allOf

![warn](https://img.shields.io/badge/warning-yellow)
![error](https://img.shields.io/badge/error-red)
Each discriminator property must be accompanied by a `oneOf`, `anyOf` or `allOf` property

##### Implementation details
Expand Down
Loading