mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
Add enum name mapping feature to typescript generators (#18064)
* feat: add enum mapping for typescript * revert unnecessary change
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user