balena-io-modules / jellyschema

JellySchema - data validation, UI form generation
Apache License 2.0
4 stars 2 forks source link

Emit proper `anyOf` for compound types #77

Closed cyplo closed 5 years ago

cyplo commented 5 years ago

As per discussion with Lucian - decided to emit

"properties": {
        "age": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "integer"
                }
            ]
        }
}

instead of

 "anyOf": [
        {
            "properties": {
                "age": {
                    "type": "string"
                }
            }
        },
        {
            "properties": {
                "age": {
                    "type": "integer"
                }
            }
        }
]

Both are valid JSONSchema but the first one allows for less misinterpretation on the user side and was also easier to emit.

See #62 and #15 for context.

cyplo commented 5 years ago

Closing as per our chat and the decision to remove support for compound types completely as this is confusing.