- Issue created by @Giuseppe87
- 🇬🇷Greece dspachos
I cannot reproduce in fresh 9.5.x installation, need some more details about it
GETing a entity\entity list via JSON:API causes an error when the field is an entity reference with only one allowed bundle but has unlimited cardinality.
GET /jsonapi/node/article
The site returns 500 with the error:
"AssertionError: If cardinality is not unlimited, the number of given resources must not exceed the cardinality of the collection."
Throw by jsonapi/src/JsonApiResource/Data.php
line 61
As far I've seen
jsonapi/src/JsonApiResource/Relationship::createFromEntityReferenceField
may be the culprit on line 123 where
new RelationshipData(ResourceIdentifier::toResourceIdentifiers($field), $resource_field->hasOne() ? 1 : -1),
possibly mixs the allowed types count with the field cardinality.
Active
9.5
Last updated
I cannot reproduce in fresh 9.5.x installation, need some more details about it