Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Discrepancy for JSON type between GraphiQL and API #3306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FelixMalfait opened this issue Jan 8, 2024 · 4 comments
Closed

Discrepancy for JSON type between GraphiQL and API #3306

FelixMalfait opened this issue Jan 8, 2024 · 4 comments
Assignees

Comments

@FelixMalfait
Copy link
Member

FelixMalfait commented Jan 8, 2024

GraphiQL (whether the docs version or the one on api.twenty.com) expects ECMA-404 formatting for JSON fields (i.e. a stringified JSON). But what the API expect is actually normal JSON (non sitringified).

In the screen below, the request was underlined as if it would fail but it turns out this request worked perfectly:

Screenshot 2024-01-08 at 14 03 06

Query:

mutation CreateOneFieldMetadataItem($input: CreateOneFieldMetadataInput!) {
  createOneField(input: $input) {
    id
    type
    name
    label
    description
    icon
    isCustom
    isActive
    isNullable
    createdAt
    updatedAt
  }
}

Variables:

{
  "input": {
    "field": {
      "description": null,
      "icon": "IconBuildingFactory2",
      "label": "Industry",
      "name": "industry",
      "options": [
                    {
                        "color": "gray",
                        "label": "📊 Accounting",
                        "position": 0,
                        "value": "ACCOUNTING"
                    },
                    {
                        "color": "gray",
                        "label": "✈️ Airlines/Aviation",
                        "position": 1,
                        "value": "AIRLINES_AVIATION"
                    }
      ],
      "objectMetadataId": "3e028c57-0d5b-4467-975b-ad08cc00c966",
      "type": "SELECT"
    }
  }
}

@FelixMalfait
Copy link
Member Author

FelixMalfait commented Jan 9, 2024

graphql/graphiql#168

@martmull any idea for a quickfix on this since you've touched the console? Or does that seem like a more complex issue?

@FelixMalfait
Copy link
Member Author

@gitstart-twenty could you please look into this and see if you find a quick fix? Thanks

Copy link
Contributor

gitstart-app bot commented May 15, 2024

Here is the GitStart Ticket for this issue: https://clients.gitstart.com/twenty/5449/tickets/TWNTY-3306

@twentyhq twentyhq deleted a comment from charlesBochet Jun 13, 2024
@gitstart-twenty
Copy link
Contributor

Hey @FelixMalfait

It appears that GraphiQL has issues validating custom scalars in general and not just JSON. The errors however, do not affect the queries as they still work as expected.

Please refer to the issues below for context:

There's also an RFC that proposes attaching a URI to custom scalars to provide a link to the scalar's definition here

@twentyhq twentyhq locked and limited conversation to collaborators Jul 15, 2024
@FelixMalfait FelixMalfait converted this issue into discussion #6251 Jul 15, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in 🎯 Roadmap & Sprints Jul 15, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants
@FelixMalfait @gitstart-twenty and others