-
Notifications
You must be signed in to change notification settings - Fork 6k
added option to write a throwing exception for unknown enums values. #10356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…n java generators
please build |
please build |
Please build |
@HugoMario |
How can I enable it for swagger-codegen-maven-plugin? Thanks in advance. |
In the meantime I found out how to do it:
<configuration>
...
<additionalProperties>
<additionalProperty>errorOnUnknownEnum=true</additionalProperty>
</additionalProperties>
...
</configuration>
Cosimo Damiano Prete ***@***.***> escreveu no dia segunda,
26/04/2021 à(s) 11:14:
… How can I enable it for swagger-codegen-maven-plugin?
Thanks in advance.
I've the same issue.
I've tried specifying it as configOption as well as configuration option,
but it looks like it's simply ignored.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#10356 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABOMTQKSOA2V6R6RYVD74Q3TKU4GZANCNFSM4OLX5LCA>
.
|
Too bad that now the generation of the patterns is broken and therefore I cannot use this version... |
Nice to see that after almost an year this is still broken. <plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.32</version>
<dependencies>
<dependency>
<groupId>com.github.jknack</groupId>
<artifactId>handlebars</artifactId>
<version>4.3.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/service-contract.yaml</inputSpec>
<modelPackage>com.cdprete.phonebook.dto</modelPackage>
<generateApis>false</generateApis>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
<language>java</language>
<library>resttemplate</library>
<additionalProperties>
<additionalProperty>errorOnUnknownEnum=true</additionalProperty>
</additionalProperties>
<configOptions>
<booleanGetterPrefix>is</booleanGetterPrefix>
<dateLibrary>java8</dateLibrary>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
<useBeanValidation>true</useBeanValidation>
<performBeanValidation>true</performBeanValidation>
<openApiNullable>false</openApiNullable>
</configOptions>
</configuration>
</execution>
</executions> I get out @JsonCreator
public static TypeEnum fromValue(String input) {
for (TypeEnum b : TypeEnum.values()) {
if (b.value.equals(input)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + text + "' for 'EmailAddress' enum.");
} See how the parameter is named input, but in the exception is concatenated (wrongly) as text... |
I have exactly the same issue as described above. breaks compilation because parameter is named input, but in the exception is concatenated (wrongly) as text... Any idea for work around or when it's going to be fixed? |
hi @cdprete to get the
cf. |
Hi @yannick-fernand. |
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.3.0.0
branch for changes related to OpenAPI spec 3.0. Default:master
.Description of the PR
fixes #5950