Skip to content

Support boolean schemas #35

@jcklie

Description

@jcklie

JSON schema has a niche case where are allowed to just consist of a boolean 1. Therefore, this is a valid schema:

{
    "type": "object",
    "properties": {
        "foo": {
          "type": "array",
    	  "items": true  
        },
        "bar": false
    }
}

I encountered some schemas using this in real life that used this feature and fail parsing with this package. I see two solutions to this problem: extending the union wherever there is a schema used, e.g. turn all Union[Ref, Schema] into Union[Ref, Schema, bool] or make schema itself a union of Schema and Bool and rename the existing schema to something like JsonSchema. I hacked it for myself to use the former solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions