2023.6
(new) support different enum styles
it is now possible to (globally) configure different enum types in mapping.yaml
:
openapi-processor-mapping: v5
options:
package-name: generated
enum-type: default|string|framework
default
, which is default, creates a simple java enum with all uppercase enum values. It will create the same code as previous versions.
string
, simply uses String
and does not create an enum class. This is useful if automatic conversion of the incoming value to a java enum value does not work. In case bean-validation
is enabled the processor adds a (generated) validation annotation that verifies that the string is a valid (OpenAPI) enum value.
public interface FooApi {
@Mapping(path = "/foo", produces = {"application/json"})
Foo postFoo(@Parameter(name = "enum") @Values(values = {"one", "two"}) String aEnum);
}
framework
, is a placeholder for framework specific enum generation, only supported by openapi-processor-spring.