Skip to content

Commit 9d7cf5c

Browse files
committed
Convert response codes in YAML specs to be strings
According to the spec, response codes should be of type string. This is the case in the JSON examples, but not in the YAML ones, causing issues with consumers that are implemented according to spec. Let's fix the examples so they don't set a bad... example.
1 parent d06b83f commit 9d7cf5c

10 files changed

+32
-32
lines changed

examples/v2.0/yaml/api-with-examples.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ paths:
1010
produces:
1111
- application/json
1212
responses:
13-
200:
13+
"200":
1414
description: |-
1515
200 300 response
1616
examples:
@@ -41,7 +41,7 @@ paths:
4141
}
4242
]
4343
}
44-
300:
44+
"300":
4545
description: |-
4646
200 300 response
4747
examples:
@@ -79,7 +79,7 @@ paths:
7979
produces:
8080
- application/json
8181
responses:
82-
200:
82+
"200":
8383
description: |-
8484
200 203 response
8585
examples:
@@ -122,7 +122,7 @@ paths:
122122
]
123123
}
124124
}
125-
203:
125+
"203":
126126
description: |-
127127
200 203 response
128128
examples:

examples/v2.0/yaml/petstore-expanded.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ paths:
4444
type: integer
4545
format: int32
4646
responses:
47-
200:
47+
"200":
4848
description: pet response
4949
schema:
5050
type: array
@@ -65,7 +65,7 @@ paths:
6565
schema:
6666
$ref: '#/definitions/NewPet'
6767
responses:
68-
200:
68+
"200":
6969
description: pet response
7070
schema:
7171
$ref: '#/definitions/Pet'
@@ -85,7 +85,7 @@ paths:
8585
type: integer
8686
format: int64
8787
responses:
88-
200:
88+
"200":
8989
description: pet response
9090
schema:
9191
$ref: '#/definitions/Pet'
@@ -104,7 +104,7 @@ paths:
104104
type: integer
105105
format: int64
106106
responses:
107-
204:
107+
"204":
108108
description: pet deleted
109109
default:
110110
description: unexpected error

examples/v2.0/yaml/petstore-minimal.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
produces:
2525
- "application/json"
2626
responses:
27-
200:
27+
"200":
2828
description: "A list of pets."
2929
schema:
3030
type: "array"

examples/v2.0/yaml/petstore-separate/spec/NewPet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ allOf:
66
properties:
77
description:
88
type: integer
9-
format: int64
9+
format: int64

examples/v2.0/yaml/petstore-separate/spec/parameters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ limitsParam:
1313
description: maximum number of results to return
1414
required: false
1515
type: integer
16-
format: int32
16+
format: int32

examples/v2.0/yaml/petstore-separate/spec/swagger.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ paths:
3232
- $ref: 'parameters.yaml#/tagsParam'
3333
- $ref: 'parameters.yaml#/limitsParam'
3434
responses:
35-
200:
35+
"200":
3636
description: pet response
3737
schema:
3838
type: array
@@ -53,7 +53,7 @@ paths:
5353
schema:
5454
$ref: 'NewPet.yaml'
5555
responses:
56-
200:
56+
"200":
5757
description: pet response
5858
schema:
5959
$ref: 'Pet.yaml'
@@ -73,7 +73,7 @@ paths:
7373
type: integer
7474
format: int64
7575
responses:
76-
200:
76+
"200":
7777
description: pet response
7878
schema:
7979
$ref: 'Pet.yaml'
@@ -92,9 +92,9 @@ paths:
9292
type: integer
9393
format: int64
9494
responses:
95-
204:
95+
"204":
9696
description: pet deleted
9797
default:
9898
description: unexpected error
9999
schema:
100-
$ref: '../common/Error.yaml'
100+
$ref: '../common/Error.yaml'

examples/v2.0/yaml/petstore-simple.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
type: "integer"
4646
format: "int32"
4747
responses:
48-
200:
48+
"200":
4949
description: "pet response"
5050
schema:
5151
type: "array"
@@ -69,7 +69,7 @@
6969
schema:
7070
$ref: "#/definitions/NewPet"
7171
responses:
72-
200:
72+
"200":
7373
description: "pet response"
7474
schema:
7575
$ref: "#/definitions/Pet"
@@ -95,7 +95,7 @@
9595
type: "integer"
9696
format: "int64"
9797
responses:
98-
200:
98+
"200":
9999
description: "pet response"
100100
schema:
101101
$ref: "#/definitions/Pet"
@@ -115,7 +115,7 @@
115115
type: "integer"
116116
format: "int64"
117117
responses:
118-
204:
118+
"204":
119119
description: "pet deleted"
120120
default:
121121
description: "unexpected error"

examples/v2.0/yaml/petstore-with-external-docs.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
type: "integer"
5555
format: "int32"
5656
responses:
57-
200:
57+
"200":
5858
description: "pet response"
5959
schema:
6060
type: "array"
@@ -78,7 +78,7 @@
7878
schema:
7979
$ref: "#/definitions/NewPet"
8080
responses:
81-
200:
81+
"200":
8282
description: "pet response"
8383
schema:
8484
$ref: "#/definitions/Pet"
@@ -104,7 +104,7 @@
104104
type: "integer"
105105
format: "int64"
106106
responses:
107-
200:
107+
"200":
108108
description: "pet response"
109109
schema:
110110
$ref: "#/definitions/Pet"
@@ -124,7 +124,7 @@
124124
type: "integer"
125125
format: "int64"
126126
responses:
127-
204:
127+
"204":
128128
description: "pet deleted"
129129
default:
130130
description: "unexpected error"

examples/v2.0/yaml/petstore.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ paths:
2727
type: integer
2828
format: int32
2929
responses:
30-
200:
30+
"200":
3131
description: An paged array of pets
3232
headers:
3333
x-next:
@@ -45,7 +45,7 @@ paths:
4545
tags:
4646
- pets
4747
responses:
48-
201:
48+
"201":
4949
description: Null response
5050
default:
5151
description: unexpected error
@@ -64,7 +64,7 @@ paths:
6464
description: The id of the pet to retrieve
6565
type: string
6666
responses:
67-
200:
67+
"200":
6868
description: Expected response to a valid request
6969
schema:
7070
$ref: '#/definitions/Pets'

examples/v2.0/yaml/uber.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ paths:
4242
tags:
4343
- Products
4444
responses:
45-
200:
45+
"200":
4646
description: An array of products
4747
schema:
4848
type: array
@@ -84,7 +84,7 @@ paths:
8484
tags:
8585
- Estimates
8686
responses:
87-
200:
87+
"200":
8888
description: An array of price estimates by product
8989
schema:
9090
type: array
@@ -123,7 +123,7 @@ paths:
123123
tags:
124124
- Estimates
125125
responses:
126-
200:
126+
"200":
127127
description: An array of products
128128
schema:
129129
type: array
@@ -140,7 +140,7 @@ paths:
140140
tags:
141141
- User
142142
responses:
143-
200:
143+
"200":
144144
description: Profile information for a user
145145
schema:
146146
$ref: '#/definitions/Profile'
@@ -166,7 +166,7 @@ paths:
166166
tags:
167167
- User
168168
responses:
169-
200:
169+
"200":
170170
description: History information for the given user
171171
schema:
172172
$ref: '#/definitions/Activities'

0 commit comments

Comments
 (0)