You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this underlying library currently only defines a subset of valid schema properties (see https://github.com/qri-io/jsonschema/blob/master/validate.go#L58-L107) and will fail validation (actually in unmarshal-ing prior to) for properties not in the list and not supplied via a custom validator.
One such property that would trigger this failure is contentEncoding. As an example, the validation then fails with:
Error: could not list bundle instances: error unmarshaling contentEncoding from json: json: cannot unmarshal string into Go value of type jsonschema._schema
There is a library that supports all scheme parameters, including the more recent draft-2020-12 (https://github.com/santhosh-tekuri/jsonschema). This library is easily integrated into cnab-go, I have an almost ready-made solution. But there is a nuance, the library does not return an error if incorrect content Encoding is passed, this will change the behavior, and actually I created a pullRequest (#305) in which I changed the library and corrected the tests for new error texts. I deleted one test, this is due to the behavior that I described above
This project currently uses the qri-io/jsonschema library for parameter validation, as in https://github.com/deislabs/cnab-go/blob/master/bundle/definition/validation.go.
However, this underlying library currently only defines a subset of valid schema properties (see https://github.com/qri-io/jsonschema/blob/master/validate.go#L58-L107) and will fail validation (actually in unmarshal-ing prior to) for properties not in the list and not supplied via a custom validator.
One such property that would trigger this failure is
contentEncoding
. As an example, the validation then fails with:Ways to avoid these validation failures would be:
jsonschema
library before unmarshal-ing/validation. We'd have to do this for any/all missing/desired properties. See fix(bundle/definition): add custom validator for contentEncoding #118 as a first example.The text was updated successfully, but these errors were encountered: