You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Angular and Typescript with the corresponding typescript generators to generate my schema in Typescript. I'm using the Typescript Apollo Angular plugin as well to generate and abstract operation services. Nice combo!
One of the questions I've come across is sort of fundamental.
Since all of our data responses depend on the data I specify in my request, when will I ever use any of the generated object types from the Schema?
Let me elaborate...
Codegen will generate all corresponding types from my Schema. This is great! I have the ability to structure my data exactly how my graph does. For this example, I will refer to users, with a corresponding User object.
Okay, now I am going to make a request. Specifically, a query operation. I am going to request a user, and I need the name, dob, and email fields that are present on the User type. Great.
Codegen generates my query service for this, and I inject it into my Angular component.
The response is properly typed with only the name, dob, and email fields from a user object, and not the entire User object.
I can (sort of) pass this type information along where I need it. However, I'm still not using the entire User object that Codegen initially generated from my SDL on the server.
So the question I have is: When will I ever use the full types that Codegen generates for me? (aside from requesting a full object, which will not frequently happen). Thinking about this further, most complete object types will not be used, but input types are still useful to have.
What are your thoughts? Perhaps there is some use to having the SDL object types generated, but I can't seem to think of when they will ever be used, since most operation results are dynamic based on what is specified in the request.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Angular and Typescript with the corresponding typescript generators to generate my schema in Typescript. I'm using the Typescript Apollo Angular plugin as well to generate and abstract operation services. Nice combo!
One of the questions I've come across is sort of fundamental.
Since all of our data responses depend on the data I specify in my request, when will I ever use any of the generated object types from the Schema?
Let me elaborate...
User
object.name
,dob
, andemail
fields that are present on theUser
type. Great.name
,dob
, andemail
fields from a user object, and not the entireUser
object.User
object that Codegen initially generated from my SDL on the server.So the question I have is: When will I ever use the full types that Codegen generates for me? (aside from requesting a full object, which will not frequently happen). Thinking about this further, most complete object types will not be used, but input types are still useful to have.
What are your thoughts? Perhaps there is some use to having the SDL object types generated, but I can't seem to think of when they will ever be used, since most operation results are dynamic based on what is specified in the request.
Beta Was this translation helpful? Give feedback.
All reactions