chainloop
chainloop copied to clipboard
Change initialization of schema validators
Some of the Chainloop crafters use a JSON schema approach for validation, meaning that incoming evidence is validated against a specified schema. Currently, the schemas are loaded in an init function, which loads all schemas registered by the CLI into memory.
At the moment, this approach loads the schemas for every single command, regardless of whether it's for attestation or not. As the CLI grows, this could become a memory issue.
The goal of this task is to refactor the initialization of the JSON schemas so that they are only loaded when needed.
As reference, the package can be found here: https://github.com/chainloop-dev/chainloop/blob/main/internal/schemavalidators/schemavalidators.go