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

Make the default regex mode use regress for JS-flavor regex format validation #302

Closed
sirosen opened this issue Aug 15, 2023 · 4 comments
Closed

Comments

@sirosen
Copy link
Member

sirosen commented Aug 15, 2023

There's a python package for the regress crate (see: python-jsonschema/jsonschema#1142 (comment)).

It should be pretty easy to pull this in and use it to replace the default regex format check.
We can then expose many modes with something like --regex-format [default|regress|python|disabled] and drop the gated regex check that exists today. (Where default and regress are the same?)

There's other CLI option refactoring to do around the format controls, so this might dovetail with that.

@Julian
Copy link
Member

Julian commented Aug 15, 2023

(I would maybe name the regress one js or ecma or ecmascript or javascript or whatever personally, so users don't need to even know what the heck regress is, but that's probably the easy part!)

@sirosen
Copy link
Member Author

sirosen commented Aug 18, 2023

I have to stash my work on this for now, but I'll be keeping an eye on regress in order to pick this back up when I can. There's a bug in regress which is causing issues with the named capture groups used in the renovate schema.

I took a quick crack at a PR for this: ridiculousfish/regress#67

I think that fix is right; if it or an alternative fix gets merged, I can try to put in a PR to prep a release of crate-py/regress, and hopefully this all flows forwards nicely.

@sirosen
Copy link
Member Author

sirosen commented Aug 24, 2023

My PR was merged just under a week ago, but I'm not sure what the regress crate release cycle looks like.
At the risk of nagging, I've filed a follow-up to ask for a release and provide some context: ridiculousfish/regress#68

@sirosen
Copy link
Member Author

sirosen commented Aug 25, 2023

This is now in main and I'll be releasing it shortly -- partly to kick the tires on some new publishing workflows.

Because we might have a way for pattern and patternProperties to use an alternate regex implementation someday, I took a moment to restructure this to a RegexImplementation class.

It's still very much wired up to format checking, but it should be easy to move elsewhere and grow it as new features become available.

@sirosen sirosen closed this as completed Aug 25, 2023
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

No branches or pull requests

2 participants