Skip to content

Commit cc33223

Browse files
committed
Swagger: Default response's key is now 200.
While the spec does not seem to dictate this, most of the examples seem to have HTTP status codes as the keys. This patch replaces the text 'default' with value of '200'.
1 parent 26727f7 commit cc33223

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

examples/examplepb/echo_service.swagger.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"description": "The message posted as the id parameter will also be\nreturned.",
2929
"operationId": "Echo",
3030
"responses": {
31-
"default": {
31+
"200": {
3232
"description": "Description",
3333
"schema": {
3434
"$ref": "#/definitions/examplepbSimpleMessage"
@@ -58,7 +58,7 @@
5858
"summary": "EchoBody method receives a simple message and returns it.",
5959
"operationId": "EchoBody",
6060
"responses": {
61-
"default": {
61+
"200": {
6262
"description": "Description",
6363
"schema": {
6464
"$ref": "#/definitions/examplepbSimpleMessage"

examples/examplepb/streamless_everything.swagger.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"get": {
2020
"operationId": "List",
2121
"responses": {
22-
"default": {
22+
"200": {
2323
"description": "Description",
2424
"schema": {
2525
"$ref": "#/definitions/examplepbABitOfEverything"
@@ -33,7 +33,7 @@
3333
"post": {
3434
"operationId": "CreateBody",
3535
"responses": {
36-
"default": {
36+
"200": {
3737
"description": "Description",
3838
"schema": {
3939
"$ref": "#/definitions/examplepbABitOfEverything"
@@ -59,7 +59,7 @@
5959
"post": {
6060
"operationId": "BulkCreate",
6161
"responses": {
62-
"default": {
62+
"200": {
6363
"description": "Description",
6464
"schema": {
6565
"$ref": "#/definitions/examplepbEmptyMessage"
@@ -85,7 +85,7 @@
8585
"post": {
8686
"operationId": "BulkEcho",
8787
"responses": {
88-
"default": {
88+
"200": {
8989
"description": "Description",
9090
"schema": {
9191
"$ref": "#/definitions/subStringMessage"
@@ -111,7 +111,7 @@
111111
"get": {
112112
"operationId": "Echo",
113113
"responses": {
114-
"default": {
114+
"200": {
115115
"description": "Description",
116116
"schema": {
117117
"$ref": "#/definitions/subStringMessage"
@@ -136,7 +136,7 @@
136136
"post": {
137137
"operationId": "Create",
138138
"responses": {
139-
"default": {
139+
"200": {
140140
"description": "Description",
141141
"schema": {
142142
"$ref": "#/definitions/examplepbABitOfEverything"
@@ -252,7 +252,7 @@
252252
"get": {
253253
"operationId": "Lookup",
254254
"responses": {
255-
"default": {
255+
"200": {
256256
"description": "Description",
257257
"schema": {
258258
"$ref": "#/definitions/examplepbABitOfEverything"
@@ -275,7 +275,7 @@
275275
"delete": {
276276
"operationId": "Delete",
277277
"responses": {
278-
"default": {
278+
"200": {
279279
"description": "Description",
280280
"schema": {
281281
"$ref": "#/definitions/examplepbEmptyMessage"
@@ -298,7 +298,7 @@
298298
"put": {
299299
"operationId": "Update",
300300
"responses": {
301-
"default": {
301+
"200": {
302302
"description": "Description",
303303
"schema": {
304304
"$ref": "#/definitions/examplepbEmptyMessage"

protoc-gen-swagger/genswagger/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re
456456
OperationId: fmt.Sprintf("%s", meth.GetName()),
457457
Parameters: parameters,
458458
Responses: swaggerResponsesObject{
459-
"default": swaggerResponseObject{
459+
"200": swaggerResponseObject{
460460
Description: "Description",
461461
Schema: swaggerSchemaObject{
462462
Ref: fmt.Sprintf("#/definitions/%s", fullyQualifiedNameToSwaggerName(meth.ResponseType.FQMN(), reg)),

0 commit comments

Comments
 (0)