-
Notifications
You must be signed in to change notification settings - Fork 222
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
Regression: Option<>
fields are labeled as required
in the generated OpenAPI spec.
#529
Comments
Option<>
Option<>
fields are labeled as required
in the generated OpenAPI spec.
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
This is by the desing, since Also this change allows client side generators to generate the correct client types which was not possible previously because it handled the types incorrectly. Basically
See more explanation here: #479 (comment) |
@juhaku , thanks for this really useful crate. If the goal is to be consistent with As for the cliend-side generator compatibility, I actually ran into this problem because my code using |
It's my pleasure ❤️ It seems like it does both. In example below both will deserialize to correct rust type. It deserializes #[derive(Serialize, Deserialize, Debug)]
struct Foobar {
value: Option<String>
}
let value: Foobar = serde_json::from_str(r###"{"value": null}"###).unwrap();
let value2: Foobar = serde_json::from_str(r###"{}"###).unwrap();
// will deserialize to
let value = Foobar { value: None }; I think we could get some middle ground here with making it not required as previously, but it anyway will still be nullable. Other option I guess would be to add |
Yes, that's what I meant, apologies about lack of clarity.
This combination would make the most sense to me. Would this work in the use case brought up in #314?
Wouldn't it be cleaner to make it an attribute that can be attached to a specific field? |
I believe it would at least partly. Speaking of TypeScript, now with the current implementation
You mean adding a |
I don't know TypeScript, so can't comment on this.
Yep, or the other way around -- add
|
Yeah, I reckon I'll add |
Sounds great, thanks! |
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
@ryzhyk There is a new release available in crates for grab. |
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
Use an older `utoipa` until juhaku/utoipa#529 is resolved.
* nexmark: bump serde_with version to 3.0.0 , so that it uses the same version as JIT. * pipeline_manager: use the latest utoipa and related crates (see juhaku/utoipa#529) Signed-off-by: Leonid Ryzhyk <leonid@feldera.com>
* nexmark: bump serde_with version to 3.0.0 , so that it uses the same version as JIT. * pipeline_manager: use the latest utoipa and related crates (see juhaku/utoipa#529) Signed-off-by: Leonid Ryzhyk <leonid@feldera.com>
* nexmark: bump serde_with version to 3.0.0 , so that it uses the same version as JIT. * pipeline_manager: use the latest utoipa and related crates (see juhaku/utoipa#529) Signed-off-by: Leonid Ryzhyk <leonid@feldera.com>
Given the following Rust definition:
utoipa
generates the following OpenAPI schema that (I think) incorrectly labelsbuffer_size_bytes
asrequired
:I believe this behavior was introduced recently. It works correctly in v3.0.3.
The text was updated successfully, but these errors were encountered: