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

Issue 160 #166

Merged
merged 4 commits into from
Apr 17, 2018
Merged

Issue 160 #166

merged 4 commits into from
Apr 17, 2018

Conversation

zgyorffi
Copy link
Contributor

No description provided.

…maLoader.

As specVersion can be given in metaschema there is no point to add defaultFormatValidators at the point when specVersion is set.
That step can be executed at the point when schemaloader is built.
@coveralls
Copy link

coveralls commented Apr 15, 2018

Coverage Status

Coverage decreased (-0.04%) to 92.104% when pulling 731c330 on zgyorffi:issue-160 into b6f9f1e on everit-org:master.

// this.formatValidators = new HashMap<>(specVersion.defaultFormatValidators());
}

private Optional<SpecificationVersion> specVersionInMetaSchema() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be called specVersionInSchema()

Object schemaValue = schemaObj.get("$schema");
if (schemaValue != null) {
specVersion = Optional.of(SpecificationVersion.getByMetaSchemaUrl((String) schemaValue));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The above 4 lines could be simplified to specVersion = Optional.ofNullable(schemaObj.getString("$schema")).map((SpecificationVersion::getByMetaSchemaUrl))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Small modification: schemaObj.get("$schema") instead of getString and a cast to String.

@zgyorffi
Copy link
Contributor Author

The root cause of the problem is that default format validators are set at the point when the specversion is also set explicitly by the builder (draftV6Support,...). If the specversion is defined by $schema the format validators are not set accordingly because it is checked at a later point (in the constructor of SchemaLoader).

@erosb erosb merged commit 4b5c44a into everit-org:master Apr 17, 2018
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.

None yet

3 participants