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

Accept a SimpleObject as input type. #32

Closed
ruseinov opened this issue Apr 26, 2020 · 6 comments
Closed

Accept a SimpleObject as input type. #32

ruseinov opened this issue Apr 26, 2020 · 6 comments

Comments

@ruseinov
Copy link
Contributor

Currently if I want to define a struct with a bunch of fields as an InputType I would also have to define the impl for it and all the fields there, which makes the amount of boilerplate unbearable.

I'd like to be able to simply define a struct and use it's fields as input fields.

@ruseinov
Copy link
Contributor Author

My bad, it looks like the object is not accepted either. I'm not sure how this is supposed to worth then as the docs are pretty scarce on this subject, I'll keep investigating.

@ruseinov
Copy link
Contributor Author

#[InputObject] there we go. I was misled by rust compiler errors at first.

@sunli829
Copy link
Collaborator

The documentation is not detailed enough.😂

@ruseinov
Copy link
Contributor Author

@sunli829 yeah, the rest works though. Once I'm done with my graphql implementation and I'm doing a full on Mutation/Subscription/Query impl backend by MongoDB - I'll make sure to contribute some boilerplate.

It would also be nice to somehow be able to expose all fields by default without supplying #[field] annotation, but I haven't tested without. I'll be happy to come back with a bunch of proposals once I'm further down this road.

@sunli829
Copy link
Collaborator

This is a good suggestion, I created a new issue #33 and started adding this feature now.

@ruseinov
Copy link
Contributor Author

Oh wow, that was quick, thanks!

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

2 participants