Skip to content

Unable to create json api resource with attribute name "type" #621

@sunnydesign

Description

@sunnydesign

When I create a resource with attribute name "type" and try to send a POST request with payload:

{
    "data": {
        "type": "files",
        "attributes": {
            "name": "file.pdf",
            "type": "img_product",
            "mime": "pdf",
            "size": 123456
        }
    }
}

I get an error:

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "detail": "The member attributes cannot have a type field.",
            "source": {
                "pointer": "/data/attributes"
            },
            "status": "400",
            "title": "Non-Compliant JSON:API Document"
        }
    ]
}

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