networknt / json-schema-validator

A fast Java JSON schema validator that supports draft V4, V6, V7, V2019-09 and V2020-12
Apache License 2.0
807 stars 320 forks source link

V1.4.0 ValidatorTypeCode.getKeywords(SpecVersion.VersionFlag.V201909) has missing keywords #1031

Closed spaukner closed 2 months ago

spaukner commented 2 months ago

before the refactorings for 1.4.0 version the ValidatorTypeCode.getKeywords(SpecVersion.VersionFlag.V201909) had a size of 44 entries, now it only has 5 entries. for eg ValidatorTypeCode.ALL_OF has a version code of VersionCode.MaxV7 but should still be valid at V201909

there is also a issue on the docs https://github.com/networknt/json-schema-validator/blob/master/doc/validators.md#custom-validators where it states .formats(BUILTIN_FORMATS) but it should now be .formats(Formats.DEFAULT)

justin-tay commented 2 months ago

1.4.0 adds support for vocabularies. As such the majority of the keywords for 2019-09 and 2012-12 have been moved into their respective vocabularies.

If want you want is to modify an existing meta schema

JsonMetaSchema metaSchema = JsonMetaSchema.builder(JsonMetaSchema.getV201909()).keyword(new IsMandatoryKeyword())).build();
spaukner commented 2 months ago

thx for your advice - that works now.

could be closed for me