Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.7.latest] Fix ensuring we produce valid jsonschema artifacts for manifest, catalog, sources, and run-results #9229

Merged
merged 5 commits into from
Dec 7, 2023

Conversation

QMalcolm
Copy link
Contributor

@QMalcolm QMalcolm commented Dec 6, 2023

resolves #8991

This is a manual backport of #9155 to 1.7.latest.

This is a manual backport because some commits needed to be excluded as they have no relevance to 1.7.latest. Additionally some new commits needed to be added specifically for 1.7.latest

Included commits from #9155 via cherry-pick

Excluded commits

Newly added commits

Passing `all_refs=True` makes it so that Everything is a ref, even
the top level schema. In jsonschema land, this essentially makes the
produced artifact not a full schema, but a fractal object to be included
in a schema. Thus when `$id` is passed in, jsonschema tools blow up
because `$id` is for identifying a schema, which we explicitly weren't
creating. The alternative was to drop the inclusion of `$id`. Howver, we're
intending to create a schema, and having an `$id` is recommended best
practice. Additionally since we were intending to create a schema,
not a fractal, it seemed best to create to full schema.
Previously were were implicitly using the `DRAFT_2020_12` dialect through
mashumaro. It felt wise to begin explicitly specifying this. First, it
is closest in available mashumaro provided dialects to what we produced
pre 1.7. Secondly, if mashumaro changes its default for whatever reason
(say a new dialect is added, and mashumaro moves to that), we don't want
to automatically inherit that.
In jsonschema's documentation they state
> It's not always easy to tell which draft a JSON Schema is using.
> You can use the $schema keyword to declare which version of the JSON Schema specification the schema is written to.
> It's generally good practice to include it, though it is not required.

and

> For brevity, the $schema keyword isn't included in most of the examples in this book, but it should always be used in the real world.

Basically, to know how to parse a schema, it's important to include what
schema dialect is being used for the schema specification. The change in
this commit ensures we include that information.
… process

Specifically we regenerated
* catalog v1
* manifest v11
* run-results v5
* sources v3
using the command `scripts/collect-artifact-schema.py --path schemas`
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fc2d16f) 86.65% compared to head (0d5fc3a) 86.64%.

Additional details and impacted files
@@              Coverage Diff               @@
##           1.7.latest    #9229      +/-   ##
==============================================
- Coverage       86.65%   86.64%   -0.02%     
==============================================
  Files             179      179              
  Lines           26574    26575       +1     
==============================================
- Hits            23028    23025       -3     
- Misses           3546     3550       +4     
Flag Coverage Δ
integration 83.51% <100.00%> (-0.03%) ⬇️
unit 64.97% <50.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@QMalcolm QMalcolm merged commit 0ef8638 into 1.7.latest Dec 7, 2023
62 checks passed
@QMalcolm QMalcolm deleted the backport-9155-to-1.7.latest-manual branch December 7, 2023 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants