diff --git a/operation.go b/operation.go index 20e7cefc5..29e6bf429 100644 --- a/operation.go +++ b/operation.go @@ -1130,7 +1130,7 @@ func (operation *Operation) ParseEmptyResponseOnly(commentLine string) error { return fmt.Errorf("can not parse response comment \"%s\"", commentLine) } - operation.AddResponse(code, spec.NewResponse()) + operation.AddResponse(code, spec.NewResponse().WithDescription(http.StatusText(code))) } return nil diff --git a/operation_test.go b/operation_test.go index d8089f0a2..d10f5da07 100644 --- a/operation_test.go +++ b/operation_test.go @@ -1071,7 +1071,7 @@ func TestParseEmptyResponseOnlyCode(t *testing.T) { expected := `{ "responses": { "200": { - "description": "" + "description": "OK" } } }` @@ -1091,10 +1091,10 @@ func TestParseEmptyResponseOnlyCodes(t *testing.T) { expected := `{ "responses": { "200": { - "description": "" + "description": "OK" }, "201": { - "description": "" + "description": "Created" }, "default": { "description": "" diff --git a/parser_test.go b/parser_test.go index 87c9099ab..1a8b5b06f 100644 --- a/parser_test.go +++ b/parser_test.go @@ -3105,7 +3105,7 @@ func Fun() { ], "responses": { "200": { - "description": "" + "description": "OK" } } } @@ -3162,7 +3162,7 @@ func Fun() { ], "responses": { "200": { - "description": "" + "description": "OK" } } } @@ -3326,7 +3326,7 @@ func TestParseJSONFieldString(t *testing.T) { } }, "500": { - "description": "" + "description": "Internal Server Error" } } }