Here's a code example to reproduce the issue:
public static void main(String[] args) throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final SchemaValidatorsConfig schemaValidatorsConfig = new SchemaValidatorsConfig();
schemaValidatorsConfig.setPathType(PathType.JSON_PATH);
/*
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"properties": {
"\"": {
"type": "boolean"
}
}
}
*/
final JsonSchema schema = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V201909)
.getSchema(mapper.readTree("{\n" +
" \"$schema\": \"https://json-schema.org/draft/2019-09/schema\",\n" +
" \"type\": \"object\",\n" +
" \"properties\": {\n" +
" \"\\\"\": {\n" +
" \"type\": \"boolean\"\n" +
" }\n" +
" }\n" +
"}"), schemaValidatorsConfig);
// {"\"": 1}
final Set<ValidationMessage> validationMessages = schema.validate(mapper.readTree("{\"\\\"\": 1}"));
for (ValidationMessage validationMessage : validationMessages) {
// Prints $["""]
System.out.println(validationMessage.getPath());
}
}
If the field name has " (and potentially other special characters), the JSON Path generated is invalid.
Here's a code example to reproduce the issue:
If the field name has
"(and potentially other special characters), the JSON Path generated is invalid.