-
Notifications
You must be signed in to change notification settings - Fork 247
Description
Hi,
I was wondering if there is a way to have the generated class have a different name than the class in Java, see the following example:
public class Product {
public String id;
public Type type;
...
public enum Type {
SOME_TYPE, OTHER_TYPE
}
}
When using this code in java, you would call the enum like Product.Type.SOME_TYPE
. However the generated typescript flattens this structure:
interface Product {
id: string;
type: Type;
}
enum Type {
SOME_TYPE = "SOME_TYPE",
OTHER_TYPE = "OTHER_TYPE",
}
This enum now looses this hierarchy, causing the name 'Type' to be too generic.
Renaming the enum to ProductType
would be fine in the generated code, however in java calls like Product.ProductType.SOME_TYPE
are a bit double in my opinion.
In Swagger, you have the ability to use different names, for example:
public class Product {
public String id;
public Type type;
...
@ApiModel(value = "ProductType")
public enum Type {
SOME_TYPE, OTHER_TYPE
}
}
This would cause the generated code to be called 'ProductType', while leaving the original code uneffected.
Is there some kind of functionality like this in typescript-generator?
Thanks in advance.