forked from loafle/openapi-generator-original
Add enum name mapping feature to typescript generators (#18064)
* feat: add enum mapping for typescript * revert unnecessary change
This commit is contained in:
parent
0bc979ebdc
commit
20bd649bf9
@ -5,3 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/typescript-angular
|
||||
additionalProperties:
|
||||
ngVersion: 16.1.2
|
||||
supportsES6: true
|
||||
enumNameMappings:
|
||||
delivered: SHIPPED
|
||||
|
@ -888,6 +888,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String name, String datatype) {
|
||||
if (enumNameMapping.containsKey(name)) {
|
||||
return enumNameMapping.get(name);
|
||||
}
|
||||
|
||||
if (name.length() == 0) {
|
||||
return getNameUsingEnumPropertyNaming("empty");
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export namespace Order {
|
||||
export const StatusEnum = {
|
||||
Placed: 'placed' as StatusEnum,
|
||||
Approved: 'approved' as StatusEnum,
|
||||
Delivered: 'delivered' as StatusEnum
|
||||
SHIPPED: 'delivered' as StatusEnum
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user