gnostic icon indicating copy to clipboard operation
gnostic copied to clipboard

When the field type is uint, it is invalid when setting the minimum to 0

Open shuqingzai opened this issue 3 years ago • 1 comments

proro

    uint32 mediNum = 2 [
      (validate.rules).uint32 = {gte: 0, lte: 16777215},

      (openapi.v3.property) = {
        title: "number";
        description: "number";
        type: "integer";
        minimum: 0;
        maximum: 16777215;
      }
    ];

yaml

    mediNum:
        title: number
        maximum: 1.6777215e+07
        type: integer
        description: number
        format: uint32

shuqingzai avatar Dec 17 '22 01:12 shuqingzai

My guess here is that since minimum is 0, which is the default for uint in protocol buffers, it isn't getting serialized out to the yaml.

Probably need some way to tell the difference between an unset default 0, and a purposely set default 0, and write it out when it is purposely set.

@timburks what do you think? Maybe mark the fields as optional or something?

jeffsawatzky avatar Apr 06 '23 23:04 jeffsawatzky