jsonschema-typed
jsonschema-typed copied to clipboard
Handling patternProperties
Hi, I'd like to use this project to type a schema that makes several uses of patternProperties. I was thinking I could handle them by relaxing the pattern constraint and simply typing objects with patternProperties as dicts from strings to Unions of all the patterned property types. For example, the schema:
{
"type": "object",
"patternProperties": {
"^foo_[a-z]+$": {
"type": "string"
},
"^bar_[a-z]+$": {
"type": "int"
}
}
}
would be typed as Dict[str, Union[str, int]]. Would this be acceptable for you? If so, I can write a PR.
Are you still interested in contributing this @connorworley ? This is a very old issue now.