Open itaranto opened 6 months ago
yaml file is converted from json and will lose orders as a result of using map[string]interface{} during json decoding.
if we marshal spec.Swagger directly into yaml, the generated file may be huge with many useless lines, because spec.Swagger
haven't set omitempty
for yaml encoding.
go-openapi/spec has not considered to marshal into yaml, I think, refer to https://github.com/go-openapi/spec/blob/master/swagger.go
yaml file is converted from json and will lose orders as a result of using map[string]interface{} during json decoding. if we marshal spec.Swagger directly into yaml, the generated file may be huge with many useless lines, because
spec.Swagger
haven't setomitempty
for yaml encoding.go-openapi/spec has not considered to marshal into yaml, I think, refer to https://github.com/go-openapi/spec/blob/master/swagger.go
OK, so I guess this could be improved by implementing a YAML marshaller in go-openapi
.
As I imagine, that's no small task. I'll consider looking at the code and see if I can do a PR there.
Describe the bug
swag init
generates theswagger.yaml
file in reverse order. Theswagger.json
file of the same spec is in correct order.To Reproduce
Steps to reproduce the behavior:
swagger.yaml
andswagger.json
filesExpected behavior Both
swagger.yaml
andswagger.json
files are in correct order.Screenshots
swagger.yaml
file in reverse order butswagger.json
it's not.For example, for the YAML file the description is last, for the JSON file the description is first and so on.
Your swag version e.g. 1.16.3
Your go version e.g. 1.21.6
Desktop (please complete the following information):
Additional context Add any other context about the problem here.