xref: /aosp_15_r20/external/json-schema-validator/doc/metaschema-validation.md (revision 78c4dd6aa35290980cdcd1623a7e337e8d021c7c)
1If you have an use case to validate custom schemas against the one of the JSON schema draft version, here is the code that you can do it.
2
3```
4  public static final Function<ObjectNode, Set<SchemaValidationMessage>> validateAgainstMetaSchema =
5      schema -> {
6        JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V201909);
7         JsonSchema metaSchema = factory.getSchema(getSchemaUri());
8        return metaSchema.validate(schema).stream()
9            .map((validation) -> new SchemaValidationMessage(validation.getMessage()))
10            .collect(Collectors.toSet());
11      };
12
13```
14
15This should now work but does not support all the keywords because the JsonMetaSchema of SpecVersion.VersionFlag.V201909 is lacking these features.
16
17You can fix the issue by resolving the vocabularies to a local resource file and re-do the JsonMetaSchema for 2019 based on that.
18
19
20
21