I want to create a type that represents this dictionary
{
"13fc71ee-e676-4e5d-a561-a20af5bcbaaf": "123",
"8d742ecf-6ae9-4408-a5a0-b1110f9b5365": "fdsafdsa",
"literal": {
"any": "dict",
},
}
This is the closest type I can come up with:
Dict[UUID | Literal["literal"], str | dict]
The main issue with the above type signature is that the following dictionary would be allowed:
{
"8d742ecf-6ae9-4408-a5a0-b1110f9b5365": {
"dictionary": 321,
},
"literal": "some string",
}
Is there a way to annotate a dictionary with a type that can either be a UUID key for a string value or a string literal for a dict value?