The current print_openapi() is a little unwieldy; it contains a non-optional argument after a sea of optionals, and even if you intend to provide all of the optionals it's a lot of strings that you have to put in the right order.
A simple call, with no optionals, looks like this today:
api.print_openapi(
&mut f,
&"Keeper API".to_string(),
None,
None,
None,
None,
None,
None,
None,
&"1.0".to_string(),
)?;
I suspect it'd be better as a struct, like:
api.print_openapi(
&mut f,
OpenApiDetails {
name: "Keeper API".to_string(),
version: "1.0".to_string(),
..Default::default()
},
)?;
It'd be easier and clearer to then incrementally add additional fields; e.g.,
api.print_openapi(
&mut f,
OpenApiDetails {
name: "Keeper API".to_string(),
version: "1.0".to_string(),
license_name: Some("CDDL").to_string(),
..Default::default()
},
)?;
The current print_openapi() is a little unwieldy; it contains a non-optional argument after a sea of optionals, and even if you intend to provide all of the optionals it's a lot of strings that you have to put in the right order.
A simple call, with no optionals, looks like this today:
I suspect it'd be better as a struct, like:
It'd be easier and clearer to then incrementally add additional fields; e.g.,