diff --git a/docs/generators/java-micronaut-client.md b/docs/generators/java-micronaut-client.md
index 14c6eeeaf8d..1adf78b70f9 100644
--- a/docs/generators/java-micronaut-client.md
+++ b/docs/generators/java-micronaut-client.md
@@ -22,8 +22,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |org.openapitools.api|
+|applicationName|Micronaut application name (Defaults to the artifactId value)| |openapi-micronaut-client|
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
-|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-micronaut|
+|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-micronaut-client|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
@@ -43,6 +44,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
- **false**
- No changes to the enum's are made, this is the default option.
- **true**
- With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false|
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
+|generateOperationOnlyForFirstTag|When false, the operation method will be duplicated in each of the tags if multiple tags are assigned to this operation. If true, each operation will be generated only once in the first assigned tag.| |false|
+|generateSwaggerAnnotations|Specify if you want to generate swagger annotations and which version|- **swagger2**
- Use io.swagger.core.v3:swagger-annotations for annotating operations and schemas
- **true**
- Equivalent to "swagger2"
- **false**
- Do not generate swagger annotations
- **swagger1**
- Use io.swagger:swagger-annotations for annotating operations and schemas
|false|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
@@ -52,7 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|- **true**
- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
- **false**
- The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
-|micronautVersion|Micronaut version, only >=3.0.0 versions are supported| |3.3.1|
+|micronautVersion|Micronaut version, only >=3.0.0 versions are supported| |3.4.3|
|modelPackage|package for generated models| |org.openapitools.model|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
diff --git a/docs/generators/java-micronaut-server.md b/docs/generators/java-micronaut-server.md
index 6a6655585f9..715d9022d92 100644
--- a/docs/generators/java-micronaut-server.md
+++ b/docs/generators/java-micronaut-server.md
@@ -21,6 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
+|applicationName|Micronaut application name (Defaults to the artifactId value)| |openapi-micronaut|
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-micronaut|
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
@@ -44,7 +45,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false|
|generateControllerAsAbstract|Generate an abstract class for controller to be extended. (apiPackage is then used for the abstract class, and controllerPackage is used for implementation that extends it.)| |false|
|generateControllerFromExamples|Generate the implementation of controller and tests from parameter and return examples that will verify that the api works as desired (for testing)| |false|
+|generateOperationOnlyForFirstTag|When false, the operation method will be duplicated in each of the tags if multiple tags are assigned to this operation. If true, each operation will be generated only once in the first assigned tag.| |true|
|generateOperationsToReturnNotImplemented|Return HTTP 501 Not Implemented instead of an empty response in the generated controller methods.| |true|
+|generateSwaggerAnnotations|Specify if you want to generate swagger annotations and which version|- **swagger2**
- Use io.swagger.core.v3:swagger-annotations for annotating operations and schemas
- **true**
- Equivalent to "swagger2"
- **false**
- Do not generate swagger annotations
- **swagger1**
- Use io.swagger:swagger-annotations for annotating operations and schemas
|swagger2|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false|
|ignoreAnyOfInEnum|Ignore anyOf keyword in enum| |false|
@@ -54,7 +57,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|- **true**
- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
- **false**
- The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
|licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org|
-|micronautVersion|Micronaut version, only >=3.0.0 versions are supported| |3.3.1|
+|micronautVersion|Micronaut version, only >=3.0.0 versions are supported| |3.4.3|
|modelPackage|package for generated models| |org.openapitools.model|
|openApiNullable|Enable OpenAPI Jackson Nullable library| |true|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java
index 1799a601750..0210abad942 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java
@@ -1,5 +1,7 @@
package org.openapitools.codegen.languages;
+import io.swagger.v3.oas.models.Operation;
+import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
@@ -10,11 +12,15 @@ import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.stream.Collectors;
import static org.openapitools.codegen.CodegenConstants.INVOKER_PACKAGE;
+import static org.openapitools.codegen.utils.StringUtils.camelize;
+import static org.openapitools.codegen.utils.StringUtils.underscore;
public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen implements BeanValidationFeatures, OptionalFeatures {
public static final String OPT_TITLE = "title";
@@ -35,6 +41,15 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
public static final String OPT_DATETIME_FORMAT = "datetimeFormat";
public static final String OPT_REACTIVE = "reactive";
public static final String OPT_WRAP_IN_HTTP_RESPONSE = "wrapInHttpResponse";
+ public static final String OPT_APPLICATION_NAME = "applicationName";
+ public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS = "generateSwaggerAnnotations";
+ public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1 = "swagger1";
+ public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2 = "swagger2";
+ public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_TRUE = "true";
+ public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_FALSE = "false";
+ public static final String OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG = "generateOperationOnlyForFirstTag";
+
+ protected final Logger LOGGER = LoggerFactory.getLogger(JavaMicronautAbstractCodegen.class);
protected String title;
protected boolean useBeanValidation;
@@ -46,6 +61,9 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
protected String micronautVersion;
protected boolean reactive;
protected boolean wrapInHttpResponse;
+ protected String appName;
+ protected String generateSwaggerAnnotations;
+ protected boolean generateOperationOnlyForFirstTag;
public static final String CONTENT_TYPE_APPLICATION_FORM_URLENCODED = "application/x-www-form-urlencoded";
public static final String CONTENT_TYPE_APPLICATION_JSON = "application/json";
@@ -64,18 +82,24 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
visitable = false;
buildTool = OPT_BUILD_ALL;
testTool = OPT_TEST_JUNIT;
- outputFolder = "generated-code/java-micronaut-client";
+ outputFolder = this instanceof JavaMicronautClientCodegen ?
+ "generated-code/java-micronaut-client" : "generated-code/java-micronaut";
apiPackage = "org.openapitools.api";
modelPackage = "org.openapitools.model";
invokerPackage = "org.openapitools";
- artifactId = "openapi-micronaut";
+ artifactId = this instanceof JavaMicronautClientCodegen ?
+ "openapi-micronaut-client" : "openapi-micronaut";
embeddedTemplateDir = templateDir = "java-micronaut";
apiDocPath = "docs/apis";
modelDocPath = "docs/models";
dateLibrary = OPT_DATE_LIBRARY_JAVA8;
- micronautVersion = "3.3.1";
+ micronautVersion = "3.4.3";
reactive = true;
wrapInHttpResponse = false;
+ appName = artifactId;
+ generateSwaggerAnnotations = this instanceof JavaMicronautClientCodegen ?
+ OPT_GENERATE_SWAGGER_ANNOTATIONS_FALSE : OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2;
+ generateOperationOnlyForFirstTag = this instanceof JavaMicronautServerCodegen;
// Set implemented features for user information
modifyFeatureSet(features -> features
@@ -106,12 +130,15 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
cliOptions.add(new CliOption(OPT_TITLE, "Client service name").defaultValue(title));
cliOptions.add(new CliOption(OPT_MICRONAUT_VERSION, "Micronaut version, only >=3.0.0 versions are supported").defaultValue(micronautVersion));
+ cliOptions.add(new CliOption(OPT_APPLICATION_NAME, "Micronaut application name (Defaults to the " + CodegenConstants.ARTIFACT_ID + " value)").defaultValue(appName));
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations", useBeanValidation));
cliOptions.add(CliOption.newBoolean(USE_OPTIONAL, "Use Optional container for optional parameters", useOptional));
cliOptions.add(CliOption.newBoolean(OPT_VISITABLE, "Generate visitor for subtypes with a discriminator", visitable));
cliOptions.add(CliOption.newBoolean(OPT_REQUIRED_PROPERTIES_IN_CONSTRUCTOR, "Allow only to create models with all the required properties provided in constructor", requiredPropertiesInConstructor));
cliOptions.add(CliOption.newBoolean(OPT_REACTIVE, "Make the responses use Reactor Mono as wrapper", reactive));
cliOptions.add(CliOption.newBoolean(OPT_WRAP_IN_HTTP_RESPONSE, "Wrap the response in HttpResponse object", wrapInHttpResponse));
+ cliOptions.add(CliOption.newBoolean(OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG, "When false, the operation method will be duplicated in each of the tags if multiple tags are assigned to this operation. " +
+ "If true, each operation will be generated only once in the first assigned tag.", generateOperationOnlyForFirstTag));
CliOption buildToolOption = new CliOption(OPT_BUILD, "Specify for which build tool to generate files").defaultValue(buildTool);
Map buildToolOptionMap = new HashMap<>();
@@ -128,6 +155,15 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
testToolOption.setEnum(testToolOptionMap);
cliOptions.add(testToolOption);
+ CliOption generateSwaggerAnnotationsOption = new CliOption(OPT_GENERATE_SWAGGER_ANNOTATIONS, "Specify if you want to generate swagger annotations and which version").defaultValue(generateSwaggerAnnotations);
+ Map generateSwaggerAnnotationsOptionMap = new HashMap<>();
+ generateSwaggerAnnotationsOptionMap.put(OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1, "Use io.swagger:swagger-annotations for annotating operations and schemas");
+ generateSwaggerAnnotationsOptionMap.put(OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2, "Use io.swagger.core.v3:swagger-annotations for annotating operations and schemas");
+ generateSwaggerAnnotationsOptionMap.put(OPT_GENERATE_SWAGGER_ANNOTATIONS_TRUE, "Equivalent to \"" + OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2 + "\"");
+ generateSwaggerAnnotationsOptionMap.put(OPT_GENERATE_SWAGGER_ANNOTATIONS_FALSE, "Do not generate swagger annotations");
+ generateSwaggerAnnotationsOption.setEnum(generateSwaggerAnnotationsOptionMap);
+ cliOptions.add(generateSwaggerAnnotationsOption);
+
cliOptions.add(new CliOption(OPT_DATE_FORMAT, "Specify the format pattern of date as a string"));
cliOptions.add(new CliOption(OPT_DATETIME_FORMAT, "Specify the format pattern of date-time as a string"));
@@ -168,6 +204,12 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
additionalProperties.put(OPT_MICRONAUT_VERSION, micronautVersion);
}
+ if (additionalProperties.containsKey(OPT_APPLICATION_NAME)) {
+ appName = (String) additionalProperties.get(OPT_APPLICATION_NAME);
+ } else {
+ additionalProperties.put(OPT_APPLICATION_NAME, artifactId);
+ }
+
// Get boolean properties
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
@@ -199,6 +241,11 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
}
writePropertyBack(OPT_WRAP_IN_HTTP_RESPONSE, wrapInHttpResponse);
+ if (additionalProperties.containsKey(OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG)) {
+ this.generateOperationOnlyForFirstTag = convertPropertyToBoolean(OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG);
+ }
+ writePropertyBack(OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG, generateOperationOnlyForFirstTag);
+
// Get enum properties
if (additionalProperties.containsKey(OPT_BUILD)) {
switch ((String) additionalProperties.get(OPT_BUILD)) {
@@ -230,6 +277,29 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
additionalProperties.put("isTestSpock", true);
}
+ if (additionalProperties.containsKey(OPT_GENERATE_SWAGGER_ANNOTATIONS)) {
+ String value = String.valueOf(additionalProperties.get(OPT_GENERATE_SWAGGER_ANNOTATIONS));
+ switch (value) {
+ case OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1:
+ this.generateSwaggerAnnotations = OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1;
+ break;
+ case OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2:
+ case OPT_GENERATE_SWAGGER_ANNOTATIONS_TRUE:
+ this.generateSwaggerAnnotations = OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2;
+ break;
+ case OPT_GENERATE_SWAGGER_ANNOTATIONS_FALSE:
+ this.generateSwaggerAnnotations = OPT_GENERATE_SWAGGER_ANNOTATIONS_FALSE;
+ break;
+ default:
+ throw new RuntimeException("Value \"" + value + "\" for the " + OPT_GENERATE_SWAGGER_ANNOTATIONS + " parameter is unsupported or misspelled");
+ }
+ }
+ if (OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1.equals(this.generateSwaggerAnnotations)) {
+ additionalProperties.put("generateSwagger1Annotations", true);
+ } else if (OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2.equals(this.generateSwaggerAnnotations)) {
+ additionalProperties.put("generateSwagger2Annotations", true);
+ }
+
// Add all the supporting files
String resourceFolder = projectFolder + "/resources";
supportingFiles.add(new SupportingFile("common/configuration/application.yml.mustache", resourceFolder, "application.yml").doNotOverwrite());
@@ -372,6 +442,24 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
return visitable;
}
+ @Override
+ public String sanitizeTag(String tag) {
+ // Skip sanitization to get the original tag name in the addOperationToGroup() method.
+ // Inside that method tag is manually sanitized.
+ return tag;
+ }
+
+ @Override
+ public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation
+ co, Map> operations) {
+ if (generateOperationOnlyForFirstTag && !co.tags.get(0).getName().equals(tag)) {
+ // This is not the first assigned to this operation tag;
+ return;
+ }
+
+ super.addOperationToGroup(super.sanitizeTag(tag), resourcePath, operation, co, operations);
+ }
+
@Override
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) {
objs = super.postProcessOperationsWithModels(objs, allModels);
@@ -445,6 +533,14 @@ public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen i
return objs;
}
+ @Override
+ public CodegenModel fromModel(String name, Schema model) {
+ CodegenModel codegenModel = super.fromModel(name, model);
+ codegenModel.imports.remove("ApiModel");
+ codegenModel.imports.remove("ApiModelProperty");
+ return codegenModel;
+ }
+
@Override
public Map postProcessAllModels(Map objs) {
objs = super.postProcessAllModels(objs);
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautClientCodegen.java
index 76dc4fe4ae8..6a530c3af51 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautClientCodegen.java
@@ -5,14 +5,10 @@ import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class JavaMicronautClientCodegen extends JavaMicronautAbstractCodegen {
- private final Logger LOGGER = LoggerFactory.getLogger(JavaMicronautClientCodegen.class);
-
public static final String OPT_CONFIGURE_AUTH = "configureAuth";
public static final String NAME = "java-micronaut-client";
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java
index 6d1a3b3785b..7ff2fb2a1f3 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautServerCodegen.java
@@ -7,8 +7,6 @@ import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.utils.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Collections;
import java.util.List;
@@ -29,8 +27,6 @@ public class JavaMicronautServerCodegen extends JavaMicronautAbstractCodegen {
public static final String DENY_ALL_ROLE_KEY = "denyAll()";
public static final String DENY_ALL_ROLE = "SecurityRule.DENY_ALL";
- private final Logger LOGGER = LoggerFactory.getLogger(JavaMicronautServerCodegen.class);
-
public static final String NAME = "java-micronaut-server";
protected String controllerPackage = "org.openapitools.controller";
@@ -47,7 +43,7 @@ public class JavaMicronautServerCodegen extends JavaMicronautAbstractCodegen {
public JavaMicronautServerCodegen() {
super();
- title = "OpenAPI Micronaut Server";;
+ title = "OpenAPI Micronaut Server";
apiPackage = "org.openapitools.api";
apiDocPath = "docs/controllers";
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/client/api.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/client/api.mustache
index 317d6afb92d..ff04dfd1f68 100644
--- a/modules/openapi-generator/src/main/resources/java-micronaut/client/api.mustache
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/client/api.mustache
@@ -14,7 +14,8 @@ import reactor.core.publisher.Mono;
{{#wrapInHttpResponse}}
import io.micronaut.http.HttpResponse;
{{/wrapInHttpResponse}}
-{{#imports}}import {{import}};
+{{#imports}}
+import {{import}};
{{/imports}}
import javax.annotation.Generated;
{{^fullJavaUtil}}
@@ -26,37 +27,27 @@ import java.util.Map;
import javax.validation.Valid;
import javax.validation.constraints.*;
{{/useBeanValidation}}
+{{#generateSwagger1Annotations}}
+import io.swagger.annotations.*;
+{{/generateSwagger1Annotations}}
+{{#generateSwagger2Annotations}}
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+{{/generateSwagger2Annotations}}
{{>common/generatedAnnotation}}
-@Client("${base-path}")
+@Client("${{openbrace}}{{{applicationName}}}-base-path{{closebrace}}")
public interface {{classname}} {
{{#operations}}
{{#operation}}
- /**
- {{#summary}}
- * {{summary}}
- {{/summary}}
- {{#notes}}
- * {{notes}}
- {{/notes}}
- {{^summary}}
- {{^notes}}
- * {{nickname}}
- {{/notes}}
- {{/summary}}
- *
- {{#allParams}}
- * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
- {{/allParams}}
- {{#returnType}}
- * @return {{returnType}}
- {{/returnType}}
- {{#externalDocs}}
- * {{description}}
- * @see {{summary}} Documentation
-{{/externalDocs}}
- */
- @{{#lambda.pascalcase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.pascalcase}}(uri="{{{path}}}")
+{{>common/operationAnnotations}}{{!
+}} @{{#lambda.pascalcase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.pascalcase}}(uri="{{{path}}}")
{{#vendorExtensions.x-content-type}}
@Produces(value={"{{vendorExtensions.x-content-type}}"})
{{/vendorExtensions.x-content-type}}
@@ -71,6 +62,7 @@ public interface {{classname}} {
{{>common/operationReturnType}} {{nickname}}({{#allParams}}
{{>client/params/queryParams}}{{>client/params/pathParams}}{{>client/params/headerParams}}{{>client/params/bodyParams}}{{>client/params/formParams}}{{>client/params/cookieParams}}{{^-last}}, {{/-last}}{{#-last}}
{{/-last}}{{/allParams}});
+
{{/operation}}
{{/operations}}
}
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/application.yml.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/application.yml.mustache
index f031ba413c5..56f64f10256 100644
--- a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/application.yml.mustache
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/application.yml.mustache
@@ -1,76 +1,77 @@
{{!CLIENT CONFIGURATION}}
{{#client}}
-base-path: "{{{basePath}}}/"
+{{{applicationName}}}-base-path: "{{{basePath}}}"
micronaut:
- application:
- name: {{artifactId}}
- {{!
- configure authorization from the parameters
- }}{{#configureAuth}}security:
- oauth2:
- clients:{{#oauthMethods}}
- {{{name}}}:
- grant-type: {{#isCode}}authorization_code{{/isCode}}{{#isImplicit}}implicit{{/isImplicit}}{{#isPassword}}password{{/isPassword}}{{#isApplication}}client_credentials{{/isApplication}}
- scopes: [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]{{!authorization url}}{{#authorizationUrl}}
- authorization:
- url: "{{{authorizationUrl}}}"{{/authorizationUrl}}{{!token url}}{{#tokenUrl}}
- token:
- auth-method: client_secret_basic
- url: "{{{tokenUrl}}}"{{/tokenUrl}}{{!refreshUrl is not used}}
- # TODO Fill in the parameters for {{{name}}} authorization if needed
- # client-id:
- # client-secret:{{/oauthMethods}}{{/configureAuth}}{{!
- do not configure authorization, but leave hints for user
- }}{{^configureAuth}}# TODO configure security features
- security:
- oauth2:
- clients:
- # An example of how oauth client is filled
- # name:
- # grant-type: authorization_code | client_credentials
- # scopes: []
- # token:
- # auth-method: client_secret_basic
- # url: "https://"
- # client-id:
- # client-secret
- # An example of how to apply other authorization methods
- # authentication: bearer | cookie | session{{/configureAuth}}
+ application:
+ name: {{{applicationName}}}{{!
+ configure authorization from the parameters
+ }}{{#configureAuth}}
+ security:
+ oauth2:
+ clients:{{#oauthMethods}}
+ {{{name}}}:
+ grant-type: {{#isCode}}authorization_code{{/isCode}}{{#isImplicit}}implicit{{/isImplicit}}{{#isPassword}}password{{/isPassword}}{{#isApplication}}client_credentials{{/isApplication}}
+ scopes: [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]{{!authorization url}}{{#authorizationUrl}}
+ authorization:
+ url: "{{{authorizationUrl}}}"{{/authorizationUrl}}{{!token url}}{{#tokenUrl}}
+ token:
+ auth-method: client_secret_basic
+ url: "{{{tokenUrl}}}"{{/tokenUrl}}{{!refreshUrl is not used}}
+ # TODO Fill in the parameters for {{{name}}} authorization if needed
+ # client-id:
+ # client-secret:{{/oauthMethods}}{{/configureAuth}}{{!
+ do not configure authorization, but leave hints for user
+ }}{{^configureAuth}}
+ # TODO configure security features
+ security:
+ oauth2:
+ clients:
+ # An example of how oauth client is filled
+ # name:
+ # grant-type: authorization_code | client_credentials
+ # scopes: []
+ # token:
+ # auth-method: client_secret_basic
+ # url: "https://"
+ # client-id:
+ # client-secret:
+ # An example of how to apply other authorization methods
+ # authentication: bearer | cookie | session{{/configureAuth}}
{{#configureAuth}}security:
- {{!api key authorization}}api-key-auth:{{#authMethods}}{{#isApiKey}}
- {{{name}}}:
- location: {{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInCookie}}cookie{{/isKeyInCookie}}
- param-name: "{{{keyParamName}}}"
- # TODO fill in api key for {{{name}}} authorization
- api-key:
- {{/isApiKey}}{{/authMethods}}
- {{!basic authorization}}basic-auth:{{#authMethods}}{{#isBasic}}
- {{{name}}}:
- # TODO fill in credentials for {{{name}}} authorization
- username:
- password:
+ {{!api key authorization}}api-key-auth:{{#authMethods}}{{#isApiKey}}
+ {{{name}}}:
+ location: {{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInCookie}}cookie{{/isKeyInCookie}}
+ param-name: "{{{keyParamName}}}"
+ # TODO fill in api key for {{{name}}} authorization
+ api-key:
+ {{/isApiKey}}{{/authMethods}}
+ {{!basic authorization}}basic-auth:{{#authMethods}}{{#isBasic}}
+ {{{name}}}:
+ # TODO fill in credentials for {{{name}}} authorization
+ username:
+ password:
{{/isBasic}}{{/authMethods}}{{/configureAuth}}
{{/client}}
{{!SERVER CONFIGURATION}}
{{#server}}
micronaut:
- application:
- name: {{artifactId}}
- server:
- port: 8080{{#contextPath}}
- context-path: "{{{contextPath}}}"{{/contextPath}}
- security:
- # authentication: bearer | cookie | session | idtoken
+ application:
+ name: {{{applicationName}}}
+ server:
+ port: 8080
+ context-path: "{{{contextPath}}}/"
+ security:
+ # authentication: bearer | cookie | session | idtoken
{{/server}}
jackson:
- serialization:
- writeEnumsUsingToString: true
- writeDatesAsTimestamps: false
- deserialization:
- readEnumsUsingToString: true
- failOnUnknownProperties: false
- failOnInvalidSubtype: false
+ serialization:
+ writeEnumsUsingToString: true
+ writeDatesAsTimestamps: false
+ deserialization:
+ readEnumsUsingToString: true
+ failOnUnknownProperties: false
+ failOnInvalidSubtype: false
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/gradle/build.gradle.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/gradle/build.gradle.mustache
index 2db990f1216..5f6fbfd00ef 100644
--- a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/gradle/build.gradle.mustache
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/gradle/build.gradle.mustache
@@ -43,7 +43,12 @@ dependencies {
{{#reactive}}
implementation("io.micronaut.reactor:micronaut-reactor")
{{/reactive}}
- implementation("io.swagger:swagger-annotations:1.5.9")
+ {{#generateSwagger1Annotations}}
+ implementation("io.swagger:swagger-annotations:1.6.5")
+ {{/generateSwagger1Annotations}}
+ {{#generateSwagger2Annotations}}
+ implementation("io.swagger.core.v3:swagger-annotations:2.2.0")
+ {{/generateSwagger2Annotations}}
runtimeOnly("ch.qos.logback:logback-classic")
}
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache
index 774748eaaa2..e8da59a73ff 100644
--- a/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/common/configuration/pom.xml.mustache
@@ -22,7 +22,12 @@
{{{micronautVersion}}}
{{groupId}}.Application
netty
- 1.5.21
+ {{#generateSwagger1Annotations}}
+ 1.6.5
+ {{/generateSwagger1Annotations}}
+ {{#generateSwagger2Annotations}}
+ 2.2.0
+ {{/generateSwagger2Annotations}}
@@ -122,11 +127,20 @@
logback-classic
runtime
+ {{#generateSwagger1Annotations}}
io.swagger
swagger-annotations
${swagger-annotations-version}
+ {{/generateSwagger1Annotations}}
+ {{#generateSwagger2Annotations}}
+
+ io.swagger.core.v3
+ swagger-annotations
+ ${swagger-annotations-version}
+
+ {{/generateSwagger2Annotations}}
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/common/model/model.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/common/model/model.mustache
index b016c0bcbb1..ed44430d357 100644
--- a/modules/openapi-generator/src/main/resources/java-micronaut/common/model/model.mustache
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/common/model/model.mustache
@@ -33,6 +33,13 @@ import javax.validation.Valid;
{{/useBeanValidation}}
import io.micronaut.core.annotation.*;
import javax.annotation.Generated;
+{{#generateSwagger1Annotations}}
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+{{/generateSwagger1Annotations}}
+{{#generateSwagger2Annotations}}
+import io.swagger.v3.oas.annotations.media.Schema;
+{{/generateSwagger2Annotations}}
{{#models}}
{{#model}}
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/common/model/pojo.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/common/model/pojo.mustache
index ebae2af0124..8292f413b28 100644
--- a/modules/openapi-generator/src/main/resources/java-micronaut/common/model/pojo.mustache
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/common/model/pojo.mustache
@@ -2,7 +2,12 @@
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/
{{#description}}
+ {{#generateSwagger1Annotations}}
@ApiModel(description = "{{{description}}}")
+ {{/generateSwagger1Annotations}}
+ {{#generateSwagger2Annotations}}
+@Schema({{#name}}name = "{{name}}", {{/name}}description = "{{{description}}}")
+ {{/generateSwagger2Annotations}}
{{/description}}
{{#jackson}}
@JsonPropertyOrder({
@@ -177,7 +182,13 @@ Declare the class with extends and implements
{{/maximum}}
* @return {{name}}
**/
-{{>common/model/beanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
+{{>common/model/beanValidation}}{{!
+ }}{{#generateSwagger1Annotations}}
+ @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
+ {{/generateSwagger1Annotations}}
+ {{#generateSwagger2Annotations}}
+ @Schema(name = "{{{baseName}}}", {{#isReadOnly}}accessMode = Schema.AccessMode.READ_ONLY, {{/isReadOnly}}{{#example}}example = "{{{.}}}", {{/example}}{{#description}}description = "{{{.}}}", {{/description}}required = {{{required}}})
+ {{/generateSwagger2Annotations}}
{{#vendorExtensions.x-extra-annotation}}
{{{vendorExtensions.x-extra-annotation}}}
{{/vendorExtensions.x-extra-annotation}}
@@ -226,7 +237,7 @@ Declare the class with extends and implements
{{#jackson}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}
{{>common/model/jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}}{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}}
-{{/vendorExtensions.x-setter-extra-annotation}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
+{{/vendorExtensions.x-setter-extra-annotation}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
{{#vendorExtensions.x-is-jackson-optional-nullable}}
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});
{{/vendorExtensions.x-is-jackson-optional-nullable}}
@@ -364,7 +375,9 @@ Declare the class with extends and implements
* @param the return type of the visitor
* @return the result from the visitor
*/
- public abstract T accept(Visitor visitor);
+ public T accept(Visitor visitor) {
+ return visitor.visit{{classname}}(this);
+ }
/**
* A {{classname}} visitor implementation allows visiting the various {{classname}} types.
@@ -375,6 +388,7 @@ Declare the class with extends and implements
{{#discriminator.mappedModels}}
R visit{{modelName}}({{modelName}} value);
{{/discriminator.mappedModels}}
+ R visit{{classname}}({{classname}} value);
}
{{/discriminator}}
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/common/operationAnnotations.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/common/operationAnnotations.mustache
new file mode 100644
index 00000000000..b0bd1a43f4b
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/common/operationAnnotations.mustache
@@ -0,0 +1,102 @@
+ /**
+ {{#summary}}
+ * {{summary}}
+ {{/summary}}
+ {{#notes}}
+ * {{notes}}
+ {{/notes}}
+ {{^summary}}
+ {{^notes}}
+ * {{nickname}}
+ {{/notes}}
+ {{/summary}}
+ *
+ {{#allParams}}
+ * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
+ {{/allParams}}
+ {{#returnType}}
+ * @return {{returnType}}
+ {{/returnType}}
+ {{#externalDocs}}
+ * {{description}}
+ * @see {{summary}} Documentation
+ {{/externalDocs}}
+ */
+ {{!openapi annotations for info}}
+ {{#generateSwagger1Annotations}}
+ @ApiOperation(
+ value = "{{{summary}}}",
+ nickname = "{{{operationId}}}"{{#notes}},
+ notes = "{{{notes}}}"{{/notes}}{{#returnBaseType}},
+ response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}},
+ responseContainer = "{{{returnContainer}}}"{{/returnContainer}},
+ authorizations = {{openbrace}}{{#hasAuthMethods}}
+ {{#authMethods}}
+ {{#isOAuth}}
+ @Authorization(value = "{{name}}"{{#scopes.0}}, scopes = {
+ {{#scopes}}
+ @AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},{{/-last}}
+ {{/scopes}}
+ }{{/scopes.0}}){{^-last}},{{/-last}}
+ {{/isOAuth}}
+ {{^isOAuth}}
+ @Authorization(value = "{{name}}"){{^-last}},{{/-last}}
+ {{/isOAuth}}
+ {{/authMethods}}
+ {{/hasAuthMethods}}{{closebrace}},
+ tags = { {{#vendorExtensions.x-tags}}"{{tag}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-tags}} }
+ )
+ @ApiResponses(value = {{openbrace}}{{#responses}}
+ @ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}.class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}
+ {{closebrace}})
+ {{/generateSwagger1Annotations}}
+ {{#generateSwagger2Annotations}}
+ @Operation(
+ operationId = "{{{operationId}}}",
+ {{#summary}}
+ summary = "{{{.}}}",
+ {{/summary}}
+ {{#description}}
+ description= "{{{.}}}",
+ {{/description}}
+ {{#tags.1}}
+ {{!generate only when at least 2 tags}}
+ tags = { {{#tags}}"{{name}}"{{^-last}}, {{/-last}}{{/tags}} },
+ {{/tags.1}}
+ responses = {
+ {{#responses}}
+ @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = {
+ {{#produces}}
+ @Content(mediaType = "{{{mediaType}}}", schema = @Schema(implementation = {{{baseType}}}.class)){{^-last}},{{/-last}}
+ {{/produces}}
+ }{{/baseType}}){{^-last}},{{/-last}}
+ {{/responses}}
+ }{{#hasParams}},
+ parameters = {
+ {{#allParams}}
+ @Parameter(name = "{{paramName}}"{{#description}}, description = "{{{description}}}"{{/description}}{{#required}}, required = true{{/required}}){{^-last}},{{/-last}}
+ {{/allParams}}
+ }{{/hasParams}}{{#hasAuthMethods}},
+ security = {
+ {{#authMethods}}
+ @SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = { {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} }{{/isOAuth}}){{^-last}},{{/-last}}
+ {{/authMethods}}
+ }{{/hasAuthMethods}}
+ )
+ {{/generateSwagger2Annotations}}
+ {{#implicitHeadersParams.0}}
+ {{#generateSwagger2Annotations}}
+ @Parameters({
+ {{#implicitHeadersParams}}
+ @Parameter(name = "{{paramName}}"{{#description}}, description = "{{{description}}}"{{/description}}{{#required}}, required = true{{/required}}){{^-last}},{{/-last}}
+ {{/implicitHeadersParams}}
+ })
+ {{/generateSwagger2Annotations}}
+ {{#generateSwagger1Annotations}}
+ @ApiImplicitParams({
+ {{#implicitHeadersParams}}
+ @ApiImplicitParam(name = "{{{baseName}}}", value = "{{{description}}}", {{#required}}required = true,{{/required}} dataType = "{{{dataType}}}", paramType = "header"){{^-last}},{{/-last}}
+ {{/implicitHeadersParams}}
+ })
+ {{/generateSwagger1Annotations}}
+ {{/implicitHeadersParams.0}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/java-micronaut/server/controller.mustache b/modules/openapi-generator/src/main/resources/java-micronaut/server/controller.mustache
index 336177927e9..c98de1654c2 100644
--- a/modules/openapi-generator/src/main/resources/java-micronaut/server/controller.mustache
+++ b/modules/openapi-generator/src/main/resources/java-micronaut/server/controller.mustache
@@ -35,66 +35,33 @@ import java.util.Arrays;
import javax.validation.Valid;
import javax.validation.constraints.*;
{{/useBeanValidation}}
+{{#generateSwagger1Annotations}}
import io.swagger.annotations.*;
+{{/generateSwagger1Annotations}}
+{{#generateSwagger2Annotations}}
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+{{/generateSwagger2Annotations}}
{{>common/generatedAnnotation}}
{{^generateControllerAsAbstract}}
@Controller
{{/generateControllerAsAbstract}}
+{{#generateSwagger2Annotations}}
+@Tag(name = "{{{baseName}}}", description = {{#tagDescription}}"{{{.}}}"{{/tagDescription}}{{^tagDescription}}"The {{{baseName}}} API"{{/tagDescription}})
+{{/generateSwagger2Annotations}}
public {{#generateControllerAsAbstract}}abstract {{/generateControllerAsAbstract}}class {{classname}} {
{{#operations}}
{{#operation}}
- /**
- {{#summary}}
- * {{summary}}
- {{/summary}}
- {{#notes}}
- * {{notes}}
- {{/notes}}
- {{^summary}}
- {{^notes}}
- * {{nickname}}
- {{/notes}}
- {{/summary}}
- *
- {{#allParams}}
- * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
- {{/allParams}}
- {{#returnType}}
- * @return {{returnType}}
- {{/returnType}}
- {{#externalDocs}}
- * {{description}}
- * @see {{summary}} Documentation
- {{/externalDocs}}
- */
- {{!openapi annotations for info}}
- @ApiOperation(
- value = "{{{summary}}}",
- nickname = "{{{operationId}}}"{{#notes}},
- notes = "{{{notes}}}"{{/notes}}{{#returnBaseType}},
- response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}},
- responseContainer = "{{{returnContainer}}}"{{/returnContainer}},
- authorizations = {{openbrace}}{{#hasAuthMethods}}
- {{#authMethods}}
- {{#isOAuth}}
- @Authorization(value = "{{name}}"{{#scopes}}{{#-first}}, scopes = {
- {{#scopes}}
- @AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},{{/-last}}
- {{/scopes}}
- }{{/-first}}{{/scopes}}){{^-last}},{{/-last}}
- {{/isOAuth}}
- {{^isOAuth}}
- @Authorization(value = "{{name}}"){{^-last}},{{/-last}}
- {{/isOAuth}}
- {{/authMethods}}
- {{/hasAuthMethods}}{{closebrace}},
- tags={{openbrace}}{{#vendorExtensions.x-tags}}"{{tag}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-tags}}{{closebrace}})
- {{!openapi annotations for info about responses}}
- @ApiResponses(value = {{openbrace}}{{#responses}}
- @ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}.class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}{{closebrace}})
- {{!micronaut annotations}}
- @{{#lambda.pascalcase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.pascalcase}}(uri="{{{path}}}")
+{{>common/operationAnnotations}}{{!
+ micronaut annotations
+ }} @{{#lambda.pascalcase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.pascalcase}}(uri="{{{path}}}")
@Produces(value = {{openbrace}}{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}{{closebrace}})
{{#consumes.0}}
@Consumes(value = {{openbrace}}{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}{{closebrace}})
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/micronaut/MicronautServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/micronaut/MicronautServerCodegenTest.java
index 7a4e20c2392..4b1ad1db749 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/micronaut/MicronautServerCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/micronaut/MicronautServerCodegenTest.java
@@ -6,7 +6,6 @@ import io.swagger.v3.oas.models.servers.Server;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.TestUtils;
-import org.openapitools.codegen.languages.JavaMicronautAbstractCodegen;
import org.openapitools.codegen.languages.JavaMicronautServerCodegen;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -16,6 +15,7 @@ import static org.testng.Assert.assertEquals;
public class MicronautServerCodegenTest extends AbstractMicronautCodegenTest {
protected static String ROLES_EXTENSION_TEST_PATH = "src/test/resources/3_0/micronaut/roles-extension-test.yaml";
+ protected static String MULTI_TAGS_TEST_PATH = "src/test/resources/3_0/micronaut/multi-tags-test.yaml";
@Test
public void clientOptsUnicity() {
@@ -245,7 +245,6 @@ public class MicronautServerCodegenTest extends AbstractMicronautCodegenTest {
codegen.additionalProperties().put(JavaMicronautServerCodegen.OPT_WRAP_IN_HTTP_RESPONSE, "true");
String outputPath = generateFiles(codegen, PETSTORE_PATH, CodegenConstants.MODELS, CodegenConstants.APIS);
- // Constructor should have properties
String controllerPath = outputPath + "src/main/java/org/openapitools/controller/";
assertFileContains(controllerPath + "PetController.java", "Mono>");
}
@@ -257,7 +256,6 @@ public class MicronautServerCodegenTest extends AbstractMicronautCodegenTest {
codegen.additionalProperties().put(JavaMicronautServerCodegen.OPT_WRAP_IN_HTTP_RESPONSE, "false");
String outputPath = generateFiles(codegen, PETSTORE_PATH, CodegenConstants.MODELS, CodegenConstants.APIS);
- // Constructor should have properties
String controllerPath = outputPath + "src/main/java/org/openapitools/controller/";
assertFileContains(controllerPath + "PetController.java", "Mono");
assertFileNotContains(controllerPath + "PetController.java", "HttpResponse");
@@ -270,7 +268,6 @@ public class MicronautServerCodegenTest extends AbstractMicronautCodegenTest {
codegen.additionalProperties().put(JavaMicronautServerCodegen.OPT_WRAP_IN_HTTP_RESPONSE, "true");
String outputPath = generateFiles(codegen, PETSTORE_PATH, CodegenConstants.MODELS, CodegenConstants.APIS);
- // Constructor should have properties
String controllerPath = outputPath + "src/main/java/org/openapitools/controller/";
assertFileContains(controllerPath + "PetController.java", "HttpResponse");
assertFileNotContains(controllerPath + "PetController.java", "Mono");
@@ -283,10 +280,65 @@ public class MicronautServerCodegenTest extends AbstractMicronautCodegenTest {
codegen.additionalProperties().put(JavaMicronautServerCodegen.OPT_WRAP_IN_HTTP_RESPONSE, "false");
String outputPath = generateFiles(codegen, PETSTORE_PATH, CodegenConstants.MODELS, CodegenConstants.APIS);
- // Constructor should have properties
String controllerPath = outputPath + "src/main/java/org/openapitools/controller/";
assertFileContains(controllerPath + "PetController.java", "Pet");
assertFileNotContains(controllerPath + "PetController.java", "Mono");
assertFileNotContains(controllerPath + "PetController.java", "HttpResponse");
}
+
+ @Test
+ public void doGenerateOperationOnlyForFirstTag() {
+ JavaMicronautServerCodegen codegen = new JavaMicronautServerCodegen();
+ String outputPath = generateFiles(codegen, MULTI_TAGS_TEST_PATH, CodegenConstants.MODELS,
+ CodegenConstants.APIS, CodegenConstants.API_TESTS);
+
+ String controllerPath = outputPath + "src/main/java/org/openapitools/controller/";
+ String controllerTestPath = outputPath + "/src/test/java/org/openapitools/controller/";
+
+ // Verify files are generated only for the required tags
+ assertFileExists(controllerPath + "AuthorsController.java");
+ assertFileExists(controllerPath + "BooksController.java");
+ assertFileNotExists(controllerPath + "SearchController.java");
+
+ // Verify the same for test files
+ assertFileExists(controllerTestPath + "AuthorsControllerTest.java");
+ assertFileExists(controllerTestPath + "BooksControllerTest.java");
+ assertFileNotExists(controllerTestPath + "SearchControllerTest.java");
+
+ // Verify all the methods are generated only ones
+ assertFileContains(controllerPath + "AuthorsController.java",
+ "authorSearchGet", "getAuthor", "getAuthorBooks");
+ assertFileContains(controllerPath + "BooksController.java",
+ "bookCreateEntryPost", "bookSearchGet", "bookSendReviewPost", "getBook", "isBookAvailable");
+ assertFileNotContains(controllerPath + "BooksController.java", "getAuthorBooks");
+ }
+
+ @Test
+ public void doRepeatOperationForAllTags() {
+ JavaMicronautServerCodegen codegen = new JavaMicronautServerCodegen();
+ codegen.additionalProperties().put(JavaMicronautServerCodegen.OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG, "false");
+ String outputPath = generateFiles(codegen, MULTI_TAGS_TEST_PATH, CodegenConstants.MODELS,
+ CodegenConstants.APIS, CodegenConstants.API_TESTS);
+
+ String controllerPath = outputPath + "src/main/java/org/openapitools/controller/";
+ String controllerTestPath = outputPath + "/src/test/java/org/openapitools/controller/";
+
+ // Verify all the tags created
+ assertFileExists(controllerPath + "AuthorsController.java");
+ assertFileExists(controllerPath + "BooksController.java");
+ assertFileExists(controllerPath + "SearchController.java");
+
+ // Verify the same for test files
+ assertFileExists(controllerTestPath + "AuthorsControllerTest.java");
+ assertFileExists(controllerTestPath + "BooksControllerTest.java");
+ assertFileExists(controllerTestPath + "SearchControllerTest.java");
+
+ // Verify all the methods are repeated for each of the tags
+ assertFileContains(controllerPath + "AuthorsController.java",
+ "authorSearchGet", "getAuthor", "getAuthorBooks");
+ assertFileContains(controllerPath + "BooksController.java",
+ "bookCreateEntryPost", "bookSearchGet", "bookSendReviewPost", "getBook", "isBookAvailable", "getAuthorBooks");
+ assertFileContains(controllerPath + "SearchController.java",
+ "authorSearchGet", "bookSearchGet");
+ }
}
diff --git a/modules/openapi-generator/src/test/resources/3_0/micronaut/multi-tags-test.yaml b/modules/openapi-generator/src/test/resources/3_0/micronaut/multi-tags-test.yaml
new file mode 100644
index 00000000000..1053ab885e8
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/micronaut/multi-tags-test.yaml
@@ -0,0 +1,155 @@
+openapi: 3.0.0
+info:
+ description: This is a test api description where operations have multiple tags
+ version: 1.0.0
+ title: Library
+ license:
+ name: Apache-2.0
+ url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
+tags:
+ - {name: books, description: Everything about books}
+ - {name: authors, description: Everything about book authors}
+ - {name: search, description: Tags for useful searching}
+paths:
+ /book/{bookName}:
+ get:
+ tags: [books]
+ summary: Get a book by name
+ operationId: getBook
+ parameters:
+ - {name: bookName, in: path, required: true, schema: {type: string}}
+ responses:
+ '200':
+ description: success
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/Book" }
+ /book/availability/{bookName}:
+ get:
+ tags: [books]
+ summary: Check book availability
+ operationId: isBookAvailable
+ parameters:
+ - { name: bookName, in: path, required: true, schema: { type: string, example: "Book 1" } }
+ responses:
+ '200':
+ description: success
+ content:
+ text/plain:
+ schema: { $ref: "#/components/schemas/BookAvailability" }
+ /book/search:
+ get:
+ tags: [books, search]
+ summary: Search for a book
+ parameters:
+ - {name: bookName, in: query, required: false, schema: {type: string, example: "Book 2"}}
+ - {name: ISBN, in: query, required: false, schema: {type: string, pattern: "[0-9]{13}", example: "0123456789123"}}
+ - {name: published, in: query, required: false, schema: {type: string, format: date}}
+ - {name: minNumPages, in: query, required: false, schema: {type: integer, format: int32, minimum: 1, maximum: 1000}}
+ - {name: minReadTime, in: query, required: false, schema: {type: number, format: float, minimum: 1, example: 5.7}}
+ - {name: description, in: query, required: false, schema: {type: string, minLength: 4, nullable: true}}
+ - {name: preferences, in: cookie, required: false, schema: {type: string}}
+ - {name: geoLocation, in: header, required: false, schema: {type: string}}
+ responses:
+ '200':
+ description: success
+ content:
+ application/json:
+ schema: { type: array, items: { $ref: "#/components/schemas/Book" } }
+ /book/sendReview:
+ post:
+ tags: [books]
+ summary: Send a review to a book
+ parameters:
+ - {name: bookName, in: query, required: true, schema: {type: string, nullable: false}}
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema: {$ref: "#/components/schemas/Review"}
+ responses:
+ '200':
+ description: success
+ /book/createEntry:
+ post:
+ tags: [books]
+ summary: Create a new entry for a book
+ requestBody:
+ content:
+ application/json: { schema: { $ref: "#/components/schemas/Book" } }
+ application/xml: { schema: { $ref: "#/components/schemas/Book" } }
+ responses:
+ '200':
+ description: success
+ content:
+ application/json: { schema: { $ref: "#/components/schemas/Book" } }
+ application/xml: { schema: { $ref: "#/components/schemas/Book" } }
+ /author/{authorName}:
+ get:
+ tags: [authors]
+ summary: Get an author by name
+ operationId: getAuthor
+ parameters:
+ - {name: authorName, in: path, required: true, schema: {type: string}}
+ responses:
+ '200':
+ description: success
+ content:
+ application/json:
+ schema: { $ref: "#/components/schemas/Author" }
+ /author/search:
+ get:
+ tags: [authors, search]
+ summary: Search for an author
+ parameters:
+ - {name: authorName, in: query, required: false, schema: {type: string, example: "Eric Berne"}}
+ - {name: approximateYearBorn, in: query, required: false, schema: {type: int, example: 1990}}
+ responses:
+ '200':
+ description: success
+ content:
+ application/json:
+ schema: { type: array, items: { $ref: "#/components/schemas/Author" } }
+ /author/{authorName}/getBooks:
+ get:
+ tags: [authors, books]
+ summary: Get books by author name
+ operationId: getAuthorBooks
+ parameters:
+ - {name: authorName, in: path, required: true, schema: {type: string}}
+ responses:
+ '200':
+ description: success
+ content:
+ application/json:
+ schema: { type: array, items: { $ref: "#/components/schemas/Book" } }
+components:
+ schemas:
+ Book:
+ title: Book
+ description: book instance
+ type: object
+ properties:
+ name: {type: string}
+ availability: {$ref: "#/components/schemas/BookAvailability"}
+ pages: {type: integer, format: int32, minimum: 1}
+ readTime: {type: number, format: float, minimum: 0, exclusiveMinimum: true}
+ author: {$ref: "#/components/schemas/Author"}
+ required: ["name", "availability"]
+ default:
+ name: "Bob's Adventures"
+ availability: "available"
+ BookAvailability:
+ type: string
+ enum: ["available", "not available", "reserved"]
+ default: "not available"
+ Review:
+ type: object
+ properties:
+ rating: {type: integer, minimum: 1, maximum: 5, default: 2}
+ description: {type: string, maxLength: 200}
+ required: [rating]
+ Author:
+ type: object
+ properties:
+ name: {type: string, pattern: "[a-zA-z ]+"}
+ yearBorn: {type: int, minimum: 0, maximum: 2030}
diff --git a/samples/client/petstore/java-micronaut-client/build.gradle b/samples/client/petstore/java-micronaut-client/build.gradle
index c74021320cc..b5a06b17985 100644
--- a/samples/client/petstore/java-micronaut-client/build.gradle
+++ b/samples/client/petstore/java-micronaut-client/build.gradle
@@ -30,7 +30,6 @@ dependencies {
implementation("io.micronaut.security:micronaut-security")
implementation("io.micronaut.security:micronaut-security-oauth2")
implementation("io.micronaut.reactor:micronaut-reactor")
- implementation("io.swagger:swagger-annotations:1.5.9")
runtimeOnly("ch.qos.logback:logback-classic")
}
diff --git a/samples/client/petstore/java-micronaut-client/gradle.properties b/samples/client/petstore/java-micronaut-client/gradle.properties
index 6d5febf8520..76fce170509 100644
--- a/samples/client/petstore/java-micronaut-client/gradle.properties
+++ b/samples/client/petstore/java-micronaut-client/gradle.properties
@@ -1 +1 @@
-micronautVersion=3.3.1
\ No newline at end of file
+micronautVersion=3.4.3
\ No newline at end of file
diff --git a/samples/client/petstore/java-micronaut-client/pom.xml b/samples/client/petstore/java-micronaut-client/pom.xml
index 45ce5f36ccb..b684da89c82 100644
--- a/samples/client/petstore/java-micronaut-client/pom.xml
+++ b/samples/client/petstore/java-micronaut-client/pom.xml
@@ -10,7 +10,7 @@
io.micronaut
micronaut-parent
- 3.3.1
+ 3.4.3
@@ -19,10 +19,9 @@
UTF-8
- 3.3.1
+ 3.4.3
org.openapitools.Application
netty
- 1.5.21
@@ -99,11 +98,6 @@
logback-classic
runtime
-
- io.swagger
- swagger-annotations
- ${swagger-annotations-version}
-
diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/AnotherFakeApi.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/AnotherFakeApi.java
index 1656631481a..347defb034a 100644
--- a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/AnotherFakeApi.java
+++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/AnotherFakeApi.java
@@ -28,7 +28,7 @@ import javax.validation.Valid;
import javax.validation.constraints.*;
@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen")
-@Client("${base-path}")
+@Client("${petstore-micronaut-base-path}")
public interface AnotherFakeApi {
/**
* To test special tags
@@ -43,4 +43,5 @@ public interface AnotherFakeApi {
Mono call123testSpecialTags(
@Body @NotNull @Valid ModelClient _body
);
+
}
diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeApi.java
index 4fdbd1dc1a8..c09015a9935 100644
--- a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeApi.java
+++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeApi.java
@@ -36,7 +36,7 @@ import javax.validation.Valid;
import javax.validation.constraints.*;
@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen")
-@Client("${base-path}")
+@Client("${petstore-micronaut-base-path}")
public interface FakeApi {
/**
* creates an XmlItem
@@ -50,6 +50,7 @@ public interface FakeApi {
Mono createXmlItem(
@Body @NotNull @Valid XmlItem xmlItem
);
+
/**
* Test serialization of outer boolean types
*
@@ -62,6 +63,7 @@ public interface FakeApi {
Mono fakeOuterBooleanSerialize(
@Body @Nullable Boolean _body
);
+
/**
* Test serialization of object with outer number type
*
@@ -74,6 +76,7 @@ public interface FakeApi {
Mono fakeOuterCompositeSerialize(
@Body @Nullable @Valid OuterComposite _body
);
+
/**
* Test serialization of outer number types
*
@@ -86,6 +89,7 @@ public interface FakeApi {
Mono fakeOuterNumberSerialize(
@Body @Nullable BigDecimal _body
);
+
/**
* Test serialization of outer string types
*
@@ -98,6 +102,7 @@ public interface FakeApi {
Mono fakeOuterStringSerialize(
@Body @Nullable String _body
);
+
/**
* For this test, the body for this request much reference a schema named `File`.
*
@@ -109,6 +114,7 @@ public interface FakeApi {
Mono testBodyWithFileSchema(
@Body @NotNull @Valid FileSchemaTestClass _body
);
+
/**
* testBodyWithQueryParams
*
@@ -122,6 +128,7 @@ public interface FakeApi {
@QueryValue(value="query") @NotNull String query,
@Body @NotNull @Valid User _body
);
+
/**
* To test \"client\" model
* To test \"client\" model
@@ -135,6 +142,7 @@ public interface FakeApi {
Mono testClientModel(
@Body @NotNull @Valid ModelClient _body
);
+
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -173,6 +181,7 @@ public interface FakeApi {
@Nullable @Size(min=10, max=64) String password,
@Nullable String paramCallback
);
+
/**
* To test enum parameters
* To test enum parameters
@@ -199,6 +208,7 @@ public interface FakeApi {
@Nullable List enumFormStringArray,
@Nullable String enumFormString
);
+
/**
* Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional)
@@ -220,6 +230,7 @@ public interface FakeApi {
@Header(name="boolean_group") @Nullable Boolean booleanGroup,
@QueryValue(value="int64_group") @Nullable Long int64Group
);
+
/**
* test inline additionalProperties
*
@@ -231,6 +242,7 @@ public interface FakeApi {
Mono testInlineAdditionalProperties(
@Body @NotNull Map param
);
+
/**
* test json serialization of form data
*
@@ -244,6 +256,7 @@ public interface FakeApi {
@NotNull String param,
@NotNull String param2
);
+
/**
* To test the collection format in query parameters
*
@@ -262,4 +275,5 @@ public interface FakeApi {
@QueryValue(value="url") @NotNull List url,
@QueryValue(value="context") @NotNull List context
);
+
}
diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeClassnameTags123Api.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeClassnameTags123Api.java
index d7b134fe5bc..8cdc620330e 100644
--- a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeClassnameTags123Api.java
+++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeClassnameTags123Api.java
@@ -28,7 +28,7 @@ import javax.validation.Valid;
import javax.validation.constraints.*;
@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen")
-@Client("${base-path}")
+@Client("${petstore-micronaut-base-path}")
public interface FakeClassnameTags123Api {
/**
* To test class name in snake case
@@ -43,4 +43,5 @@ public interface FakeClassnameTags123Api {
Mono testClassname(
@Body @NotNull @Valid ModelClient _body
);
+
}
diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/PetApi.java
index 7697468a7e9..ff635c948c3 100644
--- a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/PetApi.java
+++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/PetApi.java
@@ -31,7 +31,7 @@ import javax.validation.Valid;
import javax.validation.constraints.*;
@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen")
-@Client("${base-path}")
+@Client("${petstore-micronaut-base-path}")
public interface PetApi {
/**
* Add a new pet to the store
@@ -44,6 +44,7 @@ public interface PetApi {
Mono addPet(
@Body @NotNull @Valid Pet _body
);
+
/**
* Deletes a pet
*
@@ -56,6 +57,7 @@ public interface PetApi {
@PathVariable(name="petId") @NotNull Long petId,
@Header(name="api_key") @Nullable String apiKey
);
+
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@@ -68,6 +70,7 @@ public interface PetApi {
Mono> findPetsByStatus(
@QueryValue(value="status") @NotNull List status
);
+
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@@ -80,6 +83,7 @@ public interface PetApi {
Mono> findPetsByTags(
@QueryValue(value="tags") @NotNull Set tags
);
+
/**
* Find pet by ID
* Returns a single pet
@@ -92,6 +96,7 @@ public interface PetApi {
Mono getPetById(
@PathVariable(name="petId") @NotNull Long petId
);
+
/**
* Update an existing pet
*
@@ -103,6 +108,7 @@ public interface PetApi {
Mono updatePet(
@Body @NotNull @Valid Pet _body
);
+
/**
* Updates a pet in the store with form data
*
@@ -118,6 +124,7 @@ public interface PetApi {
@Nullable String name,
@Nullable String status
);
+
/**
* uploads an image
*
@@ -134,6 +141,7 @@ public interface PetApi {
@Nullable String additionalMetadata,
@Nullable File _file
);
+
/**
* uploads an image (required)
*
@@ -150,4 +158,5 @@ public interface PetApi {
@NotNull File requiredFile,
@Nullable String additionalMetadata
);
+
}
diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/StoreApi.java
index 17b77d80594..9a3b23b73cb 100644
--- a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/StoreApi.java
+++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/StoreApi.java
@@ -28,7 +28,7 @@ import javax.validation.Valid;
import javax.validation.constraints.*;
@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen")
-@Client("${base-path}")
+@Client("${petstore-micronaut-base-path}")
public interface StoreApi {
/**
* Delete purchase order by ID
@@ -41,6 +41,7 @@ public interface StoreApi {
Mono deleteOrder(
@PathVariable(name="order_id") @NotNull String orderId
);
+
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@@ -50,6 +51,7 @@ public interface StoreApi {
@Get(uri="/store/inventory")
@Consumes(value={"application/json"})
Mono