AxeWP / wp-graphql-gravity-forms

GraphQL API for interacting with Gravity Forms.
GNU General Public License v3.0
163 stars 29 forks source link

Cannot query field "isHidden" on type "GfFieldInput". Did you mean to use an inline fragment on "GfFieldInputWithAddressSetting"... #402

Closed hmingv closed 4 months ago

hmingv commented 6 months ago

Description

After the plug-in version is upgraded, GraphiQL cannot be used.

old version WP GraphQL: V1.12.2 Gravity Forms: V2.6.9 WPGraphQL for Gravity Forms: v0.11.8 new version WP GraphQL: V1.22.1 Gravity Forms: V2.8.6 WPGraphQL for Gravity Forms: v0.12.5

After the upgrade, an error occurred in the original request. The error message is as follows:

image

Steps to reproduce

query FormQuery {
  gfForm(id: "1", idType: DATABASE_ID) {
    id
    title
    description
    formFields {
      nodes {
        id
        type

        ... on NameField {
          description
          label
          inputs {
            isHidden
            label
            placeholder
          }
        }
      }
    }
  }
}

Additional context

No response

Plugin Version

0.12.5

Gravity Forms Version

2.8.6

WordPress Version

6.4

WPGraphQL Version

1.22.1

Additional enviornmental details

PHP 8.1

Please confirm that you have searched existing issues in the repo.

Please confirm that you have disabled ALL plugins except for Gravity Forms, WPGraphQL, and WPGraphQL for Gravity Forms

hmingv commented 6 months ago

I checked the documentation, but the documentation also says this, but in my project this will result in an error.

https://github.com/AxeWP/wp-graphql-gravity-forms/blob/ddb382b524215ffbdca079fc6ad3bc95c2837600/docs/querying-formfields.md?plain=1#L36-L42

justlevine commented 6 months ago

Hey @hmingv

WPGraphQL follows SemVer, and as such the update from v0.11.x to v0.12.0 is a breaking one. You can see the full changelog for v0.12.0 here.

The highlight of that change is that fields are now applied as interfaces instead of directly on the field. Those GraphQL errors are telling you must specify the relevant interfaces. You should be able to use ... on NameInputProperty { ... } for your specific use case in the screenshot, and you can use the Documentation Explorer in the GraphiQL IDE to find the new location of any other fields you can no longer find.

If you run into any additional issues upgrading to v0.12.x, please feel free to ask for help in the #gravityforms channel on WPGraphQL Slack

justlevine commented 6 months ago

I checked the documentation, but the documentation also says this, but in my project this will result in an error.

https://github.com/AxeWP/wp-graphql-gravity-forms/blob/ddb382b524215ffbdca079fc6ad3bc95c2837600/docs/querying-formfields.md?plain=1#L36-L42

Thanks for flagging. Will get that query snippet updated ASAP!

hmingv commented 6 months ago

Great, thank you for making this clear to me, it's an excellent feature.

justlevine commented 4 months ago

Figured out a way to overload the subtypes despite WPGraphQL limitations in #415