go-openapi / spec

openapi specification object model
Apache License 2.0
389 stars 98 forks source link

When the maximum type is float64, using json.Unmarshal(raw, &spec.Swagger{}) will lose precision #201

Open O3cheng opened 1 month ago

O3cheng commented 1 month ago

When the maximum type is float64, using json.Unmarshal(raw, &spec.Swagger{}) will lose precision

definitions:
  TestResponse:
    description: test
    type: object
    properties:
      test_1:
        description: test_1
        type: long
        format: int64
        **maximum: 9223372036854775807**
        minimum: 0

because

type SchemaProps struct {
    Maximum              *float64         `json:"maximum,omitempty"`
}