hyperjump-io / json-schema

JSON Schema Validation, Annotation, and Bundling. Supports Draft 04, 06, 07, 2019-09, 2020-12, OpenAPI 3.0, and OpenAPI 3.1
https://json-schema.hyperjump.io/
MIT License
216 stars 22 forks source link

Regular expression parsing failure #51

Closed mellster2012 closed 6 months ago

mellster2012 commented 6 months ago
"valueDecimal": {
"description": "The actual value to for an initial answer.",
"pattern": "^-?(0|[1-9][0-9]{0,17})(\\.[0-9]{1,17})?([eE][+-]?[0-9]{1,9}})?$",
"type": "number"
}

validate fails with: SyntaxError: Invalid regular expression: /^-?(0|[1-9][0-9]{0,17})(.[0-9]{1,17})?([eE][+-]?[0-9]{1,9}})?$/: Lone quantifier brackets at new RegExp ()

mellster2012 commented 6 months ago

fhir.schema.json

mellster2012 commented 6 months ago

Actually that's a real mistake in their schema, the regexp does have a lone closing bracket at the end - closing.

jdesrosiers commented 6 months ago

Glad you figured it out. I see the FHIR schema is still a disaster zone. The pattern keyword doesn't even apply to numbers, so all they've accomplished is shooting themselves in the foot. The should have used $comment instead.