-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How exactly to build wrapper libraries? #956
Comments
Hi @negezor - good question, this isn't something I've put a lot of thought into. The approach you suggest certainly seems like a good option - it's not too hard for you, and simple enough for the consumers of your library.
I think that depends how much effort you want to put in. All of the derive macros in cynic need to get the schema from somewhere - either the output of that But if you were really wanting to avoid users dealing with this it might be possible to write your own derives that wrap the built in cynic ones, re-directing them towards your specific schema. Either by prepopulating the I'm not sure how easy (or even possible) that'd be mind you - but you could try it if you wanted. It might need some API changes in cynic-codegen to expose some things. But I could be open to accepting those, depending on what they are - probably best to talk it through with me after investigating if you do want to go down this route. |
Thanks @negezor! I was having the same problem since we were trying to reuse the 'schema' crate in our company (we use a private Cargo registry) but it was difficult since we had to copy the schema files to the dependent crates, which could live in other repos |
Hi, I am making a wrapper library for a website with GraphQL API. I would like to ship the schema file with the library so the user doesn't have to download it manually. It only had to define own objects or import ready-made ones.
I have not found clarification in the documentation how this can be done. I would like to ask you as the author of the library. As an option I saw to use
include_str!()
from the main library, then the user would only have to call inbuild.rs
:Also is it possible to avoid
build.rs
in user code? If it will also define its own objects?The text was updated successfully, but these errors were encountered: