Skip to content
Snippets Groups Projects

Disable cache for field normalizers to avoid regular fields being treated as relationships.

Closes #3499651

When using openapi_jsonapi regular fields are being added to the relationships section in the generated schema.

This seems to be caused by the getSupportedTypes() method indicating that the result of supportsNormalization() can be cached for both the RelationshipFieldDefinitionNormalizer and FieldDefinitionNormalizer classes, however RelationshipFieldDefinitionNormalizer checks the data to see if it is an entity reference, so can't be cached. This results in regular fields being run through RelationshipFieldDefinitionNormalizer.

I've disabled cache for both of these, I don't really understand enough about the serialization logic to know if it's necessary but in my local testing I can see that non relationship fields are showing up in the attributes again correctly.

Merge request reports

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading