dapalex / py-graphql-mapper

A python library for generating GraphQL queries and mutations using plain python objects, no hardcoded strings.Any questions or issues, please report here https://github.com/dapalex/py-graphql-mapper/issues
MIT License
19 stars 1 forks source link

[Enhancement] - Support For GQL Interfaces, Unions and Fragments #29

Closed danieledwardgeorgehitchcock closed 10 months ago

danieledwardgeorgehitchcock commented 11 months ago

It would be great to have this generator / library support Fragments alongside Unions and Interfaces.

Some GraphQL API's (such as the one that I am using this project for), make heavy use of these modifiers - as these aren't supported, this leads to a lot of errors when performing queries and I've had no choice but to comment out the problematic parts in my project now.

Happy to help out where I can for adding feature support for these

dapalex commented 11 months ago

Hi,

Thanks for opening a new issue, I have a couple of open points:

a) I revisited my documentation (and GraphQL one), fragments in GraphQL have been created for reusability, which is the fundament of py-graphql-mapper: if you need to reuse a particular data structure, instead of creating a hard-coded fragment, you can just create your own type as python class using the mapper module (example here). Unless you need to manage hard-coded queries coming from an external source (that would imply a different code generation) or to have a better visibility of query logs. Can you explain me in more detail how you intend to use fragments?

b) I explored the query containing the field you showed me in issue #25 insightsChartData: Optional[DEFTF_InsightsChartDataOutput_Field] and tried to call the API involving this information here. Unfortunately I don't have any valid ID for the argument genFarmId. Is it possible to have one in order to analyze it? Of course I can use some examples with the already present APIs creating dummy input, but it would be better to have a complete test to work with.

Thanks again