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

Add release schema validation #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add release schema validation #27

wants to merge 1 commit into from

Conversation

theory
Copy link
Member

@theory theory commented Sep 16, 2024

Rewrite bulid.rs to simply write each schema file on a single line instead of building up a merge structure. This allows each schema to be fetched from the compiler, rather than just distribution.schema.json. It's simpler, too.

Then update the compiler package to load each line into the compiler. This requires splitting the compiled-in schema_v1 and schema_v2 strings into lines, but it works just fine.

Add a new method to the valid package, validate_release, that validates a META.json file that includes release metadata. Since the functionality is identical to the existing validate method, aside from the schema name, refactor it into the new validate_schema method, now simply dispatched by both validate and validate_release.

Expand the corpus test to test both validate and validate_release by applying a patch containing valid release metadata. While there, add tests for the return values, to ensure that the correct verision is always returned from both methods.

Finally, eliminate some redundant tests and test the string values of errors, then add tests for validation failures for both validate and validate_release.

Rewrite `bulid.rs` to simply write each schema file on a single line
instead of building up a merge structure. This allows each schema to be
fetched from the compiler, rather than just `distribution.schema.json`.
It's simpler, too.

Then update the `compiler` package to load each line into the compiler.
This requires splitting the compiled-in `schema_v1` and `schema_v2`
strings into lines, but it works just fine.

Add a new method to the `valid` package, `validate_release`, that
validates a `META.json` file that includes release metadata. Since the
functionality is identical to the existing `validate` method, aside from
the schema name, refactor it into the new `validate_schema` method, now
simply dispatched by both `validate` and `validate_release`.

Expand the corpus test to test both `validate` and `validate_release` by
applying a patch containing valid release metadata. While there, add
tests for the return values, to ensure that the correct verision is
always returned from both methods.

Finally, eliminate some redundant tests and test the string values of
errors, then add tests for validation failures for both `validate` and
`validate_release`.
@theory theory self-assigned this Sep 16, 2024
@theory theory linked an issue Sep 16, 2024 that may be closed by this pull request
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f1650e5) to head (426128a).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #27   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          886       887    +1     
=========================================
+ Hits           886       887    +1     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Release metadata in pgxn_spec
1 participant