I'm trying to dynamically build some endpoints starting from an attrs decorated class (similar to a dataclass).
To generate the schema from the class, I use desert; then I pass the schema to use_kwargs.
The problem is desert adds a n item to the fields metadata dictionary using a _DesertSentinel object as key; the FieldConverterMixin.metadata2properties method throws an AttributeError since it expects a string in order to use startswith on it.
I temporarily solved by using str(key) in the two dict comprehension of the method, but I don't know if it's the best solution to this.
I'm trying to dynamically build some endpoints starting from an
attrs
decorated class (similar to adataclass
).To generate the schema from the class, I use
desert
; then I pass the schema touse_kwargs
.The problem is
desert
adds a n item to the fields metadata dictionary using a_DesertSentinel
object as key; theFieldConverterMixin.metadata2properties
method throws an AttributeError since it expects a string in order to usestartswith
on it.I temporarily solved by using
str(key)
in the two dict comprehension of the method, but I don't know if it's the best solution to this.