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

Allow injecting validation errors #69

Open
4 of 6 tasks
DanielSchaffer opened this issue Feb 15, 2020 · 0 comments
Open
4 of 6 tasks

Allow injecting validation errors #69

DanielSchaffer opened this issue Feb 15, 2020 · 0 comments

Comments

@DanielSchaffer
Copy link
Contributor

DanielSchaffer commented Feb 15, 2020

  • refactor metadata.model.builder to collect all validation errors as a data structure instead of throw an error
  • add single error class containing all errors
  • update ModelBuilder APIs to include overrides:
    • current API signature
    • throwOnValidationError: false in MemberBuilderOptions returns Error instance or model type
    • e.g. constructModel<TModel, TOptions extends NoThrowOnValidationErrorOptions>(type: Constructor<TModel>, source: any, options: TOptions): Error | TModel
  • add @HandleModelErrors() decorator that allows decorated routes to process requests with invalid input data (request body, query param, or path param); inject original source value for each failing provider
  • add @RequestModelErrors() injectable decorator that injects map of errors collected for any injected param
  • throw an error from the decorators if @RequestModelErrors is used without @HandleModelErrors or vice-versa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v1.0.0
  
In progress
Development

No branches or pull requests

1 participant