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

Preload schemas on startup for validation #39

Merged
merged 4 commits into from
Dec 3, 2020
Merged

Conversation

brenetic
Copy link
Contributor

@brenetic brenetic commented Dec 3, 2020

Preload schemas into JSON::Validator

Local referencing seems to be an issue with the json-schema gem. There are a number of issues open:

voxpupuli/json-schema#190
voxpupuli/json-schema#370
voxpupuli/json-schema#411

To get around this we are preloading all the schemas into the JSON::Validator at startup using the _name property as the identifier for each schema. This should allow the JSON::Validator the ability to more easily find the necessary referenced schemas.

Add unit test for MetadataSerialiser

This is a basic schema validation for the attributes that the MetadataSerialiser will be returning when requested.

Also add a fixture for a service. This is only for when creating a service and as such will not have the service_id or created_at as those are set by the metadata api before being returned.

Use larger metadata fixture for integration tests

The integration tests now use the newer service and version fixtures. The version fixture has additional pages and a service id which is more like what the editor will be sending the metadata api.

Bump public suffix to 4.0.6

Local referencing seems to be an issue with the json-schema gem. There
are a number of issues open:

voxpupuli/json-schema#190
voxpupuli/json-schema#370
voxpupuli/json-schema#411

To get around this we are preloading all the schemas into the
JSON::Validator at startup using the _name property as the identifier
for each schema. This should allow the JSON::Validator the ability to
more easily find the necessary referenced schemas.
This is a basic schema validation for the attributes that the
MetadataSerialiser will be returning when requested.

Also add a fixture for a service. This is only for when creating a
service and as such will not have the service_id or created_at as those
are set by the metadata api before being returned.
The integration tests now use the newer service and version fixtures.
The version fixture has additional pages and a service id which is more
like but the editor will be sending the metadata api.
Copy link
Contributor

@tomas-stefano tomas-stefano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

spec/support/schema_matcher.rb Show resolved Hide resolved
Copy link
Contributor

@njseeto njseeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ 💯

@brenetic brenetic merged commit 81a663c into main Dec 3, 2020
@brenetic brenetic deleted the change-schema-references branch December 3, 2020 10:26
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.

3 participants