statham-schema
statham-schema copied to clipboard
Access properties from a declared Object
It would be nice to be able to access properties of a model, especially enums.
class MySuperModel(Object):
my_field: str = Property(String(enum=['foo', 'bar', 'baz]), required=True)
possible_fields = MySuperModel.my_field.element.enum
>>> ['foo', 'bar', 'baz']
@arthur-proglove this is possible via:
MySuperModel.properties["my_field"].element.enum
I'll leave this open as a reminder to add an some notes about inspection to the docs.
oh thank you! Didn't notice that one