Skip to content

Commit af457e4

Browse files
authored
Merge pull request #17 from istreamlabs/linter-body
fix: removed rule that requires body
2 parents 6a1c5e1 + 99b7d6d commit af457e4

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

fixtures/lint/image-pass.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: 1.0.0
4+
title: API Fixture
5+
description: API fixture description
6+
license:
7+
name: Apache2
8+
contact:
9+
10+
servers:
11+
- url: https://api.example.com/v1
12+
tags:
13+
- name: Test
14+
description: Test tag
15+
paths:
16+
/tests:
17+
get:
18+
summary: Test operation
19+
description: Test operation description
20+
operationId: test
21+
tags:
22+
- Test
23+
responses:
24+
"200":
25+
description: Response description

isp-rules.yaml

+12-9
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,16 @@ rules:
120120
then:
121121
field: content
122122
function: falsy
123-
require-body:
124-
severity: error
125-
description: 200 response must have a body. Use 201/204 otherwise.
126-
given: $..responses.200
127-
then:
128-
field: content
129-
function: truthy
123+
# requiring a body fails for image/json and cannot because because of a spectral
124+
# bug that prevents image/jpeg with type:"string" from parsing.
125+
# TODO: Readd this if spectral ever fixes that bug.
126+
# require-body:
127+
# severity: error
128+
# description: 200 response must have a body. Use 201/204 otherwise.
129+
# given: $..responses.200
130+
# then:
131+
# field: content
132+
# function: truthy
130133
delete-response:
131134
severity: error
132135
description: Delete should return an HTTP 204
@@ -154,10 +157,10 @@ rules:
154157
then:
155158
function: pattern
156159
functionOptions:
157-
match: '/^([A-Z][a-z0-9]-)*([A-Z][a-z0-9])+/'
160+
match: "/^([A-Z][a-z0-9]-)*([A-Z][a-z0-9])+/"
158161
params-lower-snake-case:
159162
severity: error
160-
message: '`{{value}}` must follow `snake` notation'
163+
message: "`{{value}}` must follow `snake` notation"
161164
given: "$..parameters[?(@.in == 'query' || @ == 'path')].name"
162165
then:
163166
function: casing

0 commit comments

Comments
 (0)