Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -8,6 +8,7 @@ testRule('xgen-IPA-117-description-ends-with-period', [
components: {
schemas: {
Schema: {
description: 'Description.',
properties: {
id: {
description: 'Description.',
Expand All @@ -25,6 +26,7 @@ testRule('xgen-IPA-117-description-ends-with-period', [
components: {
schemas: {
Schema: {
description: 'Description',
properties: {
noPeriod: {
description: 'Description',
Expand All @@ -35,6 +37,12 @@ testRule('xgen-IPA-117-description-ends-with-period', [
},
},
errors: [
{
code: 'xgen-IPA-117-description-ends-with-period',
message: 'Descriptions must end with a full stop(.).',
path: ['components', 'schemas', 'Schema'],
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-description-ends-with-period',
message: 'Descriptions must end with a full stop(.).',
Expand All @@ -49,6 +57,7 @@ testRule('xgen-IPA-117-description-ends-with-period', [
components: {
schemas: {
Schema: {
description: 'Description\n| Table |',
properties: {
noPeriod: {
description: 'Description\n| Table |',
Expand All @@ -66,6 +75,10 @@ testRule('xgen-IPA-117-description-ends-with-period', [
components: {
schemas: {
Schema: {
description: 'Description',
'x-xgen-IPA-exception': {
'xgen-IPA-117-description-ends-with-period': 'reason',
},
properties: {
noPeriod: {
description: 'Description',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ testRule('xgen-IPA-117-description-must-not-use-html', [
document: {
components: {
schemas: {
description: 'Must be < 250 characters.',
Schema: {
properties: {
valid: {
Expand All @@ -31,6 +32,7 @@ testRule('xgen-IPA-117-description-must-not-use-html', [
components: {
schemas: {
Schema: {
description: '<a>Description</a>',
properties: {
html: {
description: '<a>Description</a>',
Expand All @@ -50,6 +52,12 @@ testRule('xgen-IPA-117-description-must-not-use-html', [
},
},
errors: [
{
code: 'xgen-IPA-117-description-must-not-use-html',
message: 'Descriptions must not use raw HTML.',
path: ['components', 'schemas', 'Schema'],
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-description-must-not-use-html',
message: 'Descriptions must not use raw HTML.',
Expand Down Expand Up @@ -83,6 +91,10 @@ testRule('xgen-IPA-117-description-must-not-use-html', [
components: {
schemas: {
Schema: {
description: '<a>Description</a>',
'x-xgen-IPA-exception': {
'xgen-IPA-117-description-must-not-use-html': 'reason',
},
properties: {
html: {
description: '<a>Description</a>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ testRule('xgen-IPA-117-description-should-not-use-inline-links', [
components: {
schemas: {
Schema: {
description: 'Description.',
properties: {
valid: {
description: 'Description.',
Expand Down Expand Up @@ -37,6 +38,7 @@ testRule('xgen-IPA-117-description-should-not-use-inline-links', [
components: {
schemas: {
Schema: {
description: 'Hello [world](https://www.mongodb.com).',
properties: {
invalidLink: {
description: 'Hello [world](https://www.mongodb.com).',
Expand All @@ -50,6 +52,13 @@ testRule('xgen-IPA-117-description-should-not-use-inline-links', [
},
},
errors: [
{
code: 'xgen-IPA-117-description-should-not-use-inline-links',
message:
'Descriptions should not include inline links. Use the externalDocumentation property instead, see https://swagger.io/specification/#external-documentation-object.',
path: ['components', 'schemas', 'Schema'],
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-description-should-not-use-inline-links',
message:
Expand All @@ -72,6 +81,10 @@ testRule('xgen-IPA-117-description-should-not-use-inline-links', [
components: {
schemas: {
Schema: {
description: 'Hello [world](https://www.mongodb.com).',
'x-xgen-IPA-exception': {
'xgen-IPA-117-description-should-not-use-inline-links': 'reason',
},
properties: {
invalidLink: {
description: 'Hello [world](https://www.mongodb.com).',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ testRule('xgen-IPA-117-description-should-not-use-inline-tables', [
components: {
schemas: {
Schema: {
description: 'Schema for request | response',
properties: {
valid: {
description: 'Description.',
Expand All @@ -28,6 +29,7 @@ testRule('xgen-IPA-117-description-should-not-use-inline-tables', [
components: {
schemas: {
Schema: {
description: '|Title|\n|-----|\n|Description|',
properties: {
table: {
description: '|Title|\n|-----|\n|Description|',
Expand All @@ -50,6 +52,13 @@ testRule('xgen-IPA-117-description-should-not-use-inline-tables', [
},
},
errors: [
{
code: 'xgen-IPA-117-description-should-not-use-inline-tables',
message:
'Descriptions should not include inline tables. Tables may not work well with all tools, in particular generated client code.',
path: ['components', 'schemas', 'Schema'],
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-description-should-not-use-inline-tables',
message:
Expand Down Expand Up @@ -93,6 +102,10 @@ testRule('xgen-IPA-117-description-should-not-use-inline-tables', [
components: {
schemas: {
Schema: {
description: '|Title|\n|-----|\n|Description|',
'x-xgen-IPA-exception': {
'xgen-IPA-117-description-should-not-use-inline-tables': 'reason',
},
properties: {
table: {
description: '|Title|\n|-----|\n|Description|',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ testRule('xgen-IPA-117-description-starts-with-uppercase', [
components: {
schemas: {
Schema: {
description: 'Description',
properties: {
id: {
description: 'Description',
Expand All @@ -25,6 +26,7 @@ testRule('xgen-IPA-117-description-starts-with-uppercase', [
components: {
schemas: {
Schema: {
description: 'description',
properties: {
noUpperCase: {
description: 'description',
Expand All @@ -35,6 +37,12 @@ testRule('xgen-IPA-117-description-starts-with-uppercase', [
},
},
errors: [
{
code: 'xgen-IPA-117-description-starts-with-uppercase',
message: 'Descriptions must start with Uppercase.',
path: ['components', 'schemas', 'Schema'],
severity: DiagnosticSeverity.Error,
},
{
code: 'xgen-IPA-117-description-starts-with-uppercase',
message: 'Descriptions must start with Uppercase.',
Expand All @@ -49,6 +57,10 @@ testRule('xgen-IPA-117-description-starts-with-uppercase', [
components: {
schemas: {
Schema: {
description: 'description',
'x-xgen-IPA-exception': {
'xgen-IPA-117-description-starts-with-uppercase': 'reason',
},
properties: {
noUpperCase: {
description: 'description',
Expand Down
35 changes: 32 additions & 3 deletions tools/spectral/ipa/ipa-spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,45 @@ overrides:
- '**#/components/schemas/DataLakeHTTPStore/allOf/1/properties/urls' # external field, to be covered by CLOUDP-293178
rules:
xgen-IPA-124-array-max-items: 'off'
- files: # To be removed in CLOUDP-337392
- files: # To be removed in CLOUDP-338425
Copy link
Collaborator Author

@lovisaberggren lovisaberggren Aug 15, 2025

Choose a reason for hiding this comment

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

Note: Created new ticket for these after next oas release

- '**#/paths/~1api~1atlas~1v2~1orgs~1%7BorgId%7D~1groups'
- '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D'
rules:
xgen-IPA-104-get-method-response-has-no-input-fields: 'off'
- files: # To be removed in CLOUDP-337392
- files: # To be removed in CLOUDP-338425
- '**#/paths/~1api~1atlas~1v2~1groups~1%7BgroupId%7D~1pushBasedLogExport'
rules:
xgen-IPA-106-create-method-request-has-no-readonly-fields: 'off'
- files: # To be removed in CLOUDP-337392
- files: # To be removed in CLOUDP-338425
- '**#/components/schemas/AWSHardwareSpec20240805/properties/ebsVolumeType'
rules:
xgen-IPA-112-field-names-are-camel-case: 'off'
- files: # To be removed in CLOUDP-338425
- '**#/components/schemas/AtlasResourcePolicyAuditForNdsGroup'
- '**#/components/schemas/AtlasResourcePolicyAuditForOrg'
- '**#/components/schemas/ChartsAudit'
- '**#/components/schemas/DefaultLimit'
- '**#/components/schemas/ObjectCreated'
- '**#/components/schemas/PinnedNamespaces'
- '**#/components/schemas/RequestAccepted'
- '**#/components/schemas/StreamsStartStreamProcessorWith'
- '**#/components/schemas/TextSearchIndexCreateRequest'
- '**#/components/schemas/VectorSearchIndexCreateRequest'
- '**#/components/schemas/AtlasTenantClusterUpgradeRequest20240805'
- '**#/components/schemas/StreamsModifyStreamProcessor'
- '**#/components/schemas/EventTypeDetails'
- '**#/components/schemas/LegacyAtlasTenantClusterUpgradeRequest'
rules:
xgen-IPA-117-description-ends-with-period: 'off'
- files: # To be removed in CLOUDP-338425
- '**#/components/schemas/CustomCriteriaView'
- '**#/components/schemas/ExtraRetentionSetting'
- '**#/components/schemas/MetricDataPoint'
- '**#/components/schemas/MetricDataPoint_Atlas'
- '**#/components/schemas/DateCriteriaView'
rules:
xgen-IPA-117-description-starts-with-uppercase: 'off'
- files: # To be removed in CLOUDP-338425
- '**#/components/schemas/NewRelic'
rules:
xgen-IPA-117-description-must-not-use-html: 'off'
15 changes: 14 additions & 1 deletion tools/spectral/ipa/rulesets/IPA-117.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ functions:
aliases:
OperationObject:
- '$.paths[*][get,put,post,delete,options,head,patch,trace]'
RequiredDescribableObjects:
- '$.tags[*]'
- '#OperationObject'
- '#OperationObject.parameters[*]'
- '#OperationObject..content..properties[*]'
- '$.components.schemas..properties[*]'
- '$.components.parameters[*]'
DescribableObjects:
- '$.tags[*]'
- '#OperationObject'
- '#OperationObject.parameters[*]'
- '#OperationObject..content..properties[*]'
- '$.components.schemas..properties[*]'
- '$.components.parameters[*]'
- '$.components.schemas[*]'

rules:
xgen-IPA-117-description:
Expand All @@ -41,7 +49,7 @@ rules:
severity: error
given:
- '$.info'
- '#DescribableObjects'
- '#RequiredDescribableObjects'
then:
function: 'IPA117HasDescription'
xgen-IPA-117-description-starts-with-uppercase:
Expand All @@ -56,6 +64,7 @@ rules:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-description-starts-with-uppercase'
severity: error
given:
Expand All @@ -75,6 +84,7 @@ rules:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule ignores descriptions that end with `|`, i.e. inline markdown tables
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-description-ends-with-period'
severity: error
Expand All @@ -95,6 +105,7 @@ rules:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule validates that the description content does not include opening and/or closing HTML tags.
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-description-must-not-use-html'
severity: error
Expand All @@ -115,6 +126,7 @@ rules:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule validates that the description content does not include inline markdown tables.
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-description-should-not-use-inline-tables'
severity: error
Expand All @@ -134,6 +146,7 @@ rules:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule validates that the description content does not include inline markdown links. The rule ignores HTML `<a>` links - this is covered by `xgen-IPA-117-description-must-not-use-html`.
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-description-should-not-use-inline-links'
severity: error
Expand Down
5 changes: 5 additions & 0 deletions tools/spectral/ipa/rulesets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ Rule checks the format of the description property in the following components:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas

#### xgen-IPA-117-description-ends-with-period

Expand All @@ -755,6 +756,7 @@ Rule checks the format of the description property in the following components:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule ignores descriptions that end with `|`, i.e. inline markdown tables

#### xgen-IPA-117-description-must-not-use-html
Expand All @@ -770,6 +772,7 @@ Rule checks the format of the descriptions for components:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule validates that the description content does not include opening and/or closing HTML tags.

#### xgen-IPA-117-description-should-not-use-inline-tables
Expand All @@ -785,6 +788,7 @@ Rule checks the format of the descriptions for components:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule validates that the description content does not include inline markdown tables.

#### xgen-IPA-117-description-should-not-use-inline-links
Expand All @@ -799,6 +803,7 @@ Rule checks the format of the descriptions for components:
- Inline schema properties for operation object requests and responses
- Parameter objects (in operations and components)
- Schema properties
- Schemas
The rule validates that the description content does not include inline markdown links. The rule ignores HTML `<a>` links - this is covered by `xgen-IPA-117-description-must-not-use-html`.

#### xgen-IPA-117-plaintext-response-must-have-example
Expand Down
Loading