-
Notifications
You must be signed in to change notification settings - Fork 66
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
Generated httpmock Then.ok & .json_body_obj compile issues #637
Comments
See #638 - the two commented out mods in Maybe it is because I chose to use the |
Thanks for this; I'll look into it. |
pub fn body(self, value: types::InstanceStateRequested) -> Self {
Self(self.0.json_body_obj(value))
} All the other |
Then buildomat case is quite different error[E0308]: mismatched types
--> src/buildomat_httpmock.rs:37:36
|
37 | .json_body_obj(value),
| ------------- ^^^^^ expected `&_`, found `()`
| |
| arguments to this method are incorrect
|
= note: expected reference `&_`
found unit type `()`
note: method defined here
--> /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/httpmock-0.6.8/src/api/spec.rs:1034:12
|
1034 | pub fn json_body_obj<T>(self, body: &T) -> Self
| ^^^^^^^^^^^^^
help: consider borrowing here
|
37 | .json_body_obj(&value),
| + The generated code is clearly problematic with arg definition pub fn ok(self, value: ()) -> Self {
Self(
self.0
.status(200u16)
.header("content-type", "application/json")
.json_body_obj(value),
)
} |
The current buildomat openapi looks strange, and it is fixed by updating the spec - #643 Updating |
The buildomat spec piece causing the problem was intentionally added in 75b224c , and null is valid in enums according to https://swagger.io/docs/specification/data-models/enums/#nullable , so this needs to be supported by the httpmock generator. |
Odd as it might be, it's valid OpenAPI so I don't want to lose the validation of its oddness. In other words, we don't want to change the inputs to fix the tests! |
When I attempt to compile the generated output, I see
when I add
&
as suggested, I get errors likeThis is a rabbit hole, as adding
#derive[serde::Deserialize, serde::Serialize]
then requiresClient
has those traits, etc.The text was updated successfully, but these errors were encountered: