Skip to content

plugin.api.validate: add RegexSchema #4709

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

Merged

Conversation

bastimeyer
Copy link
Member

Follow-up of #4691 / #4708

As mentioned in #4702 (comment), non-optional regexes currently don't raise useful error messages when a simple re.Pattern or validate.transform(re.Pattern.search) validation is made. The RegexSchema raises a ValidationError with a proper error message if the return value is None. See the added tests.

validate.regex (RegexSchema) also takes a second parameter which changes the method that's called on the compiled regex pattern. This is useful for calling re.Pattern.findall for example.

@gravyboat gravyboat merged commit cd3645a into streamlink:master Aug 5, 2022
@bastimeyer bastimeyer deleted the plugin/api/validate/regexschema branch August 5, 2022 19:43
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants