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

Repro for issue 1224: Validate #1225

Closed
wants to merge 2 commits into from
Closed

Repro for issue 1224: Validate #1225

wants to merge 2 commits into from

Conversation

bkoelman
Copy link
Member

@bkoelman bkoelman commented Dec 8, 2022

Trying to reproduce the issue reported in #1224.

Response returned:

{
    "links": {
        "self": "/api/v1/postIts/835405"
    },
    "errors": [
        {
            "id": "9ee70a39-f314-4a7f-a7cf-6fb8e06e6680",
            "status": "422",
            "title": "Input validation failed.",
            "detail": "Error",
            "source": {
                "pointer": "/data/attributes/message"
            }
        }
    ]
}

image

@bkoelman
Copy link
Member Author

bkoelman commented Dec 8, 2022

After adding [ApiController] and adjustments, sending the next request body:

{
    "data": {
        "type": "postIts",
        "id": "835405",
        "attributes": {
            "actif": false,
            "message": "HELLO POST IT",
            "otherMessage": "HELLO POST IT",
            "refOperateur": "1"
        }
    }
}

Returns:

{
    "links": {
        "self": "/api/v1/postIts/835405"
    },
    "errors": [
        {
            "id": "ee191de9-9d51-412d-a9e1-3620d1776122",
            "links": {
                "about": "https://tools.ietf.org/html/rfc7231#section-6.5.1"
            },
            "status": "400",
            "title": "One or more validation errors occurred.",
            "detail": "Error",
            "meta": {
                "stackTrace": [
                    "JsonApiDotNetCore.Errors.UnsuccessfulActionResultException: Exception of type 'JsonApiDotNetCore.Errors.UnsuccessfulActionResultException' was thrown.",
                    "   at string JsonApiDotNetCore.Serialization.Response.JsonApiWriter.GetResponseBody(object model, HttpContext httpContext) in D:/Bart/Source/Repos/JsonApiDotNetCore/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs:line 84"
                ]
            }
        },
        {
            "id": "30faa614-ea53-4795-b7ec-1dbac7f04d82",
            "links": {
                "about": "https://tools.ietf.org/html/rfc7231#section-6.5.1"
            },
            "status": "400",
            "title": "One or more validation errors occurred.",
            "detail": "The field OtherMessage must be a string or array type with a maximum length of '2'.",
            "meta": {
                "stackTrace": [
                    "JsonApiDotNetCore.Errors.UnsuccessfulActionResultException: Exception of type 'JsonApiDotNetCore.Errors.UnsuccessfulActionResultException' was thrown.",
                    "   at string JsonApiDotNetCore.Serialization.Response.JsonApiWriter.GetResponseBody(object model, HttpContext httpContext) in D:/Bart/Source/Repos/JsonApiDotNetCore/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs:line 84"
                ]
            }
        }
    ]
}

@bkoelman bkoelman closed this Dec 14, 2022
@bkoelman bkoelman deleted the repro-for-issue-1224 branch December 14, 2022 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant