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

Response struct fields are all private, making response structs difficult to inspect and test #11

Open
MikeFHay opened this issue Jul 4, 2022 · 0 comments

Comments

@MikeFHay
Copy link

MikeFHay commented Jul 4, 2022

Thanks for the library. I'm new to Rust so forgive me if I'm missing something.

All the fields for all of the structs in response.rs are private, and none of the structs derive Eq or PartialEq. This makes it difficult to test functions that return Responses, e.g. attempting to test your example hello world function:

assert_eq!(Response::simple("hello", "hello world"), handle_hello().unwrap())

Fails with "error[E0369]: binary operation == cannot be applied to type alexa_sdk::Response"

and

assert_eq!("hello world", &handle_hello().unwrap().body.output_speech.unwrap().text.unwrap());

fails with "error[E0616]: field body of struct alexa_sdk::Response is private".

Since all of these structs are expected to be constructed by the user code, and are directly serialized into stable Alexa API response types. I would expect the fields to be public. It would also be a nice convenience if they derived Eq.

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