DPP Schema 0.5.1 proposal fixing constant value requirements #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
Running our 0.5.0 DPP schema validation for the example Digital Product Passport for FoodAgility fails with:
This (draft) PR defines a proposed schema change (for 0.5.1) that require the arrays to contain at least one (or two) specific values, rather than being constant. If there's agreement, we'll request this change in jargon (or better, wait for any other schema changes for the next release, before requesting the change in jargon).
I've included the decoded original example DPP from FoodAgility (decoded-invalid) as well as a slightly modified version (decoded-valid) so that they can both be tested with
yarn run untp test
. The updated version (decode-valid) ensures thatNote: the example DPP includes a context, aatp-dlp-context which appears to define the standard dpp context as well. It should be defining only the additional context for the DigitalLivestockPassport, I assume - I'll investigate that next. In the mean-time, it will be interesting to see if it fails the jsonld validation which @ashleythedeveloper is adding, or whether it will pass because it doesn't change or redefine those context values.
Note 2: The standard JSON-schema error messages used by the lib being used here, for the "contains", is not great. If, for example, the DPP's "type" field doesn't include the "DigitalProductPassport" value, the error is:
which is incorrect (the items in the array aren't const, rather one of them needs to contain the value "DigitalProductPassport" and none do). I'll investigate if this is the lib that we're using or whether it can be improved.
Added tests?
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?
Ref: https://github.com/gs-gs/fa-ag-trace/issues/905