jozu-ai/kitops

Generate JSON schema for Kitfile and use it to validate incoming Kitfiles

Closed this issue · 2 comments

Describe the problem you're trying to solve
When a Kitfile does not match the spec (e.g. uses an object instead of a list for datasets), the message displayed is not immediately clear:

❯ kit pack -t test:test .
Failed to pack model kit: yaml: unmarshal errors:
  line 5: cannot unmarshal !!map into []artifact.DataSet

For someone unfamiliar with Go, this might not be clear enough to realize the issue.

In addition, extra fields and typos are silently ignored (e.g. if you misspell a field).

Describe the solution you'd like
We should generate a schema from the Kitfile struct and use it to validate incoming Kitfiles, providing more useful error messages when the Kitfile has errors.

Describe alternatives you've considered
N/A

Additional context
N/A

related to #88

Ah woops, I gotta start searching for existing issues. Sorry.