I am writing an interface that will be used by two applications. This interface should use some DoSomethingRequest
and DoSomethingResponse
classes for communication.
Is there any library that does some model checking like Django Model
?
I basically want to say something like:
Object A must have a text property of type str (), a number property of type int (), a property of items of type list (). Dry way.
I am looking for something like the following or better:
class MyEmbeddedModelClass(EmbeddedModel): text = TextField(required = True) class MyModel(Model): text = TextField(required = True) number = IntField(default = 0) items = ListField(EmbeddedModel) a = MyModel() a.text = "aaaa" a.number = 1 a.items = [ MyEmbeddedModelClass("bbbb"), MyEmbeddedModelClass("cccc"), MyEmbeddedModelClass("dddd") ] a.validate()
I know that I can write on my own, but I would prefer to use the library if it is available, but I'm a little new to this.
Prody source share