This data type:
data Foo
= Bar Foo
| Baz Foo
deriving (Generic, ToJSON, ToSchema)
Produces this JSON:
{
"swagger": "2.0",
"info": {
"version": "",
"title": ""
},
"definitions": {
"Foo": {
"minProperties": 1,
"maxProperties": 1,
"type": "object",
"properties": {
"Baz": {
"$ref": "#/definitions/Foo"
},
"Bar": {
"$ref": "#/definitions/Foo"
}
}
}
},
"paths": {}
}
However, if I attempt to name the field like this:
data Foo
= Bar { _1 :: Foo }
| Baz { _2 :: Foo }
deriving (Generic, ToJSON, ToSchema)
I get:
This data type:
Produces this JSON:
{ "swagger": "2.0", "info": { "version": "", "title": "" }, "definitions": { "Foo": { "minProperties": 1, "maxProperties": 1, "type": "object", "properties": { "Baz": { "$ref": "#/definitions/Foo" }, "Bar": { "$ref": "#/definitions/Foo" } } } }, "paths": {} }However, if I attempt to name the field like this:
I get: