BuilderIO / BuilderIO/builder

GraphQL type error for string with localized value for CMS data

Open
#1,973 0 comments 0 reactions 1 assignee Claimed by @ca136 View on GitHub
Dominant language
TypeScript
Stars
8.8k
Forks
1.2k
Avg merge
1d 6h
Merged PRs (30d)
17

Description

**Describe the bug**
The GraphQL type for a localized value with CMS data needs to be updated. The resolver needs to be updated for this in GraphQL, I believe.

**To Reproduce**
Steps to reproduce the behavior:

1. Create a new CMS data model (we'll call it `navbarSection`) with a `text` field type that is localized (we'll call it `name`).
2. Create a new entry for the CMS data model
3. Go to https://builder.io/graphql-explorer
4. Do the following query:

```gql
query {
navbarSection {
data {
name
}
}
}
```

**The error**

It gives back the following error:

```gql
{
"errors": [
{
"message": "String cannot represent value: { @type: \"@builder.io/core:LocalizedValue\", Default: \"About Us\" }"
}
]
}
```

Also, here's the data:

```gql
"data": {
"navbarSection": [
{
"data": {
name: null
}
}
]
}
```

This works perfectly fine with the REST API, which gives back:

```json
"data": {
"@type": "@builder.io/core:LocalizedValue"
"Default": "About Us"
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.