Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escapes are missing in JSON Schema patterns #485

Closed
mristin opened this issue May 8, 2024 · 0 comments · Fixed by #487
Closed

Escapes are missing in JSON Schema patterns #485

mristin opened this issue May 8, 2024 · 0 comments · Fixed by #487

Comments

@mristin
Copy link
Contributor

mristin commented May 8, 2024

For some of the literals, the backslashes are missing in JSON schema.

Example diff:

-                  "pattern": "^([\\t\\n\\r -\ud7ff\ue000-\ufffd]|\\ud800[\\udc00-\\udfff]|[\\ud801-\\udbfe][\\udc00-\\udfff]|\\udbff[\\udc00-\\udfff])*$"
+                  "pattern": "^([\\t\\n\\r-\\ud7ff\\ue000-\\ufffd]|\\ud800[\\udc00-\\udfff]|[\\ud801-\\udbfe][\\udc00-\\udfff]|\\udbff[\\udc00-\\udfff])*$"

Originally discovered in: admin-shell-io/aas-specs#426

@mristin mristin changed the title Escapes are missing in JSON patterns Escapes are missing in JSON Schema patterns May 8, 2024
mristin added a commit that referenced this issue May 8, 2024
The escaping logic for patterns in JSON schema got convoluted, and we
introduced inadvertently inconsistencies in the formatting. Namely,
we first *unescaped* all the characters before passing them into
the parser for regular expressions. This unescaped characters later
propagated and mixed with *escaped* characters when the expression was
transpiled for UTF-16.

To solve this mess, we remove the unescaping step at the beginning and
test more thoroughly to specify & observe the expected behavior.

Fixes #485.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant