You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSON schema regexp's are in the ECMA-262 dialect, but Go's regexp package does not meet this standard (it is to the RE2 standard to keep things O(n)). This means it's not possible to meet the standard for a JSON schema using this package.
A possible solution would be implement an interface for a regexp engine, default to Go's regexp package, and allow the user to pass their own engine in if they need extended capabilities not offered by the default engine. A quick search shows there is at least other Go regexp engine that exists (unfortunately is based on the .NET engine). It's possible one could be created that matches the ECMA-262 dialect.
The text was updated successfully, but these errors were encountered:
Keywords MAY use regular expressions to express constraints, or constrain the instance value to be a regular expression. These regular expressions SHOULD be valid according to the regular expression dialect described in ECMA 262, section 15.10.1.
As it says SHOULD and not MUST it's not required to use ECMA 262 and not having (easy) access to an ECMA 262 implementation is a pretty good reason to deviate. Using the standard library's regex engine is the most sane default in my opinion. Having said that it would be nice to make the regex engine pluggable so someone could use the .NET engine you referenced or maybe even go through more hoops and actually use an ECMA 262 engine via CGO if they really need it.
PRs are welcome and appreciated, otherwise this will have to wait until I find some time to work on this sort of stuff.
JSON schema regexp's are in the ECMA-262 dialect, but Go's
regexp
package does not meet this standard (it is to the RE2 standard to keep things O(n)). This means it's not possible to meet the standard for a JSON schema using this package.A possible solution would be implement an interface for a regexp engine, default to Go's
regexp
package, and allow the user to pass their own engine in if they need extended capabilities not offered by the default engine. A quick search shows there is at least other Go regexp engine that exists (unfortunately is based on the .NET engine). It's possible one could be created that matches the ECMA-262 dialect.The text was updated successfully, but these errors were encountered: