kin-openapi (through github.com/oapi-codegen/gin-middleware) and oapi-codegen treat nullable fields differently:
- former wants it to be
nullable: true
- while latter enables optional functionality with skipping property name from
required list
in result, the openapi component looks like
components:
schemas:
Filter_Active_Opt:
properties:
filter_active:
type: boolean
nullable: true
the field is generated in following way
FilterActive *bool `"json:"filter_active"`
and generated client panics on nil value
panic: reflect: call of reflect.Value.Interface on zero Value
...
github.com/oapi-codegen/runtime/bindform.go:316
well, since the generated server code works fine with just skipping the property from body, and since there's no common way to encode nil in formdata, I bet this may be skipped in runtime encoder
kin-openapi (through github.com/oapi-codegen/gin-middleware) and oapi-codegen treat nullable fields differently:
nullable: truerequiredlistin result, the openapi component looks like
the field is generated in following way
and generated client panics on nil value
well, since the generated server code works fine with just skipping the property from body, and since there's no common way to encode
nilin formdata, I bet this may be skipped in runtime encoder