openapi2proto icon indicating copy to clipboard operation
openapi2proto copied to clipboard

Unable to set x-global-options which have a boolean value eg. java_multiple_files: true

Open bob9 opened this issue 6 years ago • 2 comments

Unable to set x-global-options which are booleans like java_multiple_files: true

Error returned is. error: failed to transpile: failed to load OpenAPI spec: failed to decode content: json: cannot unmarshal bool into Go struct field Spec.x-global-options of type string

example from top of swagger yaml package name works fine.

x-global-options:
  java_package: com.mypackagename
  java_multiple_files: true # THIS CAUSES THE ERROR

bob9 avatar Aug 15 '18 04:08 bob9

Hopefully this is just a matter of changing the type of our global options to being an interface{} instead of a string here: https://github.com/NYTimes/openapi2proto/blob/master/openapi/interface.go#L28-L30

jprobinson avatar Aug 22 '18 15:08 jprobinson

We're just outputting a text file, why do we need to use a native boolean type there? This would be different if the tools' aim was to parse and then allow end users to process the data, but we're just producing text.

Documentation can be updated, certainly, but I feel the user should just supply a string there.

lestrrat avatar Nov 13 '18 00:11 lestrrat