huma
huma copied to clipboard
Panic if adding example tag to body field which is a pointer
In order to distinguish between zero value and missing field, pointer is sometimes used in body fields. For example,
type InputBody struct {
Quota *int64 `json:"quota" example:"1611198330"`
}
However, it throws an exception when adding example tag to the pointer field:
panic: unable to generate JSON schema: unable to convert float64 to *int64: schema is invalid
BTW, it works well when example tag is not added.