Open straz opened 3 weeks ago
Additionally, if I create astruct
like this with an enum
field:
type Avatar struct {
Name string `json:"name"`
Type ImageType `json:"type"`
}
the output jsonschema ignores the type, and just uses string
. How do I get it to restrict this to the enum values instead?
{
"Avatar": {
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
}
}
My enum looks like this:
but when I run
jsonschema.ReflectFromType
all I get is thisIt doesn't even contain the name of the enum as the value of
$ref
. I assume that the output I need is something like this, am I right? If so, how do I generate this?