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

[Feature Request] Allow custom localization in validate function #253

Open
shaoerkuai opened this issue Jul 5, 2024 · 0 comments
Open

Comments

@shaoerkuai
Copy link

shaoerkuai commented Jul 5, 2024

Is your feature request related to a problem? Please describe your use case.
I'm developing a open api application, and the validation error message should shown in user interface.

I suggest that We could modify the error message as I could

Describe the solution you'd like

Like this:

@validate(query=MyCustomQueryParams,message_writer=MyCustomWriter)
async def query_demo(request):
    return text("test")

async def MyCustomWriter (error_model):
   return 'extract the error detail from error_model and custom message to the user'

Additional context
error_model should be a list-dict, which contains the all encountered error

  1. the parameter name
  2. the error value
  3. the error type (wrong value type, missing required field,etc)
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

1 participant