nytimes / openapi2proto

A tool for generating Protobuf v3 schemas and gRPC service definitions from OpenAPI specifications
Apache License 2.0
961 stars 98 forks source link

Maximum and Minimum are omitted if set to zero #124

Open alexis-miakouikila opened 4 years ago

alexis-miakouikila commented 4 years ago

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.