forked from loafle/openapi-generator-original
* Fix breaking regression introduced by #10432 This change forgot enum structures, which causes the compiler to throw errors for "the trait `Default` is not implemented for MyEnum". This change implements the Default trait to the enum template. * fix: add Default for type enums
This commit is contained in:
parent
c9495dc251
commit
30e1ba7c87
@ -28,6 +28,14 @@ impl ToString for {{{classname}}} {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for {{{classname}}} {
|
||||
fn default() -> {{{classname}}} {
|
||||
{{#allowableValues}}
|
||||
Self::{{ enumVars.0.name }}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
}
|
||||
{{/isEnum}}
|
||||
|
||||
{{!-- for schemas that have a discriminator --}}
|
||||
@ -95,6 +103,14 @@ pub enum {{{enumName}}} {
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
|
||||
impl Default for {{{enumName}}} {
|
||||
fn default() -> {{{enumName}}} {
|
||||
{{#allowableValues}}
|
||||
Self::{{ enumVars.0.name }}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user