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
When generating rust code based on an openapi spec that uses discriminators and mapped objects, excess structs are created that are confusing to the user.
openapi-generator version
Version 5.1.0
OpenAPI declaration file content or url
The openapi spec below
components:schemas:Data:description: The event payload.type: objectdiscriminator:propertyName: type_namemapping:UserAuthentication: UserAuthenticationUserAuthentication:required:- type_namedescription: User's authentication data.type: objectproperties:type_name:description: The name of this type.type: stringexample: UserAuthenticationcertificate:type: string
#[derive(Clone,Debug,PartialEq,Serialize,Deserialize)]pubstructUserAuthentication{/// The name of this type.#[serde(rename = "type_name")]pubtype_name:String,#[serde(rename = "certificate", skip_serializing_if = "Option::is_none")]pubcertificate:Option<String>,}
Description
When generating rust code based on an openapi spec that uses discriminators and mapped objects, excess structs are created that are confusing to the user.
openapi-generator version
Version 5.1.0
OpenAPI declaration file content or url
The openapi spec below
results in both of the following files
data.rs:
user_authentication.rs:
Command line used for generation
Steps to reproduce
mkdir crates
docker run
command.Related issues/PRs
This spec is based on the work in #3895.
Suggest a fix/enhancement
If either the structs were not generated or used inside the enums the resulting code would be much easier to use.
The text was updated successfully, but these errors were encountered: