Skip to content

Commit

Permalink
OpenAPI Generator 7.7.0 (#1614)
Browse files Browse the repository at this point in the history
  • Loading branch information
altro3 authored Jul 5, 2024
1 parent e84043f commit e439872
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jspecify = "0.3.0"
jdt-annotation = "2.3.0"
android-annotation = "1.8.0"
spotbugs-annotations = "4.8.6"
openapi-generator = "7.6.0"
openapi-generator = "7.7.0"
swagger-parser = "1.0.71"
swagger-parser-v3 = "2.1.22"
javaparser = "3.26.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
import static io.micronaut.openapi.generator.Utils.addStrValueToEnum;
import static io.micronaut.openapi.generator.Utils.normalizeExtraAnnotations;
import static io.micronaut.openapi.generator.Utils.processGenericAnnotations;
import static org.openapitools.codegen.CodegenConstants.API_PACKAGE;
import static org.openapitools.codegen.CodegenConstants.INVOKER_PACKAGE;
import static org.openapitools.codegen.CodegenConstants.MODEL_PACKAGE;
import static org.openapitools.codegen.utils.StringUtils.camelize;

/**
Expand Down Expand Up @@ -113,7 +115,6 @@ public abstract class AbstractMicronautJavaCodegen<T extends GeneratorOptionsBui

protected SecureRandom random = new SecureRandom();
protected String title;
protected boolean useBeanValidation;
protected boolean useOptional;
protected boolean visitable;
protected boolean lombok;
Expand Down Expand Up @@ -187,7 +188,7 @@ protected AbstractMicronautJavaCodegen() {
updateOption(INVOKER_PACKAGE, getInvokerPackage());
updateOption(CodegenConstants.ARTIFACT_ID, getArtifactId());
updateOption(CodegenConstants.API_PACKAGE, apiPackage);
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
updateOption(MODEL_PACKAGE, modelPackage);

cliOptions.add(new CliOption(OPT_TITLE, "Client service name").defaultValue(title));
cliOptions.add(new CliOption(OPT_APPLICATION_NAME, "Micronaut application name (Defaults to the " + CodegenConstants.ARTIFACT_ID + " value)").defaultValue(appName));
Expand Down Expand Up @@ -293,7 +294,7 @@ public void setArtifactId(String artifactId) {
@Override
public void setModelPackage(String modelPackage) {
super.setModelPackage(modelPackage);
updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage);
updateOption(MODEL_PACKAGE, modelPackage);
}

@Override
Expand Down Expand Up @@ -363,6 +364,18 @@ public void processOpts() {
additionalProperties.put(INVOKER_PACKAGE, invokerPackage);
}

if (additionalProperties.containsKey(API_PACKAGE)) {
apiPackage = (String) additionalProperties.get(API_PACKAGE);
} else {
additionalProperties.put(API_PACKAGE, apiPackage);
}

if (additionalProperties.containsKey(MODEL_PACKAGE)) {
modelPackage = (String) additionalProperties.get(MODEL_PACKAGE);
} else {
additionalProperties.put(MODEL_PACKAGE, modelPackage);
}

if (additionalProperties.containsKey(OPT_APPLICATION_NAME)) {
appName = (String) additionalProperties.get(OPT_APPLICATION_NAME);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
import static io.micronaut.openapi.generator.Utils.addStrValueToEnum;
import static io.micronaut.openapi.generator.Utils.normalizeExtraAnnotations;
import static io.micronaut.openapi.generator.Utils.processGenericAnnotations;
import static org.openapitools.codegen.CodegenConstants.API_PACKAGE;
import static org.openapitools.codegen.CodegenConstants.INVOKER_PACKAGE;
import static org.openapitools.codegen.CodegenConstants.MODEL_PACKAGE;
import static org.openapitools.codegen.languages.KotlinClientCodegen.DATE_LIBRARY;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
Expand Down Expand Up @@ -424,6 +426,18 @@ public void processOpts() {
additionalProperties.put(INVOKER_PACKAGE, packageName);
}

if (additionalProperties.containsKey(API_PACKAGE)) {
apiPackage = (String) additionalProperties.get(API_PACKAGE);
} else {
additionalProperties.put(API_PACKAGE, apiPackage);
}

if (additionalProperties.containsKey(MODEL_PACKAGE)) {
modelPackage = (String) additionalProperties.get(MODEL_PACKAGE);
} else {
additionalProperties.put(MODEL_PACKAGE, modelPackage);
}

if (additionalProperties.containsKey(OPT_APPLICATION_NAME)) {
appName = (String) additionalProperties.get(OPT_APPLICATION_NAME);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{{/parent}}
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Data
{{/lombok}}
{{#micronaut_serde_jackson}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
{{/required}}
{{/isNullable}}
{{!Validate all pojos and enums}}
{{^isUuid}}
{{^isContainer}}
{{#isModel}}
@Valid
Expand Down Expand Up @@ -109,4 +110,5 @@
{{/maximum}}
{{/isLong}}
{{/isInteger}}
{{/isUuid}}
{{/useBeanValidation}}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{{/required}}
{{/isNullable}}
{{!Validate all pojos and enums}}
{{^isUuid}}
{{^isContainer}}
{{#isModel}}
@Valid
Expand Down Expand Up @@ -89,4 +90,5 @@
{{/maximum}}
{{/isLong}}
{{/isInteger}}
{{/isUuid}}
{{/useBeanValidation}}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
{{/isReadOnly}}
{{/required}}
{{/isNullable}}
{{^isUuid}}
{{!Validate all pojos and enums}}
{{^isContainer}}
{{#isModel}}
Expand Down Expand Up @@ -89,4 +90,5 @@
{{/maximum}}
{{/isLong}}
{{/isInteger}}
{{/isUuid}}
{{/useBeanValidation}}

0 comments on commit e439872

Please sign in to comment.