-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Milestone
Description
Description
Given the following enum declarations in the yaml file:
authorizationType:
enum:
- ldap
- internal
type: string
eventPublishSubscriptionMode:
enum:
- 'off'
- on-with-format-v1
- on-with-no-unsubscribe-events-on-disconnect-format-v1
- on-with-format-v2
- on-with-no-unsubscribe-events-on-disconnect-format-v2The kotlin code generated has errors.
enum class AuthorizationType(val value: kotlin.String) {
ldap("ldap"),
internal("internal"); // internal is a keyword in kotlin
}
enum class EventPublishSubscriptionMode(val value: kotlin.String) {
off("off"),
on-with-format-v1("on-with-format-v1"), // We cannot use '-' here
on-with-no-unsubscribe-events-on-disconnect-format-v1("on-with-no-unsubscribe-events-on-disconnect-format-v1"),
on-with-format-v2("on-with-format-v2"),
on-with-no-unsubscribe-events-on-disconnect-format-v2("on-with-no-unsubscribe-events-on-disconnect-format-v2");
}Swagger-codegen version
2.2.3 and master
Swagger declaration file content or url
http://sftp.solace.com/download/VMR_SEMPV2_SCHEMA_YAML
http://sftp.solace.com/download/VMR_SEMPV2_SCHEMA_JSON
Command line used for generation
java -jar swagger-codegen-cli.jar generate -l kotlin -i semp-v2-swagger-config.yaml
Suggest a fix/enhancement
Not sure how to fix this, the Java code generation looks correct when dealing with enums:
@JsonAdapter(AuthorizationTypeEnum.Adapter.class)
public enum AuthorizationTypeEnum {
LDAP("ldap"),
INTERNAL("internal");
}
@JsonAdapter(EventPublishSubscriptionModeEnum.Adapter.class)
public enum EventPublishSubscriptionModeEnum {
OFF("off"),
ON_WITH_FORMAT_V1("on-with-format-v1"),
ON_WITH_NO_UNSUBSCRIBE_EVENTS_ON_DISCONNECT_FORMAT_V1("on-with-no-unsubscribe-events-on-disconnect-format-v1"),
ON_WITH_FORMAT_V2("on-with-format-v2"),
ON_WITH_NO_UNSUBSCRIBE_EVENTS_ON_DISCONNECT_FORMAT_V2("on-with-no-unsubscribe-events-on-disconnect-format-v2");
}