Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1.3 KB

Python.md

File metadata and controls

27 lines (17 loc) · 1.3 KB

Python

There are special use-cases that each language supports; this document pertains to Python models.

Generate Pydantic models

In some cases you might want to use pydantic data validation and settings management using Python type hints for the models.

You can find an example of its use here

Generate models with JSON Serializer and Deserializer methods

Using the preset PYTON_JSON_SERIALIZER, you can generate serializeToJson method to convert model instance to JSON and deserializeFromJson method to convert JSON to model instance.

Limitations

  1. Above preset doesn't unwrap properties of type ConstrainedDictionaryModel with serialilzationType = unwrap
  2. The serialized JSON object will have the same property names as defined in the model object.

Check out this example for a live demonstration.