query language with direction errors

Created on 20 November 2024, 7 months ago
Updated 2 June 2025, 6 days ago

Problem/Motivation

When querying languages with the 'direction' option results with an error message.

{
  "errors": [
    {
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 8,
          "column": 9
        }
      ],
      "path": [
        "entityQuery",
        "items",
        0,
        "direction"
      ]
    },

Steps to reproduce

1. Enable entity type `configurable_language (Language)`
2. Go to explorer and query languages with direction.

query MyQuery {
  entityQuery(entityType: CONFIGURABLE_LANGUAGE) {
    total
    items {
      ... on ConfigurableLanguage {
        id
        name
        direction
      }
    }
  }
}

Proposed resolution

Per https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Language%... getDirection() returns a string.

Change direction: Int! to direction: String! in /graphql/core/LanguageInterface.graphqls.

This will give expected result:

{
  "data": {
    "entityQuery": {
      "total": 31,
      "items": [
        {
          "id": "ar",
          "name": "Arabic",
          "direction": "ltr"
        },
        {
          "id": "cs",
          "name": "Czech",
          "direction": "ltr"
        },
        {
          "id": "da",
          "name": "Danish",
          "direction": "ltr"
        },
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justclint

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024