You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perhaps there's a way already to workaround this, I just could not find it.
I'm working on a code generator for Redfish schemas that produces some code like this:
#[derive(Deserialize, Serialize, ToSchema, Builder, Clone, Debug)]
#[builder(setter(strip_option))]
#[builder(build_fn(error = "ModelBuildError"))]
pub struct IPv6Address {
/// The IPv6 address.
#[serde(rename = "Address")]
#[builder(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
// ... other stuff
/// The IPv6 address prefix Length.
#[serde(rename = "PrefixLength")]
#[builder(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub prefix_length: Option<PrefixLength>, ///// <<<<< NOTICE THE USAGE OF PrefixLength here
}
The PrefixLength is generated as this:
pub type PrefixLength = i32;
When I generate the swagger-ui, there's this error for types like that:
Resolver error at paths./redfish/v1/Managers/{manager_id}/EthernetInterfaces/{ifc_id}.get.responses.200.content.application/json.schema.items.properties.IPv6StaticAddresses.items.properties.PrefixLength.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/PrefixLength does not exist in document
As it's an alias to a primitive type, I can't put the #[derive(ToSchema)] on it.
I could create the aliases as struct wrappers, but it would be a bit of a hassle to use it.
I'm about to change my codegenerator to do some lookup for aliases and translate it directly in the struct definition, but decided to check if there's another option available.
Thank you.
The text was updated successfully, but these errors were encountered:
Perhaps there's a way already to workaround this, I just could not find it.
I'm working on a code generator for Redfish schemas that produces some code like this:
The PrefixLength is generated as this:
When I generate the swagger-ui, there's this error for types like that:
As it's an alias to a primitive type, I can't put the #[derive(ToSchema)] on it.
I could create the aliases as struct wrappers, but it would be a bit of a hassle to use it.
I'm about to change my codegenerator to do some lookup for aliases and translate it directly in the struct definition, but decided to check if there's another option available.
Thank you.
The text was updated successfully, but these errors were encountered: