This generates correctly a Java classs which has an attribute of type KindType which is an enum. The problem arises when I try to inherit that class:
customer:
type: customControlAttributes.customControlAttributes
discriminatorValue: CUSTOMER_ACCESS_CONTROL
description: |
Annotation to verify that it's an attribute that identifies the client.
That RAML generates the Customer class but the discriminator value is not an enum value but an string:
public class CustomerImpl implements Customer {
@JsonProperty("kind")
private final Customer.KindType kind = _DISCRIMINATOR_TYPE_NAME;
}
I don't know if there is a way to cast that to the corresponding enum value.
There is also another problem with enums inside parent classes. Those enums are redefined when inheriting from those classes. This can be solved putting those enums outside those classes but I only tell you to warn you about the problem.
Good morning,
I have a little problem with enums and I have not found a solution yet. I have a RAML like the next piece:
types:
customControlAttributes: type: object discriminator: kind properties: kind: required: true type: string enum: [CUSTOMER_ACCESS_CONTROL, CONTRACT_ACCESS_CONTROL, USER_CHANNEL_CONTROL, CONTRACT_CHANNEL_CONTROL, AMOUNT_CHANNEL_CONTROL, AUDITABLE_DATA, MASK_AND_UNMASK, ENCRYPTION_AND_DECRYPTION]
This generates correctly a Java classs which has an attribute of type KindType which is an enum. The problem arises when I try to inherit that class:
customer: type: customControlAttributes.customControlAttributes discriminatorValue: CUSTOMER_ACCESS_CONTROL description: | Annotation to verify that it's an attribute that identifies the client.
That RAML generates the Customer class but the discriminator value is not an enum value but an string:
public interface Customer extends CustomControlAttributes { String _DISCRIMINATOR_TYPE_NAME = "CUSTOMER_ACCESS_CONTROL"; }
public class CustomerImpl implements Customer { @JsonProperty("kind") private final Customer.KindType kind = _DISCRIMINATOR_TYPE_NAME; }
I don't know if there is a way to cast that to the corresponding enum value.
There is also another problem with enums inside parent classes. Those enums are redefined when inheriting from those classes. This can be solved putting those enums outside those classes but I only tell you to warn you about the problem.
Thanks a lot.