emicklei / go-restful-openapi

OpenAPI extension in Go for the go-restful package
MIT License
135 stars 72 forks source link

Issue77 , handle [][]byte #78

Closed emicklei closed 2 years ago

SVilgelm commented 2 years ago

I tested this PR

in case of simple GroupBy [][]string it creates a incorrect swagger but if I use extra type StringArray []string; GroupBy []StringArray then it generates correct swagger and puts the StringArray into definitions

emicklei commented 2 years ago

@SVilgelm thanks for checking. I will revisit the change and add more test cases

SVilgelm commented 2 years ago

May I ask you to merge this PR and bump a new version? It partially fixes my issue and I would be really glad to update my very outdated (v1.1.1) dependency

SVilgelm commented 2 years ago

sorry, seems your patch works fine. I just tested again and no issues

SVilgelm commented 2 years ago

Here is a log:

go run github.com/go-swagger/go-swagger/cmd/swagger validate /var/folders/9r/3x61nl0j7sbb8flp95mx_k400000gn/T/tmp.1aVAEvN0
2021/11/20 21:56:01 
The swagger spec at "/var/folders/9r/3x61nl0j7sbb8flp95mx_k400000gn/T/tmp.1aVAEvN0" showed up some valid but possibly unwanted constructs.
2021/11/20 21:56:01 See warnings below:
...

The swagger spec at "/var/folders/9r/3x61nl0j7sbb8flp95mx_k400000gn/T/tmp.1aVAEvN0" is invalid against swagger specification 2.0.
See errors below:
- some references could not be resolved in spec. First found: object has no key
...
exit 1

after checkout to this branch:

go get github.com/emicklei/go-restful-openapi/v2@issue77
...
go run github.com/go-swagger/go-swagger/cmd/swagger validate /var/folders/9r/3x61nl0j7sbb8flp95mx_k400000gn/T/tmp.GkNv4o4b
2021/11/20 21:57:13 
The swagger spec at "/var/folders/9r/3x61nl0j7sbb8flp95mx_k400000gn/T/tmp.GkNv4o4b" is valid against swagger specification 2.0
2021/11/20 21:57:13 
The swagger spec at "/var/folders/9r/3x61nl0j7sbb8flp95mx_k400000gn/T/tmp.GkNv4o4b" showed up some valid but possibly unwanted constructs.
2021/11/20 21:57:13 See warnings below:
...
+ exit 0

it generate a lot of warnings, but that is another issue, will create a bug report, just need to figure out minimal code to reproduce an issue