Skip to content

Create an Object with fields as arguments #79

@arthur-proglove

Description

@arthur-proglove

It would be nice to be able to instantiate a model with some fields the same way a dataclass can be created and be able to use it to output a JSON dict.

class MySuperModel(Object):
    some_field: str = Property(String(enum=['foo', 'bar', 'baz']), required=True)


s = MySuperModel(some_field='foo')
print(s)

{
    'some_field': 'foo'
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions