Skip to content
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 to create a type dynamically #1124

Open
happy-machine opened this issue Nov 20, 2022 · 0 comments
Open

How to create a type dynamically #1124

happy-machine opened this issue Nov 20, 2022 · 0 comments

Comments

@happy-machine
Copy link

Hi there, thanks for this awesome library.

Ive got two related questions its probably less messy to put in one issue, i hope thats ok.

I want to map types to external objects (either from a json or an external python binding sourced object)

In the docs i've found:
https://graphql-rust.github.io/types/objects/complex_fields.html
https://docs.rs/juniper/latest/juniper/trait.GraphQLType.html

I'm trying to follow complex fields but can't get the import to work.
Example sais:
#[macro_use] extern crate juniper;

But this won't compile for me, i have #[macro_use] in my lib.js (im making a library) but i get an error trying to use graphql_object (which im doing exactly as in the example) which is: can't find macro graphql_object in this scope.

Is this the way to define custom types? ie. if i have a hash map i want to map over and translate the keys to fields and the values to types? (do you have any examples of this anywhere). I'm quite new to rust and the combination of graphql and rust syntax is quite intense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant