Open edganiukov opened 4 years ago
I don't think 5xx is a valid status code. You need to provide something like 500 instead.
@wing328 according to the doc it is a valid response status code for openapi3 - https://swagger.io/docs/specification/describing-responses or here http://spec.openapis.org/oas/v3.0.3#patterned-fields-0
Under responses, each response definition starts with a status code, such as 200 or 404. An operation typically returns one successful status code and one or more error statuses. To define a range of response codes, you may use the following range definitions: 1XX, 2XX, 3XX, 4XX, and 5XX.
👌
Would you have time to contribute a fix?
I can show you some good starting points.
the same issue is present when generating any java server version. 4XX and 5XX are valid in openapi 3 but not in java. I typically have to replace all occurence with e.g. 400 or 500. I am running the latest 5 version of the generator.
I've filed #7381 to add wildcardFirstChar
to store the first character of the response code (implicit), e.g. it will store 4
if the response code is 4XX. Then we use wildcardFirstChar
in different generators to better handle implicit response code.
Bug Report Checklist
Description
For response code ranges (e.g. 1XX, 2XX, 5XX) it generate invalid Go code, for example:
openapi-generator version
v4.3.1
OpenAPI declaration file content or url
Command line used for generation
openapi-generator-cli generate --generator-name go \ --input-spec ${OAS_SPEC_FILE} \ --api-package ${GO_API_PACKAGE} --package-name ${GO_PACKAGE} \ --git-host github.com --git-user-id exampleuser --git-repo-id ${GO_ARTIFACT} \ --output "${GO_ARTIFACT}"