nytimes/openapi2proto

Cannot unmarshal bool into Go struct field XXX of type openapi2proto.XXXX

rhzs opened this issue · 1 comments

rhzs commented

Golang version: go version go1.10 darwin/amd64.

Step by step to reproduce:

  1. go get -u github.com/NYTimes/openapi2proto/cmd/openapi2proto
  2. Trying to convert Swagger file from https://github.com/apigee/openbank/blob/master/openapi/accountv1-0.json
  3. openapi2proto -spec accountv1-0.json -options
  4. Failed to convert.
2018/03/02 00:23:30 unable to load spec: unable to parse referenced file: json: cannot unmarshal bool into Go struct field Items.additionalProperties of type openapi2proto.Items

Expectation:
Should not see error and able to convert swagger file.

I don't see it listed as a boolean in the official Open API spec here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

But I do see it is referenced in the swagger documentation: https://swagger.io/specification/

Not sure the use case of having it as a boolean as it seems like just omitting the property is a cleaner solution, but regardless, it seems like an odd but valid option.

If changing additionalProperties to an interface{} is simple, I should have a fix in pretty quickly.