-
Notifications
You must be signed in to change notification settings - Fork 43
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
fix(rust): add missing paths to the OpenAPI spec #1737
Conversation
Migrating to utoipa 5.2 was useful to discover quite a lot of errors and omissions.
8a8446b
to
1804592
Compare
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.
I'm not a Rust or OpenAPI expert, but the change looks reasonable to me. 😄
@@ -737,6 +738,7 @@ pub struct InvalidMacAddress(String); | |||
|
|||
#[derive(Debug, Default, Clone, PartialEq, Serialize, utoipa::ToSchema)] | |||
pub enum MacAddress { | |||
#[schema(value_type = String, format = "MAC address in EUI-48 format")] |
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.
now I am confused. it should have descriptuon from that MacAddr6 schema and also its value type should be read from it, not?
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.
It should, but it does not work in that way. To make it work, I would need to convert the variant into a struct-based one:
pub enum MacAddress {
MacAddress {
address: macaddr::MacAddr6
},
Preserve,
// etc.
}
Otherwise, the macro did not work (at least for me). I can change it, but I was unsure whether I should adapt the enum to the macro.
Thanks! But :) |
Yay, now I can see the paths that are wrongly missing the cd rust
cargo xtask openapi
jq '.paths | keys' out/openapi/*json | grep -v /api | grep \" gives me
|
The OpenAPI spec are now generated at build time and packaged as |
Good catch! I have fixed them. |
@mvidner And about use cases, code generation for our own clients could be pretty interesting. |
The OpenAPI spec is not complete, as reported in #1700. This PR aims to add the missing pieces to the spec. As part of the work, I updated the utoipa dependency to version 5.2 which is much better when it comes to detect omissions and problems.
Tasks
/api
prefix.issues
spec (postponed).