openapi2proto icon indicating copy to clipboard operation
openapi2proto copied to clipboard

Maximum and Minimum are omitted if set to zero

Open alexis-miakouikila opened this issue 5 years ago • 0 comments

Given a definition of the type:

FinanceConfiguration:
      commission:
        type: number
        format: double
        maximum: 100
        minimum: 0

The value of minimum is lost because it has been set to zero.

I believe the issue comes from: https://github.com/nytimes/openapi2proto/blob/master/openapi/interface.go#L161 where maximum and minimum are omitted if "empty".

EDIT: My bad. I am using a third party that relies on this code to generate JSON schemas. This issue will not affect the creation of proto files. I won't close the ticket yet though as I believe it remains a valid comment.

alexis-miakouikila avatar Jan 09 '20 15:01 alexis-miakouikila