Skip to content

Commit 1ed4716

Browse files
CLOUDP-306573: Dont require gzip to have example
1 parent 9bd1415 commit 1ed4716

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

tools/spectral/ipa/__tests__/IPA117PlaintextResponseMustHaveExample.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ testRule('xgen-IPA-117-plaintext-response-must-have-example', [
3434
},
3535
},
3636
},
37-
// Ignores JSON/YAML
37+
// Ignores JSON/YAML/gzip
3838
'/resourceTwo': {
3939
get: {
4040
responses: {
@@ -46,6 +46,9 @@ testRule('xgen-IPA-117-plaintext-response-must-have-example', [
4646
'application/vnd.atlas.2024-08-05+yaml': {
4747
type: 'string',
4848
},
49+
'application/vnd.atlas.2024-08-05+gzip': {
50+
type: 'binary',
51+
},
4952
},
5053
},
5154
},

tools/spectral/ipa/rulesets/IPA-117.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ rules:
166166
167167
##### Implementation details
168168
- The rule only applies to 2xx responses
169-
- The rule ignores JSON and YAML responses (passed as `allowedTypes`)
169+
- The rule ignores JSON, YAML and GZIP responses (passed as `allowedTypes`)
170170
- The rule checks for the presence of the example property as a sibling to the `schema` property, or inside the `schema` object
171171
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-plaintext-response-must-have-example'
172172
severity: warn
@@ -176,7 +176,7 @@ rules:
176176
field: '@key'
177177
function: 'IPA117PlaintextResponseMustHaveExample'
178178
functionOptions:
179-
allowedTypes: ['json', 'yaml']
179+
allowedTypes: ['json', 'yaml', 'gzip']
180180
xgen-IPA-117-objects-must-be-well-defined:
181181
description: |
182182
Components of type "object" must be well-defined, i.e. have of one of the properties:

tools/spectral/ipa/rulesets/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ For APIs that respond with plain text, for example CSV, API producers must provi
728728

729729
##### Implementation details
730730
- The rule only applies to 2xx responses
731-
- The rule ignores JSON and YAML responses (passed as `allowedTypes`)
731+
- The rule ignores JSON, YAML and GZIP responses (passed as `allowedTypes`)
732732
- The rule checks for the presence of the example property as a sibling to the `schema` property, or inside the `schema` object
733733

734734
#### xgen-IPA-117-objects-must-be-well-defined

0 commit comments

Comments
 (0)