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

Relationship exists in Resource object error #6

Closed
designvoid opened this issue Feb 9, 2024 · 1 comment
Closed

Relationship exists in Resource object error #6

designvoid opened this issue Feb 9, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@designvoid
Copy link

The response from the API has attributes that are the same name as an included resource.

Detailed description

The response from the API has attributes that are the same name as an included resource:

            "type": "property",
            "id": "fc7ecf3f-0f3a-4e8c-920e-7e1db01cac8b",
            "attributes": {
                "sales": true,

Where sales can also be an optional include.

This causes an error stating:

Relationship "xxx" cannot be set because it already exists in Resource object.

My question is if this is a known issue, something that can be wroked around or just going to be a problem for me using this package?

@JaZo JaZo self-assigned this Feb 10, 2024
@JaZo
Copy link
Member

JaZo commented Feb 10, 2024

Unfortunately this is by design. We follow the specification and that disallows attributes and relationships with the same name.

Fields for a resource object MUST share a common namespace with each other and with type and id. In other words, a resource can not have an attribute and relationship with the same name, nor can it have an attribute or relationship named type or id.

See: https://jsonapi.org/format/#document-resource-object-fields

@JaZo JaZo added the question Further information is requested label Feb 10, 2024
@JaZo JaZo closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants