Codegen creates objects with overly long names that arent navigable #1178
devinnasar
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm wondering if I'm misunderstanding what ariadne-codegen does. My understanding is that by giving Codegen access to the remote API, that it is crawling the schema and creating class types from the return types that it is observing. I also believe that it's supposed to do things like identify common object types and build data classes for them, then use those data classes whenever a query would indicate an instance of that class. For example, if Codegen notices that anywhere in the schema there is a 'tag' object, then it should be understanding that tags are a data class, and I should get Tag() objects back whenever one of my graphql queries would return a json structure containing tags, for example:
Given:
I should expect to get an Object
parentObject
with an attribute calledtags
which is a list oftag
Objects.However I'm not noticing that. Instead what I'm getting in response to my query is a HUGE object that seems to build child objects based off of the full name of the JSON path that they live on in the response. That, to me seems unusable. Observe:
Given:
queries/aes.gql
scratch.py
Output (values obfuscated)
Compare to the JSON response of the same query:
Am I thinking about this incorrectly? This feels more cumbersome to interact with than just working with it as consumed JSON. What am I getting wrong about my approach?
Beta Was this translation helpful? Give feedback.
All reactions