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

Add a new dialect= argument to st.from_regex() #4089

Open
Zac-HD opened this issue Aug 22, 2024 · 0 comments
Open

Add a new dialect= argument to st.from_regex() #4089

Zac-HD opened this issue Aug 22, 2024 · 0 comments
Labels
enhancement it's not broken, but we want it to be better interop how to play nicely with other packages

Comments

@Zac-HD
Copy link
Member

Zac-HD commented Aug 22, 2024

Some time ago, we added a private helper (#3196) in order to support the jsonschema semantics of $.

I think it's worth making a public API for this, along with considerably stricter validation - i.e. ensure that if we disallow trailing newline for $, we also enforce that you're using only the recommended subset of regex syntax which is (with that constraint) identical between Python and Javascript.

(cc @Stranger6667 - if we make validation stricter, will that break you? I guess we could do a jsonschema-python-no-validation dialect if necessary, practicality beats purity...)

Interface: add a new keyword-only argument, from_regex(..., dialect: Literal["python", "jsonschema"] = "python"). Obviously this makes it easy - at the interface level, anyway - to support additional dialects in future, if e.g. we can convert them using something like qntm/greenery.

@Zac-HD Zac-HD added enhancement it's not broken, but we want it to be better interop how to play nicely with other packages labels Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement it's not broken, but we want it to be better interop how to play nicely with other packages
Projects
None yet
Development

No branches or pull requests

1 participant