We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ChatGPT suggested that this was valid -- it looks wonderful:
from voluptuous import Schema, Required, All, Length, Switch, Invalid # Define the schema with Switch schema = Schema({ 'issuetype': str, Switch('issuetype', { 'Feature Request': Schema({ Required('feature_details'): All(str, Length(min=10)), }), 'Bug': Schema({ Required('bug_report'): All(str, Length(min=5)), }), }), })
The text was updated successfully, but these errors were encountered:
It's also invalid Python. Classic ChatGPT.
Sorry, something went wrong.
I haven't tested this, but I think you're looking for something along the lines of
schema = Schema(Any( { 'issuetype': Equal("Feature Request"), 'feature_details": ..., }, { 'issuetype': Equal("Bug"), 'bug_report': ..., }, ))
which imho also looks a lot clearer than what ChatGPT suggested
No branches or pull requests
ChatGPT suggested that this was valid -- it looks wonderful:
The text was updated successfully, but these errors were encountered: