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

Import spec v0.4 and add support for v0.4 Context #83

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

afrittoli
Copy link
Contributor

Add the spec-v0.4 submodule

Add the new version of the spec and begin to address the various
issues encountered with mulitple versions.

In this commit, move all the schema definitions across specs
into a single schemas.go in the api package, and adapt the existing
events template to benefit from that.

The same DB of schema files is used by the generator to load all
schemas in the beginning and resolve references through a custom
resolver.

Move the example and factory tests into the spec specific
packages. The conformance tests do not pass yet as a few extra
fields need to be set which is not possible yet because changes to
the context (including links) have not been processed yet.

Support for v04 Context

Add a new context type for new fields in the context introduced
in v0.4. Create new interfaces to match the new fields as well
and update the templates to use the new context and implement
the new interfaces when the spec version is not 0.3.x.

Add a new version of the test type that is used to test the
generator code so that we can test generating for the new version.

Updated the logic to generate the schema in a golang file to
use it as a local schema database for the jsonschema library
to validate documents. The schemas are precompiled at init
time now, which simplifies the logic downstream in the code.

Add the new version of the spec and begin to address the various
issues encountered with mulitple versions.

In this commit, move all the schema definitions across specs
into a single schemas.go in the api package, and adapt the existing
events template to benefit from that.

The same DB of schema files is used by the generator to load all
schemas in the beginning and resolve references through a custom
resolver.

Move the example and factory tests into the spec specific
packages. The conformance tests do not pass yet as a few extra
fields need to be set which is not possible yet because changes to
the context (including links) have not been processed yet.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@afrittoli
Copy link
Contributor Author

TODO: need to check is the README is up to date with the latest code sample

@afrittoli afrittoli force-pushed the add_v0_4_submodule branch 2 times, most recently from 9d000e0 to 4c908bb Compare June 13, 2024 13:02
@afrittoli afrittoli changed the title Add v0 4 submodule Import spec v0.4 and add support for v0.4 Context Jun 13, 2024
@afrittoli afrittoli force-pushed the add_v0_4_submodule branch 11 times, most recently from 9cf5c58 to cbe8b1f Compare June 14, 2024 11:09
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 78.69742% with 942 lines in your changes missing coverage. Please review.

Project coverage is 78.35%. Comparing base (f8b8b91) to head (46f90ea).

Current head 46f90ea differs from pull request most recent head 53dc41a

Please upload reports for the commit 53dc41a to get more accurate results.

Files Patch % Lines
pkg/api/types.go 58.97% 27 Missing and 5 partials ⚠️
pkg/api/zz_testcaserunfinished_0_2_0.go 73.62% 22 Missing and 2 partials ⚠️
pkg/api/zz_testcaserunqueued_0_2_0.go 77.01% 18 Missing and 2 partials ⚠️
pkg/api/zz_testcaserunstarted_0_2_0.go 77.01% 18 Missing and 2 partials ⚠️
pkg/api/zz_testoutputpublished_0_2_0.go 77.01% 18 Missing and 2 partials ⚠️
pkg/api/zz_artifactdeleted_0_1_0.go 77.77% 16 Missing and 2 partials ⚠️
pkg/api/zz_artifactdownloaded_0_1_0.go 77.77% 16 Missing and 2 partials ⚠️
pkg/api/zz_artifactpackaged_0_2_0.go 78.31% 16 Missing and 2 partials ⚠️
pkg/api/zz_artifactpublished_0_2_0.go 78.31% 16 Missing and 2 partials ⚠️
pkg/api/zz_artifactsigned_0_2_0.go 77.77% 16 Missing and 2 partials ⚠️
... and 82 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
- Coverage   79.94%   78.35%   -1.59%     
==========================================
  Files          48      100      +52     
  Lines        3291     7688    +4397     
==========================================
+ Hits         2631     6024    +3393     
- Misses        552     1444     +892     
- Partials      108      220     +112     

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

@afrittoli afrittoli force-pushed the add_v0_4_submodule branch 5 times, most recently from d068184 to 9925424 Compare June 21, 2024 12:32
Add a new context type for new fields in the context introduced
in v0.4. Create new interfaces to match the new fields as well
and update the templates to use the new context and implement
the new interfaces when the spec version is not 0.3.x.

Add a new version of the test type that is used to test the
generator code so that we can test generating for the new version.

Updated the logic to generate the schema in a golang file to
use it as a local schema database for the jsonschema library
to validate documents. The schemas are precompiled at init
time now, which simplifies the logic downstream in the code.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@afrittoli afrittoli added this pull request to the merge queue Jun 24, 2024
Merged via the queue into cdevents:main with commit 9ac1c56 Jun 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant