forked from loafle/openapi-generator-original
fixing an issue where serverPort from additional-properties is interpreted as a string... causing the default to always be used (#4764)
This commit is contained in:
parent
9754ef4f88
commit
21ad2869b1
@ -144,10 +144,19 @@ public class GoServerCodegen extends AbstractGoCodegen {
|
|||||||
|
|
||||||
if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof Integer) {
|
if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof Integer) {
|
||||||
this.setServerPort((int) additionalProperties.get("serverPort"));
|
this.setServerPort((int) additionalProperties.get("serverPort"));
|
||||||
|
} else if (additionalProperties.containsKey("serverPort") && additionalProperties.get("serverPort") instanceof String){
|
||||||
|
try {
|
||||||
|
this.setServerPort(Integer.parseInt(additionalProperties.get("serverPort").toString()));
|
||||||
|
additionalProperties.put("serverPort", serverPort);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
LOGGER.warn("serverPort is not a valid integer... defaulting to {}", serverPort);
|
||||||
|
additionalProperties.put("serverPort", serverPort);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
additionalProperties.put("serverPort", serverPort);
|
additionalProperties.put("serverPort", serverPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey("featureCORS")) {
|
if (additionalProperties.containsKey("featureCORS")) {
|
||||||
this.setFeatureCORS(convertPropertyToBooleanAndWriteBack("featureCORS"));
|
this.setFeatureCORS(convertPropertyToBooleanAndWriteBack("featureCORS"));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user