Skip to content

Invalid relation type that does not exist rejects with incorrect message from spec validation #33

Closed
@lindyhopchris

Description

@lindyhopchris

In a test I sent a to-one relation with the type member set to dance-events, when the relationship expects a products resource. As the id sent with the incorrect type did not exist, I received this error message:

{
    "errors": [
        {
            "detail": "The related resource does not exist.",
            "source": {
                "pointer": "/data/relationships/product"
            },
            "status": "404",
            "title": "Not Found"
        }
    ],
    "jsonapi": {
        "version": "1.0"
    }
}

What I should have actually received was a message saying the the dance-events resource was an invalid resource type for the relationship. The above message implies that the related resource is being tested for existence before being checked for it being the expected type. It would make more sense to check the type first, then check for existence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions