Modular Ariadne that's friendly to server code generators #1156
CemraJC
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Object Oriented Ariadne!
I spent quite some time this evening putting this together: https://gist.github.com/CemraJC/6c155444bd5306ac4bcec8ac50e15592
Effectively, it's a very concise chunk of code that I think will fill the (what I perceive as a) gap in the code-generation capabilities when it comes to Ariadne. I absolutely love this library, and believe strongly that a schema-first approach is really the only way to do it.
That said, what's been missing, is a modular & scalable approach to implementing Ariadne using the python classes syntax & object oriented capabilities. Well, until I found out about this 😅 Embarrassing...
Moving on though, while I do like the approach in
ariadne-graphql-modules
, I think that it could be less implicit with the linkages and have less reliance on a background set of algorithms that could potentially mess something up when linking everything together.In addition, my implementation of a modular syntax is very friendly to code generators - the formatting is very consistent across the sweep, and allows for the developer to focus their concerns at a single type at a time.
I'm not 100% convinced that what I've done is groundbreaking by any means, but if not at least an amusement, I hope that it might serve as some light inspiration for an alternative way of structuring a python GraphQL server project! In any case, I'm going to leave it here in case anyone finds it interesting.
Beta Was this translation helpful? Give feedback.
All reactions