-
Notifications
You must be signed in to change notification settings - Fork 428
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
Expose inner value of GraphQLResponse. #1293
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change! Perhaps it is better to have an into_result function to mirror the from_result function?
I would also love a simple test that uses the function so we can make sure to not regress accidentally.
@LegNeato Thank you for the idea. However, in GraphQLRequest (not GraphQLResponse), the internal values are exposed as pub, and there is no test there at all. In Rust, pub values remain immutable unless marked as mut, ensuring that no logic can be violated. So, what exactly is the purpose of this test? Additionally, the name into_result suggests that it moves self, but GraphQLResponse needs to consistently be returned as a response after its contents are inspected by middleware. Therefore, I believe that cloning it solely for the purpose of referencing its contents is not appropriate. |
No need to
It's not a mutability being a concern.
That should be revisited at some point to. |
@RyogaK if you're not against the proposed solution, I'll get it done and merged. |
In my use case, I need to parse the GraphQLResponse from Juniper’s response and record it as structured logs. While GraphQLRequest has a public (pub) internal structure, but the internals of GraphQLResponse are not accessible, so currently, I have to serialize it once and then re-parse it as a string. This intermediary processing is cumbersome, and I would like to directly access the internal data of GraphQLResponse.