Closed fberrez closed 5 years ago
404
is the ASCII code for the Unicode Latin Small Letter Gamma rune (see full table here). The issue you are encountering isn't due to Fizz, but rather the conversion of the http.StatusNotFound
constant to string
in your code.
I have reproduced the behaviour here: https://play.golang.org/p/dkTngug0pyT
I recommend using a string directly as an argument of fizz.Response
, or convert it beforehand with strconv.Atoi
.
You can find here the spec about responses and the field pattern. I think it could be useful to add an advanced check during the spec generation to ensure that the given code is valid per the spec.
Last thing, give a look at the function fizz.Errors
that returns all non-critical errors that occurs during the generation of the spec. You would have catched the error returned by setOperationResponse
when it convert the code to an integer with strconv.Atoi
.
Feel free to reopen if need be.
I really appreciate your documented answer. Thank you, I learnt something new today! 👍
go version go1.11.1 darwin/amd64
Description
What ?
The OpenAPI generation generates a bad syntax for a path which have an additionnal response with the status code
not found (404)
. Instead of having404
in the OpenAPI JSON structure, we have aƔ
. See below.How ?
Here is my code for a router:
Here is the OpenAPI generation for this path:
You can see
"Ɣ"
instead of"404"
.