Skip to content

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

@Drammy

Description

@Drammy

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions