core icon indicating copy to clipboard operation
core copied to clipboard

[DEFECT] GraphQL: Block Editor Contentlets Return Only Identifier and LanguageId

Open rjvelazco opened this issue 1 year ago • 5 comments

Problem Statement

There is a discrepancy between the Page API and the GraphQL endpoint when retrieving pages with Block Editor fields:

  1. Page API returns full contentlet data inside Block Editor blocks (title, images, contentType, fields, etc.).
  2. GraphQL only returns identifier and languageId for contentlets inside Block Editor blocks.

This discrepancy prevents the frontend SDKs (@dotcms/react and @dotcms/angular) from rendering custom blocks properly, since they depend on the full contentlet data being returned.

Steps to Reproduce

  1. Create a content type with a Block Editor field.
  2. Add a contentlet (e.g., Product) inside a Block Editor field.
  3. Request the page via Page API → note full contentlet data is returned.
  4. Request the same page via GraphQL → only identifier and languageId are returned.

Example Responses

Page API Response (correct/expected):

{
  "type": "dotContent",
  "attrs": {
    "data": {
      "identifier": "adf567f9-f8a9-487e-b942-6bc083f677db",
      "languageId": 1,
      "title": "Patagonia Boys' Baggies 5\" Shorts",
      "contentType": "Product",
      "image": "http://demo.dotcms.com/dA/adf567f9f8/shorts-blue.jpeg?language_id=1",
      "description": "<p>The Patagonia Boys' Baggies™ 5\" Shorts...</p>",
      "productNumber": "9133062261900",
      "retailPrice": "39.00"
    }
  }
}

GraphQL Response (incomplete):

{
  "type": "dotContent",
  "attrs": {
    "data": {
      "identifier": "adf567f9-f8a9-487e-b942-6bc083f677db",
      "languageId": 1
    }
  }
}

Video

https://github.com/user-attachments/assets/c6fc10d2-5eda-4f8c-85b4-36fc48e5cc6c

Inline Editing Contentlets are Blank (Headless)

https://github.com/user-attachments/assets/010f83c5-684e-4653-bc74-a21367da8394

Acceptance Criteria

  • [ ] GraphQL returns full contentlet data inside Block Editor blocks, matching Page API.
  • [ ] Ensure consistency between Page API and GraphQL for Block Editor responses.
  • [ ] Add tests for Block Editor fields with nested contentlets in GraphQL.

dotCMS Version

main/trunk

Severity

High - Major functionality broken

rjvelazco avatar Sep 19 '25 17:09 rjvelazco

PRs linked to this issue

github-actions[bot] avatar Nov 27 '25 10:11 github-actions[bot]

QA Notes:

You can use this GraphQL query to ask for a blog in this case french-polynesia and checkout that now the Contentlets contain all their properties as happens in the REST API.

GraphQL query:

fragment DotCMSPage on DotPage {
  # Basic page metadata
  publishDate
  type
  path
  
  # URL content mapping
  urlContentMap {
    _map
  }
}

query PageContent {
  page: page(url: "blog/post/french-polynesia-everything-you-need-to-know"){
    ...DotCMSPage
  }
}

Steps:

  1. In dotCMS admin panel go to Dev Tools > GraphQL, and use the GraphQL query above to retrieve the french-polynesia blog.
  2. In the response, search for the word dotContent these are the Contentlets being used in the Block Content.
  3. Check that now the Contentlets are full hydrated (contain all the Contenlet information).

dario-daza avatar Nov 28 '25 16:11 dario-daza

Passed QA

  • dotCMS Docker Image: [dotcms/dotcms:trunk_5891eea]

Video

https://github.com/user-attachments/assets/c73236de-5613-40dd-8b98-16f63a443ff0

rjvelazco avatar Dec 01 '25 16:12 rjvelazco

Team Note

We’re experiencing an issue with dotContent inside tables, and it also occurs in the Page API. There’s already a ticket tracking this: #33120

rjvelazco avatar Dec 01 '25 16:12 rjvelazco

Edge Case

I found an edge case where the dotContent array is returning only the identifier and languageId. This only happens on URL Content Maps for a property post-fixed with _raw.

I’m not aware of any client using this property, and I’m not sure why it exists—especially since we’re supposed to serve Block Editor content as JSON.

Video

https://github.com/user-attachments/assets/0e970d99-fd24-4345-b801-5910afe95760

cc: @fmontes @nollymar

rjvelazco avatar Dec 01 '25 16:12 rjvelazco