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

Question: Bind server-side validation to ngrx-forms forms #288

Open
Drammy opened this issue Aug 17, 2022 · 0 comments
Open

Question: Bind server-side validation to ngrx-forms forms #288

Drammy opened this issue Aug 17, 2022 · 0 comments

Comments

@Drammy
Copy link

Drammy commented Aug 17, 2022

Our api is written using the servicestack framework and makes of its inbuilt fluentvalidation api - see here.

So if our api receives an invalid request then a series of validation errors are sent in the response, explaining the issues with each field, like so...

{
    "ErrorCode": "GreaterThan",
    "Message": "'Age' must be greater than '0'.",
    "Errors": [
        {
            "ErrorCode": "GreaterThan",
            "FieldName": "Age",
            "Message": "'Age' must be greater than '0'."
        },
        {
            "ErrorCode": "NotEmpty",
            "FieldName": "Company",
            "Message": "'Company' should not be empty."
        }
    ]
}

Is it possible and what is the best way to auto-wire these validation errors sent from the server into our ngrx-forms enabled form state?

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