© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago
Yukko

Reusing of types between GraphQL and Rest

Hey,
I'm currently working on some graphql mutations in my backend. The thing is that we support Rest in one side of our backend and graphql in another. We do however have a couple of types that I would like to reuse in both parts. I had a discussion with a teammember, and his opinion is that types should not be mixed, meaning that if I should create "Dto's, models" or however you want to call them both on my graphql side and one on rest. I'm mostly thinking about the convention-based approach of hotchochlate and serilaztion which could be affected by having them mixed.
I'm torn since on the one side, having the types and returns seperate sounds like a good idea, but at the same time having to manage the same types twice and forced to keep a close eye to the namespace could be bothersome.
Any thoughts or experiences?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

gRPC Reusing protos between projects
C#CC# / help
16mo ago
✅ Conversions of types between two libraries
C#CC# / help
2y ago
❔ Help with choosing between ArrayList and other types of collections
C#CC# / help
3y ago
✅ Interoperability between incompatible types
C#CC# / help
4y ago