SCHEMA - Node Interface not conform to Global Indentification specs

Created on 26 July 2022, over 2 years ago
Updated 19 June 2023, over 1 year ago

Problem/Motivation

Your project defines a Node interface but it does not conform to the Global Identification Spec.

If you are trying to provide the Node interface and its field, they must look like the following:

interface Node {
        id: ID!
}

extend type Query {
        node(id: ID!): Node
}

Steps to reproduce

When using the self generated GraphQL Schema with HoudiniGraphQL fetcher

Proposed resolution

For the time being, manually add this to the generated graphql schema to be 100% GraphQL comform till there is a patch.
https://graphql.org/learn/global-object-identification/

extend type Query {
        node(id: ID!): Node
}
🌱 Plan
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

🇩🇪Germany Rar9

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    I'm conflicted on this.

    On one hand, Node spec is nice to have.
    On the other, Drupal makes this a confusing query to have. Anyone that knows what a node is expects the node to be a... drupal node. Not a hypothetical interface node,

    You could namespace all Drupal nodes as "Content", which you could do by changing the "prefix" in Plugin/GraphQLCompose/EntityType/Node.php to "Content", as this is a plugin, you can do that yourself by overriding the node plugin class.

    function mymodule_graphql_compose_entity_type_alter(array &$info) {
      if (isset($info['node'])) {
        $info['node']['class'] = '\Drupal\mymodule\MyCustomNodePlugin';
      }
    }
    

    Then just hack away as much as you want. If you wanted to create your own query and use the `entity_load_by_uuid` producer. Thats all possible.

    ---

    I'd actually prefer to just not use the Node interface. Which means decoupling it out of the Open Social Edge code.

  • Status changed to Postponed over 1 year ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Following up on this, I think I'm going to just move away from Node as the interpretation of global-object-identification.

    We use GOI in its intended way with:

    nodePage(id): NodePage
    and NodePage has ID!

    According to the never untruthful always correct ChatGPT:

    GraphQL's Global Object Identification is a pattern used to uniquely identify objects across an entire GraphQL API, regardless of their underlying data storage or schema. It ensures that each object has a globally unique identifier (ID) that can be used to fetch the object from the API.

    Which we do by using UUIDs in the ID! field.

    The interface Node { id: ID! } is just confusing to anyone that knows Drupal.

    🚮

  • Assigned to almunnings
  • Status changed to Active over 1 year ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺
  • Status changed to Closed: won't fix over 1 year ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Node has been removed into latest dev. Closing issue.

Production build 0.71.5 2024