Define constraints for different JSON schema models in a list
I have some JSON with a structure similar to what is shown below. The threshold
list represents objects where the type can be "type": "upper_limit"
or "type": "range"
. Notice the "target"
value should be an integer or float depending on the type of the object.
Export Pydantic model classes (not instances) to JSON
I understand that Pydantic can export models to JSON, see ref. But in practice, this means instances of a model: