Skip to content

Field missing in API response for components in related content type #7360

@MatthewSbar

Description

@MatthewSbar

Describe the bug
The bug is described here https://github.com/strapi/strapi/discussions/5769, but that issue was converted to a discussion despite it being a bug which has not been fixed.

Essentially, when getting data for a content type which has a relation to another content type, fields for components in the related content type are not returned in the API response. Fields which aren't nested in components are included.

Steps to reproduce the behavior

  1. Create a content type called Slide
  2. Add a component to Slide called images
  3. Add a field named imageUrl to the images component
  4. Create two slides with different images
  5. Create a content type called Landing Page
  6. Add a repeatable component called slideshow to Landing Page
  7. Add a one-to-one relation to Slides in the slideshow component
  8. Create a landing page
  9. Add both slides to the landing page
  10. Navigate to /landing-pages to fetch the data for landing pages
  11. In the response, the slides are included, but the images component is not included

Expected behavior
In step 11, the images field would be included.

System

Node.js version: 12.14.1
NPM version: 6.13.4
Strapi version: Strapi v3.0.0
Database: Postgres
Operating system: ubuntu 18.04.04 lts

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:strapiSource is core/strapi packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions