dbt-labs / dbt-jsonschema

Apache License 2.0
109 stars 40 forks source link

Check .yml files against schemas in CI-Workflow #74

Closed MartinKowa closed 1 year ago

MartinKowa commented 1 year ago

Hello!

Goal

We are currently trying to implement a CI-Job which checks our .yml files against the schemas of this repo.

What we tried

Our approach was Pykwalify, it takes in a .yml file (or .json) to check and a .yml file to check against.

Translating the .json schemas to .yml files in a syntax required by Pykwalify did not pose a big challenge except for one thing: image You can not translate the "oneOf" blocks to YAML (or at least do not know of a workaround).

Furthermore, changes to the schemas would require to adjust the .yml files for Pykwalify manually, which we would like to avoid.

Question

Has anyone implemented such a job in their project or has ideas to resolve the just mentioned problems we are facing?

joellabes commented 1 year ago

@MartinKowa have a look at how the CI works for this repo - it uses a different CLI tool to validate that a given yaml file confirms to the provided schema. That's probably the easiest approach for you as well - I'm not familiar with pykwalify sorry!

MartinKowa commented 1 year ago

@joellabes Thanks a lot! That worked for us.