-
Notifications
You must be signed in to change notification settings - Fork 282
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
Issue 160 #166
Conversation
…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.
// this.formatValidators = new HashMap<>(specVersion.defaultFormatValidators()); | ||
} | ||
|
||
private Optional<SpecificationVersion> specVersionInMetaSchema() { |
There was a problem hiding this comment.
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)); | ||
} |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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.
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). |
No description provided.