AxeWP / wp-graphql-gravity-forms

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

feat!: Narrow `FormField.choices` and `.inputs` types to their implemations #415

Closed justlevine closed 6 months ago

justlevine commented 6 months ago

What

This PR updates the schema types for the FormField.choices and FormField.inputs fields to their respective implementing type, instead of the interface.

Why

... on OptionField {
  adminLabel
  canPrepopulate
  choices {
  ... on OptionFieldChoice { # 👈 This is unnecessary and redundant. We **know** this b/c its on the OptionField
    formattedPrice
    isSelected
    price
    text
    value
  }

  # ✔️ Now we can query it directly on the `choice`
  formattedPrice
  isSelected
  price
  text
  value
}

How

Uses the new Utils::overload_graphql_field_type to avoid the validation issues in graphql_register_field()

Testing Instructions

Additional Info

Checklist: