Here's a contrived example of what I'm trying to do.
class MyModel(BaseModel):
foo: str
bar.baz: str
'bar.baz': str
^ Syntax Error: illegal target for annotation
In my case I need to set/retrieve an attribute like 'bar.baz'. This attribute needs to interface with an external system outside of python so it needs to remain dotted. Is there a way I can achieve this with pydantic and/or dataclasses? The attribute needs to be subscriptable so I want to be able to do something like mymodel['bar.baz'].
Any ideas on how I can possibly achieve this?
Thanks
I tried using a NamedTuple to define bar and even a generic class but can't seem to get around the issue of this being illegal in the world of type annotations.