- Issue created by @ccjjmartin
- π¦πΊ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 11:39pm 26 April 2023 - π¦πΊ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 π