java-json-tools / json-schema-validator

A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order
http://json-schema-validator.herokuapp.com/
Other
1.63k stars 400 forks source link

BUG: ECMA262 valid pattern throws an exception #413

Open jeremyfiel opened 6 months ago

jeremyfiel commented 6 months ago

I have a valid ECMA262 pattern defined but the application is throwing an exception.

com.github.fge.jsonschema.core.exceptions.InvalidSchemaException: fatal: invalid JSON Schema, cannot continue     
    Syntax errors:
[{
    "level": "error",
    "message": "string \"((?<OrgOID>[^,. ]+)\\s*\\.\\s*(?<AOID>[^,. ]+))(?:\\s*,\\s*)?\" is not a valid ECMA 262 regular expression",
    "domain": "syntax",
    "schema": {
        "loadingURI": "#",
        "pointer": ""
    },
    "keyword": "pattern",
    "value": "((?<OrgOID>[^,. ]+)\\s*\\.\\s*(?<AOID>[^,. ]+))(?:\\s*,\\s*)?"
}]
level: "fatal"
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "string",
  "pattern": "((?<OrgOID>[^,. ]+)\\s*\\.\\s*(?<AOID>[^,. ]+))(?:\\s*,\\s*)?"
}

valid instance

FFFF.12645,AAAA.6456

I'm guessing it has something to do with the escaping pattern but that is valid per the specification and I can't modify it from my JSON Schema schema otherwise it will break other tooling.