wI2L / fizz

:lemon: Gin wrapper with OpenAPI 3 spec generation
https://pkg.go.dev/github.com/wI2L/fizz
MIT License
214 stars 52 forks source link

pointer, required, not nullable openapi output #107

Closed kelf closed 11 months ago

kelf commented 1 year ago

We need to be able to ingest values like 0. If make the parameter a pointer and tag it required we get the following output

  /v1/foo/{fooId}:
    get:
...
      - name: fooId
        in: path
        required: true
        schema:
          type: string
          nullable: true
...

As you can see, fooId is both nullable and required.

https://pkg.go.dev/github.com/go-playground/validator/v10#hdr-Required states;For slices, maps, pointers, interfaces, channels and functions ensures the value is not nil. For structs ensures value is not the zero value when using WithRequiredStructEnabled.

Any thoughts on how to correct the output so the param is not marked nullable?

kelf commented 11 months ago

Won't do