Schema
schema:
type: object
properties:
name:
type: string
comment:
type: string
default: ""
required:
- name
Generated as:
type AddItemJSONBody struct {
Name string `json:"name"`
Comment *string `json:"comment,omitempty"`
}
But it would be useful to be (without a pointer):
type AddItemJSONBody struct {
Name string `json:"name"`
Comment string `json:"comment,omitempty"`
}
within json.unmarshal empty comment should be assigned to default value.
PS pointer values must be checked for nil and that is an additional pain.