toriphes / wp-graphql-ninja-forms

Adds Ninja Forms Functionality to WPGraphQL schema
GNU General Public License v3.0
10 stars 2 forks source link

Querying ListradioField options throws unexpected value of type exception #2

Closed vvasiloud closed 3 years ago

vvasiloud commented 3 years ago

Hello,

I'm trying to query fields with options but I am having exception:

{
  ""errors": [
    {
      "debugMessage": "Expected a value of type \"String\" but received: {\"label\":\"MyLabel\",\"order\":0,\"selected\":false,\"calc\":null,\"value\":\"mylabel\"}",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 18,
          "column": 11
        }
      ],
      "path": [
        "form",
        "fields",
        "nodes",
        0,
        "options",
        0
      ],
      "trace": [
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 787,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeLeafValue(GraphQLType: String, array(5))"
        },
        [...]
      ]
    },
}

Add here is the example of the query:

query MyQuery {
  form(id: "1", idType: DATABASE_ID) {
    title
    fields {
      nodes {
        fieldId
        label
        key
        type
        required
        order
        ... on ListradioField {
          fieldLabel
          label
          key
          type
          required
          options
          order
        }
      }
    }
  }
}

The issue seems to be present even with a default Listradio field using WpGraphQL 1.3.4.

Any thoughts?

Thanks in advance.

toriphes commented 3 years ago

Hi @vvasiloud thanks for the feedback.

My bad, there was no definition of a specific type for the list element.

I just released version 0.1.2 which should fix this bug.

vvasiloud commented 3 years ago

Works perfectly now, many thanks!