-
Notifications
You must be signed in to change notification settings - Fork 42
Description
now that we're using
pydanticfor the python data classes, there are some built-in functions available to us like GenerateJsonSchema that we should consider integrating in so that we can ensure our ability to round-trip between the python and javascript usages.
Originally posted by @ahouseholder in #697
This would get us another step closer to unifying the different representations of the SSVC datastructures.
Background
We are currently maintaining two distinct processes for creating SSVC related data objects:
- Python data classes
- manually created JSON Schemas
This leads to situations in which one or the other is either ahead or behind because the process for updating them is not synchronized.
Further, since #674 we have been using Pydantic dataclasses, which have much better built-in support for JSON serialization, deserialization, and schema generation.
The proposal here is that we should leverage the JSON Schema features built into Pydantic to generate the schema files in data/schema. Our current hand-built schemas have some fields that are not natively part of the generated schema, but that all seems to be addressable using features like json_schema_extra and other customization features.
The end result would be that the python dataclasses would be used as the basis for defining the JSON schemas and we could take steps to ensure they're always in sync.