Open AJNOURI opened 6 months ago
Hi Aj,
We will not be converting the schema to JSON schema, since our schema contains some features which are not available in JSON schema. (dynamic_keys, dynamic_valid_values, primary_key, unique_keys to name some).
We have been evaluating Pydantic - including the tool you mention - but we found out that Pydantic V2 is too slow to initialize for our deeply nested schema. We are also evaluating attrs
+cattrs
and native dataclass
, but one common finding is the added runtime penalty of defining these classes (even before initializing them). For Pydantic it would add several seconds per device to the runtime, and for dataclass
it is currently adding 0.5 second per device.
We will continue investigating such options, and once we find an acceptable solution, we will migrate the AVD code accordingly, and expose the classes as part of PyAVD. This will allow the user to input / output using these classes.
If you could share your thoughts on how you would use such Pydantic models, I would appreciate it.
Thank you for your interest.
BR Claus
This issue is stale because it has been open 90 days with no activity. The issue will be reviewed by a maintainer and may be closed
Enhancement summary
The JSON schema used is a custom one, why not using a standard schema version? (https://json-schema.org/specification) It makes it easier to use other standard tools with the schema
Which component of AVD is impacted
eos_validate_state
Use case example
One of the tools I would like to use is "https://github.com/koxudaxi/datamodel-code-generator" to generate Pydantic models. This will open doors to many perspectives.
Describe the solution you would like
Convert the custom schema to the current version is 2020-12!
Describe alternatives you have considered
No response
Additional context
No response
Contributing Guide