Missing Field Resolvers for AddressSubdivision

Created on 14 April 2023, over 1 year ago
Updated 26 April 2023, over 1 year ago

Problem/Motivation

When on the validate page of a graphql schema implementing this extension you will notice that AddressSubdivison has missing field resolvers

Steps to reproduce

Go to the validate page of a schema that uses this extension

Proposed resolution

??? I can see multiple ways to resolve this but would like further input from the maintainer(s) on thoughts as to approach on this one.

Remaining tasks

Implement field resolvers

User interface changes

N/A

API changes

N/A

Data model changes

Implement field resolver

πŸ› Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ccjjmartin Austin, TX

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

Comments & Activities

  • Issue created by @ccjjmartin
  • πŸ‡ΊπŸ‡ΈUnited States ccjjmartin Austin, TX
  • πŸ‡¦πŸ‡ΊAustralia darvanen Sydney, Australia

    Been a while since I made this but after a look around I'd say the way that makes most sense to me is to make a copy of \Drupal\graphql_address\Plugin\GraphQL\DataProducer\AddressCountryFields that works for subdivision and wire it up in \Drupal\graphql_address\Plugin\GraphQL\SchemaExtension\GraphQLAddressSchemaExtension in a similar way.

    Happy to hear other ideas if you see issues with that.

  • πŸ‡ΊπŸ‡ΈUnited States ccjjmartin Austin, TX

    @darvanen do you think any changes to the AddressSubdivisions data producer would be necessary?

  • πŸ‡¦πŸ‡ΊAustralia darvanen Sydney, Australia

    Oh I see.

    Um, I don't think so? If I was doing this it would probably take a bit of trial and error.

    It *does* work in its current state, it's just that it doesn't provide enough metadata for the graphql_composer module to pick up the details, I think?

    Once again, happy to hear suggestions.

  • πŸ‡ΊπŸ‡ΈUnited States ccjjmartin Austin, TX

    It looks like if you make the "type" AddressSubdivision a "scalar" it will tell graphql that this is not resolvable while not breaking the response of the data. Technically this would be a breaking change as queries would change from:

          country {
            name
            subdivisions {
              code
              name
            }
          }
    

    to just

          country {
            name
            subdivisions
          }
    

    I am also not sure if this breaks a bunch of best practices around use of scalar types but would be interested in your thoughts on this approach.

  • Status changed to Closed: works as designed over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia darvanen Sydney, Australia

    Thanks to @Kingdutch for tracking down the underlying issue here. From slack:

    Kingdutch
    I've created https://github.com/drupal-graphql/graphql/issues/1341
    It's a limitation in the validation (which is a tool to help catch forgotten things, not meant to be followed blindly 😬 )
    In this case what you're doing is perfectly legal and should keep working even in newer versions πŸ™‚

Production build 0.71.5 2024