diff --git a/bin/configs/java-micronaut-client.yaml b/bin/configs/java-micronaut-client.yaml new file mode 100644 index 00000000000..35a356d8756 --- /dev/null +++ b/bin/configs/java-micronaut-client.yaml @@ -0,0 +1,9 @@ +generatorName: micronaut-client +outputDir: samples/client/petstore/java-micronaut-client/ +inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +additionalProperties: + artifactId: petstore-micronaut + hideGenerationTimestamp: "true" + configureAuth: "false" + build: "all" + test: "spock" diff --git a/docs/generators/micronaut-client.md b/docs/generators/micronaut-client.md new file mode 100644 index 00000000000..14a2292f04a --- /dev/null +++ b/docs/generators/micronaut-client.md @@ -0,0 +1,297 @@ +--- +title: Config Options for micronaut-client +sidebar_label: micronaut-client +--- + +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| +|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |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| +|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| +|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| +|booleanGetterPrefix|Set booleanGetterPrefix| |get| +|build|Specify for which build tool to generate files|
**gradle**
Gradle configuration is generated for the project
**all**
Both Gradle and Maven configurations are generated
**maven**
Maven configuration is generated for the project
|all| +|configPackage|Configuration package for generated code| |org.openapitools.configuration| +|configureAuth|Configure all the authorization methods as specified in the file| |false| +|developerEmail|developer email in generated pom.xml| |team@openapitools.org| +|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| +|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapitools.org| +|disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| +|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| +|discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |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| +|invokerPackage|root package for generated code| |org.openapitools| +|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|true| +|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| +|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| +|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| +|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git| +|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator| +|serializableModel|boolean - toggle "implements Serializable" for generated models| |false| +|snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null| +|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| +|sourceFolder|source folder for generated code| |src/main/java| +|test|Specify which test tool to generate files for|
**junit**
Use JUnit as test tool
**spock**
Use Spock as test tool
|junit| +|title|Client service name| |OpenAPI Micronaut Client| +|useBeanValidation|Use BeanValidation API annotations| |true| +|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | +|Array|java.util.List| +|ArrayList|java.util.ArrayList| +|BigDecimal|java.math.BigDecimal| +|Date|java.util.Date| +|DateTime|org.joda.time.*| +|File|java.io.File| +|HashMap|java.util.HashMap| +|LinkedHashSet|java.util.LinkedHashSet| +|List|java.util.*| +|LocalDate|org.joda.time.*| +|LocalDateTime|org.joda.time.*| +|LocalTime|org.joda.time.*| +|Map|java.util.Map| +|Set|java.util.*| +|Timestamp|java.sql.Timestamp| +|URI|java.net.URI| +|UUID|java.util.UUID| + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|ArrayList| +|map|HashMap| +|set|LinkedHashSet| + + +## LANGUAGE PRIMITIVES + + + +## RESERVED WORDS + + + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✓|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Array|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✓|ToolingExtension +|MapOfModel|✓|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✓|ToolingExtension +|MapOfCollectionOfEnum|✓|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✗|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✗|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✓|OAS2 +|FormMultipart|✓|OAS2 +|Cookie|✓|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✗|OAS2,OAS3 +|Union|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✓|OAS3 +|BearerToken|✗|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 +|OAuth2_Password|✓|OAS2,OAS3 +|OAuth2_ClientCredentials|✓|OAS2,OAS3 +|OAuth2_AuthorizationCode|✓|OAS2,OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✓|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 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 new file mode 100644 index 00000000000..047607d4903 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautClientCodegen.java @@ -0,0 +1,327 @@ +package org.openapitools.codegen.languages; + +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.features.BeanValidationFeatures; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.util.*; + +import static org.openapitools.codegen.CodegenConstants.INVOKER_PACKAGE; + + +public class JavaMicronautClientCodegen extends AbstractJavaCodegen implements BeanValidationFeatures { + + private final Logger LOGGER = LoggerFactory.getLogger(JavaClientCodegen.class); + + public static final String OPT_TITLE = "title"; + public static final String OPT_CONFIG_PACKAGE = "configPackage"; + public static final String OPT_CONFIGURE_AUTH = "configureAuth"; + public static final String OPT_BUILD = "build"; + public static final String OPT_BUILD_GRADLE = "gradle"; + public static final String OPT_BUILD_MAVEN = "maven"; + public static final String OPT_BUILD_ALL = "all"; + public static final String OPT_TEST = "test"; + public static final String OPT_TEST_JUNIT = "junit"; + public static final String OPT_TEST_SPOCK = "spock"; + + public static final String NAME = "micronaut-client"; + + protected String title; + protected String configPackage; + protected boolean useBeanValidation; + protected boolean configureAuthorization; + protected String buildTool; + protected String testTool; + + public JavaMicronautClientCodegen() { + super(); + + title = "OpenAPI Micronaut Client"; + invokerPackage = "org.openapitools"; + configPackage = "org.openapitools.configuration"; + useBeanValidation = true; + configureAuthorization = false; + buildTool = OPT_BUILD_ALL; + testTool = OPT_TEST_JUNIT; + + modifyFeatureSet(features -> features + .includeDocumentationFeatures( + DocumentationFeature.Readme + ) + .securityFeatures(EnumSet.of( + SecurityFeature.ApiKey, + SecurityFeature.BasicAuth, + SecurityFeature.OAuth2_Implicit, + SecurityFeature.OAuth2_AuthorizationCode, + SecurityFeature.OAuth2_ClientCredentials, + SecurityFeature.OAuth2_Password, + SecurityFeature.OpenIDConnect + )) + ); + + outputFolder = "generated-code/javaMicronaut"; + embeddedTemplateDir = templateDir = "java-micronaut-client"; + apiPackage = "org.openapitools.api"; + modelPackage = "org.openapitools.model"; + invokerPackage = "org.openapitools"; + artifactId = "openapi-micronaut"; + + updateOption(INVOKER_PACKAGE, this.getInvokerPackage()); + updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId()); + updateOption(CodegenConstants.API_PACKAGE, apiPackage); + updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage); + + apiTestTemplateFiles.clear(); + + additionalProperties.put("jackson", "true"); + additionalProperties.put("openbrace", "{"); + additionalProperties.put("closebrace", "}"); + + cliOptions.add(new CliOption(OPT_TITLE, "Client service name").defaultValue(title)); + cliOptions.add(new CliOption(OPT_CONFIG_PACKAGE, "Configuration package for generated code").defaultValue(configPackage)); + cliOptions.add(CliOption.newBoolean(OPT_CONFIGURE_AUTH, "Configure all the authorization methods as specified in the file", configureAuthorization)); + cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations", useBeanValidation)); + + CliOption buildToolOption = new CliOption(OPT_BUILD, "Specify for which build tool to generate files").defaultValue(buildTool); + buildToolOption.setEnum(new HashMap(){{ + put(OPT_BUILD_GRADLE, "Gradle configuration is generated for the project"); + put(OPT_BUILD_MAVEN, "Maven configuration is generated for the project"); + put(OPT_BUILD_ALL, "Both Gradle and Maven configurations are generated"); + }}); + cliOptions.add(buildToolOption); + + CliOption testToolOption = new CliOption(OPT_TEST, "Specify which test tool to generate files for").defaultValue(testTool); + testToolOption.setEnum(new HashMap(){{ + put(OPT_TEST_JUNIT, "Use JUnit as test tool"); + put(OPT_TEST_SPOCK, "Use Spock as test tool"); + }}); + cliOptions.add(testToolOption); + + // Remove the date library option + cliOptions.stream().filter(o -> o.getOpt().equals("dateLibrary")).findFirst() + .ifPresent(v -> cliOptions.remove(v)); + + // Add reserved words + String[] reservedWordsArray = new String[]{ + "client", "format", "queryvalue", "queryparam", "pathvariable", "header", "cookie", + "authorization", "body", "application" + }; + reservedWords.addAll(Arrays.asList(reservedWordsArray)); + } + + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + @Override + public String getName() { + return NAME; + } + + @Override + public String getHelp() { + return "Generates a Java Micronaut Client."; + } + + @Override + public void processOpts() { + super.processOpts(); + + // Get properties + if (additionalProperties.containsKey(OPT_TITLE)) { + this.title = (String) additionalProperties.get(OPT_TITLE); + } + + if (additionalProperties.containsKey(OPT_CONFIG_PACKAGE)) { + configPackage = (String) additionalProperties.get(OPT_CONFIG_PACKAGE); + } else { + additionalProperties.put(OPT_CONFIG_PACKAGE, configPackage); + } + + if (additionalProperties.containsKey(INVOKER_PACKAGE)) { + invokerPackage = (String) additionalProperties.get(INVOKER_PACKAGE); + } else { + additionalProperties.put(INVOKER_PACKAGE, invokerPackage); + } + + // Get boolean properties + if (additionalProperties.containsKey(USE_BEANVALIDATION)) { + this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION)); + } + writePropertyBack(USE_BEANVALIDATION, useBeanValidation); + + if (additionalProperties.containsKey(OPT_CONFIGURE_AUTH)) { + this.configureAuthorization = convertPropertyToBoolean(OPT_CONFIGURE_AUTH); + } + writePropertyBack(OPT_CONFIGURE_AUTH, configureAuthorization); + + // Get enum properties + if (additionalProperties.containsKey(OPT_BUILD)) { + switch ((String) additionalProperties.get(OPT_BUILD)) { + case OPT_BUILD_GRADLE: + case OPT_BUILD_MAVEN: + case OPT_BUILD_ALL: + this.buildTool = (String) additionalProperties.get(OPT_BUILD); + break; + default: + throw new RuntimeException("Build tool \"" + additionalProperties.get(OPT_BUILD) + "\" is not supported or misspelled."); + } + } + additionalProperties.put(OPT_BUILD, buildTool); + + if (additionalProperties.containsKey(OPT_TEST)) { + switch((String) additionalProperties.get(OPT_TEST)) { + case OPT_TEST_JUNIT: + case OPT_TEST_SPOCK: + this.testTool = (String) additionalProperties.get(OPT_TEST); + break; + default: + throw new RuntimeException("Test tool \"" + additionalProperties.get(OPT_TEST) + "\" is not supported or misspelled."); + } + } + additionalProperties.put(OPT_TEST, testTool); + if (testTool.equals(OPT_TEST_JUNIT)) { + additionalProperties.put("isTestJunit", true); + } else if (testTool.equals(OPT_TEST_SPOCK)) { + additionalProperties.put("isTestSpock", true); + } + + final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); + final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/"); + + // Add all the supporting files + String resourceFolder = projectFolder + "/resources"; + supportingFiles.add(new SupportingFile("configuration/application.yml.mustache", resourceFolder, "application.yml").doNotOverwrite()); + + // Authorization files + if (configureAuthorization) { + final String authFolder = invokerFolder + "/auth"; + supportingFiles.add(new SupportingFile("auth/Authorization.mustache", authFolder, "Authorization.java")); + supportingFiles.add(new SupportingFile("auth/AuthorizationBinder.mustache", authFolder, "AuthorizationBinder.java")); + supportingFiles.add(new SupportingFile("auth/Authorizations.mustache", authFolder, "Authorizations.java")); + supportingFiles.add(new SupportingFile("auth/AuthorizationFilter.mustache", authFolder, "AuthorizationFilter.java")); + final String authConfigurationFolder = authFolder + "/configuration"; + supportingFiles.add(new SupportingFile("auth/configuration/ApiKeyAuthConfiguration.mustache", authConfigurationFolder, "ApiKeyAuthConfiguration.java")); + supportingFiles.add(new SupportingFile("auth/configuration/ConfigurableAuthorization.mustache", authConfigurationFolder, "ConfigurableAuthorization.java")); + supportingFiles.add(new SupportingFile("auth/configuration/HttpBasicAuthConfiguration.mustache", authConfigurationFolder, "HttpBasicAuthConfiguration.java")); + } + + // Query files + final String queryFolder = invokerFolder + "/query"; + supportingFiles.add(new SupportingFile("query/QueryParam.mustache", queryFolder, "QueryParam.java")); + supportingFiles.add(new SupportingFile("query/QueryParamBinder.mustache", queryFolder, "QueryParamBinder.java")); + + if (buildTool.equals(OPT_BUILD_GRADLE) || buildTool.equals(OPT_BUILD_ALL)) { + // Gradle files + supportingFiles.add(new SupportingFile("configuration/gradle/build.gradle.mustache", "", "build.gradle").doNotOverwrite()); + supportingFiles.add(new SupportingFile("configuration/gradle/settings.gradle.mustache", "", "settings.gradle").doNotOverwrite()); + supportingFiles.add(new SupportingFile("configuration/gradle/gradle.properties.mustache", "", "gradle.properties").doNotOverwrite()); + + // Gradlew files + final String gradleWrapperFolder = "gradle/wrapper"; + supportingFiles.add(new SupportingFile("configuration/gradlew/gradlew.mustache", "", "gradlew")); + supportingFiles.add(new SupportingFile("configuration/gradlew/gradlew.bat.mustache", "", "gradlew.bat")); + supportingFiles.add(new SupportingFile("configuration/gradlew/gradle-wrapper.properties.mustache", gradleWrapperFolder, "gradle-wrapper.properties")); + supportingFiles.add(new SupportingFile("configuration/gradlew/gradle-wrapper.jar", gradleWrapperFolder, "gradle-wrapper.jar")); + } + + if (buildTool.equals(OPT_BUILD_MAVEN) || buildTool.equals(OPT_BUILD_ALL)) { + // Maven files + supportingFiles.add(new SupportingFile("configuration/pom.xml.mustache", "", "pom.xml").doNotOverwrite()); + + // Maven wrapper files + supportingFiles.add(new SupportingFile("configuration/mavenw/mvnw.mustache", "", "mvnw")); + supportingFiles.add(new SupportingFile("configuration/mavenw/mvnw.bat.mustache", "", "mvnw.bat")); + supportingFiles.add(new SupportingFile("configuration/mavenw/MavenWrapperDownloader.java.mustache", ".mvn/wrapper", "MavenWrapperDownloader.java")); + supportingFiles.add(new SupportingFile("configuration/mavenw/maven-wrapper.jar.mustache", ".mvn/wrapper", "maven-wrapper.jar")); + supportingFiles.add(new SupportingFile("configuration/mavenw/maven-wrapper.properties.mustache", ".mvn/wrapper", "maren-wrapper.properties")); + } + + // Git files + supportingFiles.add(new SupportingFile("configuration/git/gitignore.mustache", "", ".gitignore").doNotOverwrite()); + + // Use the default java Date + typeMapping.put("date", "LocalDate"); + typeMapping.put("DateTime", "LocalDateTime"); + importMapping.put("LocalDate", "java.time.LocalDate"); + importMapping.put("LocalDateTime", "java.time.LocalDateTime"); + + // Add documentation files + supportingFiles.add(new SupportingFile("doc/README.mustache", "", "README.md").doNotOverwrite()); + supportingFiles.add(new SupportingFile("doc/auth.mustache", apiDocPath, "auth.md")); + modelDocTemplateFiles.put("doc/model_doc.mustache", ".md"); + apiDocTemplateFiles.put("doc/api_doc.mustache", ".md"); + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); + + // Add model files + modelTemplateFiles.remove("model.mustache"); + modelTemplateFiles.put("model/model.mustache", ".java"); + + // Add test files + if (testTool.equals(OPT_TEST_JUNIT)) { + apiTestTemplateFiles.put("api_test.mustache", ".java"); + modelTestTemplateFiles.put("model_test.mustache", ".java"); + } else if (testTool.equals(OPT_TEST_SPOCK)) { + apiTestTemplateFiles.put("api_test.groovy.mustache", ".groovy"); + modelTestTemplateFiles.put("model_test.groovy.mustache", ".groovy"); + } + } + + @Override + public String apiTestFileFolder() { + if (testTool.equals(OPT_TEST_SPOCK)) { + return getOutputDir() + "/src/test/groovy/" + getInvokerPackage().replaceAll("\\.", "/") + "/api"; + } + return getOutputDir() + "/src/test/java/" + getInvokerPackage().replaceAll("\\.", "/") + "/api"; + } + + @Override + public String modelTestFileFolder() { + if (testTool.equals(OPT_TEST_SPOCK)) { + return getOutputDir() + "/src/test/groovy/" + getInvokerPackage().replaceAll("\\.", "/") + "/model"; + } + return getOutputDir() + "/src/test/java/" + getInvokerPackage().replaceAll("\\.", "/") + "/model"; + } + + @Override + public String toApiTestFilename(String name) { + if (testTool.equals(OPT_TEST_SPOCK)) { + return toApiName(name) + "Spec"; + } + return toApiName(name) + "Test"; + } + + @Override + public String toModelTestFilename(String name) { + if (testTool.equals(OPT_TEST_SPOCK)) { + return toModelName(name) + "Spec"; + } + return toModelName(name) + "Test"; + } + + @Override + public void setUseBeanValidation(boolean useBeanValidation) { + this.useBeanValidation = useBeanValidation; + } + + @Override + public String toApiVarName(String name) { + String apiVarName = super.toApiVarName(name); + if (reservedWords.contains(apiVarName)) { + apiVarName = escapeReservedWord(apiVarName); + } + return apiVarName; + } + + public boolean isUseBeanValidation() { + return useBeanValidation; + } + + public boolean isConfigureAuthorization() { + return configureAuthorization; + } +} diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index edff28e636a..df636589cd5 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -55,6 +55,7 @@ org.openapitools.codegen.languages.HaskellServantCodegen org.openapitools.codegen.languages.JavaClientCodegen org.openapitools.codegen.languages.JavaCXFClientCodegen org.openapitools.codegen.languages.JavaInflectorServerCodegen +org.openapitools.codegen.languages.JavaMicronautClientCodegen org.openapitools.codegen.languages.JavaMSF4JServerCodegen org.openapitools.codegen.languages.JavaPKMSTServerCodegen org.openapitools.codegen.languages.JavaPlayFrameworkCodegen 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 new file mode 100644 index 00000000000..4232340e520 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/api.mustache @@ -0,0 +1,70 @@ +{{>licenseInfo}} +package {{package}}; + +import io.micronaut.http.annotation.*; +import io.micronaut.core.annotation.*; +import io.micronaut.http.client.annotation.Client; +{{#configureAuth}} +import {{invokerPackage}}.auth.Authorization; +{{/configureAuth}} +import {{invokerPackage}}.query.QueryParam; +import io.micronaut.core.convert.format.Format; +import reactor.core.publisher.Mono; +{{#imports}}import {{import}}; +{{/imports}} +import javax.annotation.Generated; +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}}{{#useBeanValidation}} +import javax.validation.Valid; +import javax.validation.constraints.*; +{{/useBeanValidation}} + +{{>generatedAnnotation}} +@Client("${base-path}") +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}}}") + {{#vendorExtensions.x-contentType}} + @Produces(value={"{{vendorExtensions.x-contentType}}"}) + {{/vendorExtensions.x-contentType}} + @Consumes(value={"{{vendorExtensions.x-accepts}}"}) + {{!auth methods}} + {{#configureAuth}} + {{#authMethods}} + @Authorization(name="{{{name}}}"{{!scopes}}{{#isOAuth}}, scopes={{=< >=}}{<={{ }}=>{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}{{=< >=}}}<={{ }}=>{{/isOAuth}}) + {{/authMethods}} + {{/configureAuth}} + {{#returnType}}Mono<{{{returnType}}}>{{/returnType}}{{^returnType}}Mono{{/returnType}} {{nickname}}({{^allParams}});{{/allParams}}{{#allParams}} + {{>params/queryParams}}{{>params/pathParams}}{{>params/headerParams}}{{>params/bodyParams}}{{>params/formParams}}{{>params/cookieParams}}{{^-last}}, {{/-last}}{{#-last}} + );{{/-last}}{{/allParams}} + {{/operation}} +{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/api_test.groovy.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/api_test.groovy.mustache new file mode 100644 index 00000000000..af4469421f3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/api_test.groovy.mustache @@ -0,0 +1,48 @@ +package {{package}} + +{{#imports}}import {{import}} +{{/imports}} +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject +import reactor.core.publisher.Mono +{{^fullJavaUtil}} +import java.util.ArrayList +import java.util.HashMap +import java.util.List +import java.util.Map +{{/fullJavaUtil}} + + +/** + * API tests for {{classname}} + */ +@MicronautTest +class {{classname}}Spec extends Specification { + + @Inject + {{classname}} api + + {{#operations}}{{#operation}} + /** + * {{summary}} + {{#notes}} + * + * {{notes}} + {{/notes}} + */ + void '{{operationId}}() test'() { + given: + {{#allParams}} + {{{dataType}}} {{paramName}} = null + {{/allParams}} + // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).block() + // {{#returnType}}Mono<{{{returnType}}}>{{/returnType}}{{^returnType}}Mono{{/returnType}} asyncResponse = api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) + + expect: + true + // TODO: test validations + } + + {{/operation}}{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/api_test.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/api_test.mustache new file mode 100644 index 00000000000..a3c3e48e44b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/api_test.mustache @@ -0,0 +1,47 @@ +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; +import jakarta.inject.Inject; +import reactor.core.publisher.Mono; + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + + +/** + * API tests for {{classname}} + */ +@MicronautTest +public class {{classname}}Test { + + @Inject + {{classname}} api; + + {{#operations}}{{#operation}} + /** + * {{summary}} + {{#notes}} + * + * {{notes}} + {{/notes}} + */ + @Test + public void {{operationId}}Test() { + {{#allParams}} + {{{dataType}}} {{paramName}} = null; + {{/allParams}} + // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).block(); + // {{#returnType}}Mono<{{{returnType}}}>{{/returnType}}{{^returnType}}Mono{{/returnType}} asyncResponse = api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + // TODO: test validations + } + + {{/operation}}{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/Authorization.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/Authorization.mustache new file mode 100644 index 00000000000..ac5f7f979fd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/Authorization.mustache @@ -0,0 +1,40 @@ +{{>licenseInfo}} +package {{invokerPackage}}.auth; + +import io.micronaut.context.annotation.AliasFor; +import io.micronaut.core.bind.annotation.Bindable; + +import java.lang.annotation.Documented; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +@Documented +@Retention(RUNTIME) +@Target(METHOD) +@Bindable +@Repeatable(Authorizations.class) +public @interface Authorization { + /** + * The name of the authorization + */ + @AliasFor(annotation=Bindable.class, member="value") + String value() default ""; + + /** + * The name of the authorization + */ + @AliasFor(annotation=Bindable.class, member="value") + String name() default ""; + + /** + * The scopes for the oauth authorization + */ + String[] scopes() default {}; +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/AuthorizationBinder.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/AuthorizationBinder.mustache new file mode 100644 index 00000000000..fad44af0f00 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/AuthorizationBinder.mustache @@ -0,0 +1,72 @@ +{{>licenseInfo}} +package {{invokerPackage}}.auth; + +import io.micronaut.aop.MethodInvocationContext; +import io.micronaut.core.annotation.AnnotationValue; +import io.micronaut.core.annotation.NonNull; +import io.micronaut.core.util.CollectionUtils; +import io.micronaut.core.util.StringUtils; +import io.micronaut.http.MutableHttpRequest; +import io.micronaut.http.client.bind.AnnotatedClientRequestBinder; +import io.micronaut.http.client.bind.ClientRequestUriContext; +import jakarta.inject.Singleton; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +@Singleton +public class AuthorizationBinder implements AnnotatedClientRequestBinder { + + public static final CharSequence AUTHORIZATION_NAMES = "micronaut.security.AUTHORIZATION_NAMES"; + + @NonNull + @Override + public Class getAnnotationType() { + return Authorization.class; + } + + @Override + public void bind(@NonNull MethodInvocationContext context, + @NonNull ClientRequestUriContext uriContext, + @NonNull MutableHttpRequest request + ) { + List> annotations = context.getAnnotationMetadata() + .getAnnotationValuesByType(Authorization.class); + + if (CollectionUtils.isNotEmpty(annotations)) { + List authorizationNames = new ArrayList<>(); + for (AnnotationValue annotation: annotations) { + annotation.get("name", String.class) + .filter(StringUtils::isNotEmpty) + .ifPresent(v -> authorizationNames.add(configurationName(v))); + } + request.setAttribute(AUTHORIZATION_NAMES, authorizationNames); + } + } + + private String configurationName(String name) { + StringBuilder result = new StringBuilder(); + + boolean wasCapital = false; + for (int i = 0; i < name.length(); ++i) { + char c = name.charAt(i); + if (c == '_') { + result.append('-'); + wasCapital = true; + } else if (Character.isUpperCase(c)) { + if (wasCapital) { + result.append(Character.toLowerCase(c)); + } else { + result.append('-'); + result.append(Character.toLowerCase(c)); + } + wasCapital = true; + } else { + result.append(c); + } + } + return result.toString(); + } +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/AuthorizationFilter.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/AuthorizationFilter.mustache new file mode 100644 index 00000000000..021a5425d39 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/AuthorizationFilter.mustache @@ -0,0 +1,157 @@ +{{>licenseInfo}} +package {{invokerPackage}}.auth; + +import io.micronaut.context.BeanContext; +import io.micronaut.core.annotation.NonNull; +import io.micronaut.core.annotation.Nullable; +import io.micronaut.core.util.CollectionUtils; +import io.micronaut.core.util.StringUtils; +import io.micronaut.core.util.Toggleable; +import io.micronaut.http.HttpRequest; +import io.micronaut.http.HttpResponse; +import io.micronaut.http.MutableHttpRequest; +import io.micronaut.http.annotation.Filter; +import io.micronaut.http.filter.ClientFilterChain; +import io.micronaut.http.filter.HttpClientFilter; +import io.micronaut.inject.qualifiers.Qualifiers; +import io.micronaut.security.oauth2.client.clientcredentials.ClientCredentialsClient; +import io.micronaut.security.oauth2.client.clientcredentials.ClientCredentialsConfiguration; +import io.micronaut.security.oauth2.client.clientcredentials.propagation.ClientCredentialsHttpClientFilter; +import io.micronaut.security.oauth2.client.clientcredentials.propagation.ClientCredentialsTokenPropagator; +import io.micronaut.security.oauth2.configuration.OauthClientConfiguration; +import io.micronaut.security.oauth2.endpoint.token.response.TokenResponse; +import org.openapitools.auth.configuration.ConfigurableAuthorization; +import org.reactivestreams.Publisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +@Filter(Filter.MATCH_ALL_PATTERN) +public class AuthorizationFilter implements HttpClientFilter { + private static final Logger LOG = LoggerFactory.getLogger(ClientCredentialsHttpClientFilter.class); + + private final BeanContext beanContext; + private final Map clientConfigurationByName; + + ClientCredentialsTokenPropagator defaultTokenPropagator; + private final Map tokenPropagatorByName; + private final Map clientCredentialsClientByName; + + public final Map authorizationsByName; + + public AuthorizationFilter( + BeanContext beanContext, + Stream clientConfigurations, + ClientCredentialsTokenPropagator defaultTokenPropagator, + Stream configurableAuthorizations + ) { + this.beanContext = beanContext; + this.clientConfigurationByName = clientConfigurations + .filter(Toggleable::isEnabled) + .collect(Collectors.toMap(OauthClientConfiguration::getName, v -> v)); + this.defaultTokenPropagator = defaultTokenPropagator; + this.tokenPropagatorByName = new HashMap<>(); + this.clientCredentialsClientByName = new HashMap<>(); + this.authorizationsByName = configurableAuthorizations + .collect(Collectors.toMap(ConfigurableAuthorization::getName, v -> v)); + } + + @Override + public Publisher> doFilter( + @NonNull MutableHttpRequest request, + @NonNull ClientFilterChain chain + ) { + List names = request.getAttribute(AuthorizationBinder.AUTHORIZATION_NAMES, List.class).orElse(null); + if (CollectionUtils.isNotEmpty(names)) { + List> authorizers = new ArrayList<>(names.size()); + + for (Object nameObject: names) { + if (!(nameObject instanceof String)) { + continue; + } + String name = (String) nameObject; + + // Check if other authorizations have the key + if (authorizationsByName.containsKey(name)) { + ConfigurableAuthorization authorizer = authorizationsByName.get(name); + authorizers.add(Mono.fromCallable(() -> { + authorizer.applyAuthorization(request); + return request; + })); + continue; + } + + // Perform OAuth authorization + OauthClientConfiguration clientConfiguration = clientConfigurationByName.get(name); + if (clientConfiguration == null) { + continue; + } + + ClientCredentialsClient clientCredentialsClient = getClientCredentialsClient(name); + if (clientCredentialsClient == null) { + if (LOG.isTraceEnabled()) { + LOG.trace("Could not retrieve client credentials client for OAuth 2.0 client {}", name); + } + continue; + } + + ClientCredentialsTokenPropagator tokenHandler = getTokenPropagator(name); + Flux authorizer = Flux.from(clientCredentialsClient + .requestToken(getScope(clientConfiguration))) + .map(TokenResponse::getAccessToken) + .map(accessToken -> { + if (StringUtils.isNotEmpty(accessToken)) { + tokenHandler.writeToken(request, accessToken); + } + return request; + }); + authorizers.add(authorizer); + } + + return Flux.concat(authorizers) + .switchMap(v -> chain.proceed(request)); + } + + + return chain.proceed(request); + } + + protected ClientCredentialsTokenPropagator getTokenPropagator(String name) { + ClientCredentialsTokenPropagator tokenPropagator = tokenPropagatorByName.get(name); + if (tokenPropagator == null) { + tokenPropagator = beanContext.findBean(ClientCredentialsTokenPropagator.class, Qualifiers.byName(name)) + .orElse(defaultTokenPropagator); + if (tokenPropagator != null) { + tokenPropagatorByName.put(name, tokenPropagator); + } + } + return tokenPropagator; + } + + protected ClientCredentialsClient getClientCredentialsClient(String name) { + ClientCredentialsClient client = clientCredentialsClientByName.get(name); + if (client == null) { + client = beanContext.findBean(ClientCredentialsClient.class, Qualifiers.byName(name)).orElse(null); + if (client != null) { + clientCredentialsClientByName.put(name, client); + } + } + return client; + } + + @Nullable + protected String getScope(@NonNull OauthClientConfiguration oauthClient) { + return oauthClient.getClientCredentials().flatMap(ClientCredentialsConfiguration::getScope).orElse(null); + } +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/Authorizations.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/Authorizations.mustache new file mode 100644 index 00000000000..1ee37c7c1df --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/Authorizations.mustache @@ -0,0 +1,21 @@ +{{>licenseInfo}} +package {{invokerPackage}}.auth; + +import io.micronaut.core.bind.annotation.Bindable; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +@Documented +@Retention(RUNTIME) +@Target(METHOD) +@Bindable +public @interface Authorizations { + Authorization[] value(); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/ApiKeyAuthConfiguration.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/ApiKeyAuthConfiguration.mustache new file mode 100644 index 00000000000..969da02fabc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/ApiKeyAuthConfiguration.mustache @@ -0,0 +1,79 @@ +{{>licenseInfo}} +package {{invokerPackage}}.auth.configuration; + +import io.micronaut.context.annotation.ConfigurationInject; +import io.micronaut.context.annotation.EachProperty; +import io.micronaut.context.annotation.Parameter; +import io.micronaut.core.annotation.NonNull; +import io.micronaut.http.MutableHttpRequest; +import io.micronaut.http.cookie.Cookie; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +@EachProperty("security.api-key-auth") +public class ApiKeyAuthConfiguration implements ConfigurableAuthorization { + private final String name; + private AuthKeyLocation location; + private String paramName; + private String apiKey; + + @ConfigurationInject + public ApiKeyAuthConfiguration( + @Parameter String name, + @NonNull AuthKeyLocation location, + @NonNull String paramName, + @NonNull String apiKey + ) { + this.name = name; + this.location = location; + this.paramName = paramName; + this.apiKey = apiKey; + } + + @Override + public void applyAuthorization(@NonNull MutableHttpRequest request) { + if (this.location == AuthKeyLocation.HEADER) { + request.header(this.paramName, this.apiKey); + } else if (this.location == AuthKeyLocation.QUERY) { + request.getParameters().add(this.paramName, this.apiKey); + } else if (this.location == AuthKeyLocation.COOKIE) { + request.cookie(Cookie.of(this.paramName, this.apiKey)); + } + } + + @Override + public String getName() { + return name; + } + + public AuthKeyLocation getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setLocation(AuthKeyLocation location) { + this.location = location; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public enum AuthKeyLocation { + HEADER, + QUERY, + COOKIE; + } +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/ConfigurableAuthorization.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/ConfigurableAuthorization.mustache new file mode 100644 index 00000000000..2d649c3a3be --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/ConfigurableAuthorization.mustache @@ -0,0 +1,14 @@ +{{>licenseInfo}} +package {{invokerPackage}}.auth.configuration; + +import io.micronaut.core.annotation.NonNull; +import io.micronaut.http.MutableHttpRequest; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +public interface ConfigurableAuthorization { + String getName(); + + void applyAuthorization(@NonNull MutableHttpRequest request); +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/HttpBasicAuthConfiguration.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/HttpBasicAuthConfiguration.mustache new file mode 100644 index 00000000000..189613b4f7e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/auth/configuration/HttpBasicAuthConfiguration.mustache @@ -0,0 +1,55 @@ +{{>licenseInfo}} +package {{invokerPackage}}.auth.configuration; + +import io.micronaut.context.annotation.ConfigurationInject; +import io.micronaut.context.annotation.EachProperty; +import io.micronaut.context.annotation.Parameter; +import io.micronaut.core.annotation.NonNull; +import io.micronaut.http.MutableHttpRequest; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +@EachProperty("security.basic-auth") +public class HttpBasicAuthConfiguration implements ConfigurableAuthorization { + private final String name; + private String username; + private String password; + + @ConfigurationInject + public HttpBasicAuthConfiguration( + @Parameter String name, + @NonNull String username, + @NonNull String password + ) { + this.name = name; + this.username = username; + this.password = password; + } + + @Override + public void applyAuthorization(@NonNull MutableHttpRequest request) { + request.basicAuth(username, password); + } + + @Override + public String getName() { + return this.name; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/Application.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/Application.mustache new file mode 100644 index 00000000000..ad59c5fa124 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/Application.mustache @@ -0,0 +1,9 @@ +package {{invokerPackage}}; + +import io.micronaut.runtime.Micronaut; + +public class Application { + public static void main(String[] args) { + Micronaut.run(Application.class, args); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/application.yml.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/application.yml.mustache new file mode 100644 index 00000000000..4b0dd5f1c23 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/application.yml.mustache @@ -0,0 +1,62 @@ +base-path: "{{{basePath}}}" +context-path: "{{{contextPath}}}" + +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}} + +{{#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: + {{/isBasic}}{{/authMethods}}{{/configureAuth}} + +jackson: + serialization: + writeEnumsUsingToString: true + writeDatesAsTimestamps: false + deserialization: + readEnumsUsingToString: true + failOnUnknownProperties: false + failOnInvalidSubtype: false diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/git/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/git/git_push.sh.mustache new file mode 100644 index 00000000000..8b3f689c912 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/git/git_push.sh.mustache @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="{{{gitHost}}}" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/git/gitignore.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/git/gitignore.mustache new file mode 100644 index 00000000000..a530464afa1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/git/gitignore.mustache @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/build.gradle.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/build.gradle.mustache new file mode 100644 index 00000000000..a654fe37133 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/build.gradle.mustache @@ -0,0 +1,51 @@ +plugins { + {{#isTestSpock}} + id("groovy") + {{/isTestSpock}} + id("com.github.johnrengelman.shadow") version "7.0.0" + id("io.micronaut.application") version "2.0.3" +} + +version = "{{artifactVersion}}" +group = "{{invokerPackage}}" + +repositories { + mavenCentral() +} + +micronaut { + runtime("netty") + {{#isTestSpock}} + testRuntime("spock2") + {{/isTestSpock}} + {{#isTestJunit}} + testRuntime("junit5") + {{/isTestJunit}} + processing { + incremental(true) + annotations("{{invokerPackage}}.*") + } +} + + +dependencies { + annotationProcessor("io.micronaut:micronaut-http-validation") + annotationProcessor("io.micronaut.security:micronaut-security-annotations") + implementation("io.micronaut:micronaut-http-client") + implementation("io.micronaut:micronaut-runtime") + implementation("io.micronaut:micronaut-validation") + 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") +} + +// TODO Set the main class +application { + mainClass.set("{{invokerPackage}}.Application") +} +java { + sourceCompatibility = JavaVersion.toVersion("1.8") + targetCompatibility = JavaVersion.toVersion("1.8") +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/gradle.properties.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/gradle.properties.mustache new file mode 100644 index 00000000000..4804e049014 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/gradle.properties.mustache @@ -0,0 +1 @@ +micronautVersion=3.0.0-M5 \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/settings.gradle.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/settings.gradle.mustache new file mode 100644 index 00000000000..b8fd6c4c41f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradle/settings.gradle.mustache @@ -0,0 +1 @@ +rootProject.name = "{{artifactId}}" \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradle-wrapper.jar new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradle-wrapper.properties.mustache new file mode 100644 index 00000000000..f2e1eb1fd47 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradle-wrapper.properties.mustache @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradlew.bat.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradlew.bat.mustache new file mode 100644 index 00000000000..107acd32c4e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradlew.bat.mustache @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradlew.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradlew.mustache new file mode 100644 index 00000000000..4f906e0c811 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/gradlew/gradlew.mustache @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/MavenWrapperDownloader.java.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/MavenWrapperDownloader.java.mustache new file mode 100644 index 00000000000..fc435c409b3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/MavenWrapperDownloader.java.mustache @@ -0,0 +1,124 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/maven-wrapper.jar.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/maven-wrapper.jar.mustache new file mode 100644 index 00000000000..2cc7d4a55c0 Binary files /dev/null and b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/maven-wrapper.jar.mustache differ diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/maven-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/maven-wrapper.properties.mustache new file mode 100644 index 00000000000..642d572ce90 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/maven-wrapper.properties.mustache @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/mvnw.bat.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/mvnw.bat.mustache new file mode 100644 index 00000000000..c8d43372c98 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/mvnw.bat.mustache @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/mvnw.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/mvnw.mustache new file mode 100644 index 00000000000..a16b5431b4c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/mavenw/mvnw.mustache @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/pom.xml.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/pom.xml.mustache new file mode 100644 index 00000000000..3ef1c44ab3e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/configuration/pom.xml.mustache @@ -0,0 +1,195 @@ + + + 4.0.0 + {{groupId}} + {{artifactId}} + {{artifactVersion}} + ${packaging} + + + io.micronaut + micronaut-parent + 3.0.0-M5 + + + + jar + 1.8 + + + 3.0.0-M5 + {{groupId}}.Application + netty + 1.5.21 + + + + + central + https://repo.maven.apache.org/maven2 + + + + + + io.micronaut + micronaut-inject + compile + + + io.micronaut + micronaut-validation + compile + + {{#isTestSpock}} + + io.micronaut + micronaut-inject-groovy + test + + + org.spockframework + spock-core + test + + + org.codehaus.groovy + groovy-all + + + + + io.micronaut.test + micronaut-test-spock + test + + {{/isTestSpock}} + {{#isTestJunit}} + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + io.micronaut.test + micronaut-test-junit5 + test + + {{/isTestJunit}} + + io.micronaut + micronaut-http-client + compile + + + io.micronaut + micronaut-http-server-netty + compile + + + io.micronaut + micronaut-runtime + compile + + + io.micronaut.reactor + micronaut-reactor + compile + + + io.micronaut.security + micronaut-security + compile + + + io.micronaut.security + micronaut-security-oauth2 + compile + + + ch.qos.logback + logback-classic + runtime + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + + + + io.micronaut.build + micronaut-maven-plugin + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + io.micronaut + micronaut-http-validation + ${micronaut.version} + + + io.micronaut.security + micronaut-security-annotations + ${micronaut.security.version} + + + + -Amicronaut.processing.group={{groupId}} + -Amicronaut.processing.module={{artifactId}} + + + + {{#isTestSpock}} + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*Spec.* + **/*Test.* + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.9.0 + + + + addSources + generateStubs + compile + removeStubs + addTestSources + generateTestStubs + compileTests + removeTestStubs + + + + + {{/isTestSpock}} + + + + diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/README.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/README.mustache new file mode 100644 index 00000000000..96a3428b659 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/README.mustache @@ -0,0 +1,39 @@ +# {{artifactId}} + +This is a generated client based on [Micronaut](https://micronaut.io/) framework. + +## Configuration + +A Micronaut's application can be created by defyning a main class and running: +```java +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; + +public class Application { + + public static void main(String[] args) { + ApplicationContext context = Micronaut.run(Application.class); + } +} +``` + +More detailed description can be found in the [Micronaut Guide](https://docs.micronaut.io/latest/guide/#ideSetup). + +All the properties can be changed in the [application.yml][src/main/resources/application.yml] file or when creating micronaut application as described in [Configuration section of guide](https://docs.micronaut.io/latest/guide/#config). + +## Api Guides + +Description on how to create Apis is given inside individual api guides: + +{{#apiInfo}}{{#apis}}* [{{classFilename}}]({{apiDocPath}}/{{classFilename}}.md) +{{/apis}}{{/apiInfo}} + +## Auth methods + +Details on auth methods can be found in the [auth.md](doc/auth.md). + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} + diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/api_doc.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/api_doc.mustache new file mode 100644 index 00000000000..92170fc6dbb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/api_doc.mustache @@ -0,0 +1,68 @@ +# {{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +## Creating {{classname}} + +To initiate an instance of `{{classname}}`, you can use micronaut's `ApplicationContext`: +```java +/* imports +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; +import {{package}}.{{classname}}; +*/ + +ApplicationContext context = Micronaut.run(/* ... */); +PetApi apiInstance = context.getBean({{classname}}.class); +``` + +Or the `@Inject` annotation: +```java +@Singleton +class MyClass { + @Inject + {{classname}} {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}; + + /* ... use the injected variable */ +} +``` +Note that the class needs to be annotated with one of Micronaut's [scope annotations](https://docs.micronaut.io/latest/guide/#scopes) like `Singleton` in order to be processed. + +More information can be found inside [Inversion of Control guide section](https://docs.micronaut.io/latest/guide/#ioc). + +{{#operations}} +{{#operation}} + +# **{{operationId}}** +```java +{{#returnType}}Mono<{{{returnType}}}>{{/returnType}}{{^returnType}}Mono{{/returnType}} {{classname}}.{{nickname}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +``` + +{{summary}}{{#notes}} + +{{notes}}{{/notes}} + +{{#allParams}}{{#-last}}### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}`{{dataType}}`{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}`{{dataType}}`{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional parameter]{{/required}}{{#defaultValue}} [default to `{{defaultValue}}`]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}`{{{.}}}`{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{/allParams}}{{/-last}}{{/allParams}} + +{{#returnType}}### Return type +{{#returnTypeIsPrimitive}}`{{returnType}}`{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}} + +{{#authMethods}}{{#-last}}### Authorization{{#authMethods}} +* **[{{name}}](auth.md#{{name}})**{{#scopes}}{{#-last}}, scopes: {{#scopes}}`{{{scope}}}`{{^-last}}, {{/-last}}{{/scopes}}{{/-last}}{{/scopes}}{{/authMethods}}{{/-last}}{{/authMethods}} + +### HTTP request headers + - **Content-Type**: {{#consumes}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/auth.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/auth.mustache new file mode 100644 index 00000000000..9c5ba683fb7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/auth.mustache @@ -0,0 +1,25 @@ +# Authorization methods +{{#authMethods}} + +# {{name}} +{{! + basic auth +}}{{#isBasic}}Authorization method is of **basic auth**. + +{{#configureAuth}}The configuration for it can be found in [application.yml](src/main/resources/application.yml) at `security.basic-auth.{{name}}`. `username` and `password` need to be filled for it to work correctly.{{/configureAuth}}{{^configureAuth}}It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features.{{/configureAuth}} +{{/isBasic}}{{! + api key +}}{{#isApiKey}}Authorization method is of **api key type**. The parameter `{{{keyParamName}}}` is located in `{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInCookie}}cookie{{/isKeyInCookie}}`. + +{{#configureAuth}}The configuration for it can be found in [application.yml](src/main/resources/application.yml) at `security.api-key-auth.{{name}}`. The `api-key` parameter needs to be filled in order for it to work correctly.{{/configureAuth}}{{^configureAuth}}It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features.{{/configureAuth}} +{{/isApiKey}}{{! + oauth +}}{{#isOAuth}}Authorization method is **OAuth2** with `{{flow}}` flow. +{{!scopes}}{{#scopes}}{{#-last}}The scopes are: {{#scopes}} + * `{{{scope}}}`{{/scopes}}{{/-last}}{{/scopes}} + +{{#configureAuth}}The configuration for it can be found in [application.yml](src/main/resources/application.yml) at `micronaut.security.oauth2.clients.{{name}}`. Some parameters may require to be filled in for it to work correctly.{{/configureAuth}}{{^configureAuth}}It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features.{{/configureAuth}} + +More information on configuring can be found in [Micronaut Security Guide](https://micronaut-projects.github.io/micronaut-security/latest/guide/#oauth). +{{/isOAuth}} +{{/authMethods}} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/enum_outer_doc.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/enum_outer_doc.mustache new file mode 100644 index 00000000000..20c512aaeae --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/enum_outer_doc.mustache @@ -0,0 +1,7 @@ +# {{classname}} + +## Enum + +{{#allowableValues}}{{#enumVars}} +* `{{name}}` (value: `{{{value}}}`) +{{/enumVars}}{{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/model_doc.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/model_doc.mustache new file mode 100644 index 00000000000..3f14f653581 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/model_doc.mustache @@ -0,0 +1,4 @@ +{{#models}}{{#model}} + +{{#isEnum}}{{>doc/enum_outer_doc}}{{/isEnum}}{{^isEnum}}{{>doc/pojo_doc}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/pojo_doc.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/pojo_doc.mustache new file mode 100644 index 00000000000..0a79703d7a0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/doc/pojo_doc.mustache @@ -0,0 +1,39 @@ +# {{#vendorExtensions.x-is-one-of-interface}}Interface {{/vendorExtensions.x-is-one-of-interface}}{{classname}} + +{{#description}}{{&description}} +{{/description}} +{{^vendorExtensions.x-is-one-of-interface}} + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isEnum}}[**{{datatypeWithEnum}}**](#{{datatypeWithEnum}}){{/isEnum}}{{^isEnum}}{{#isContainer}}{{#isArray}}{{#items}}{{#isModel}}[{{/isModel}}{{/items}}`{{baseType}}{{#items}}<{{dataType}}>`{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{#baseType}}{{baseType}}{{/baseType}}.md){{/isModel}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{#isModel}}[{{/isModel}}`Map<String, {{dataType}}>`{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{#baseType}}{{baseType}}{{/baseType}}.md){{/isModel}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isModel}}[{{/isModel}}`{{dataType}}`{{#isModel}}]({{^baseType}}{{dataType}}{{/baseType}}{{#baseType}}{{baseType}}{{/baseType}}.md){{/isModel}}{{/isContainer}}{{/isEnum}} | {{description}} | {{^required}} [optional property]{{/required}}{{#isReadOnly}} [readonly property]{{/isReadOnly}} +{{/vars}} + +{{#vars}}{{#isEnum}} + +## Enum: {{datatypeWithEnum}} + +Name | Value +---- | -----{{#allowableValues}}{{#enumVars}} +{{name}} | `{{value}}`{{/enumVars}}{{/allowableValues}} +{{/isEnum}}{{/vars}} + +{{#vendorExtensions.x-implements.0}} +## Implemented Interfaces + +{{#vendorExtensions.x-implements}} +* `{{{.}}}` +{{/vendorExtensions.x-implements}} +{{/vendorExtensions.x-implements.0}} +{{/vendorExtensions.x-is-one-of-interface}} + +{{#vendorExtensions.x-is-one-of-interface}} + +## Implementing Classes + +{{#oneOf}} +* `{{{.}}}` +{{/oneOf}} +{{/vendorExtensions.x-is-one-of-interface}} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/generatedAnnotation.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/generatedAnnotation.mustache new file mode 100644 index 00000000000..98fbb9f7da9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/generatedAnnotation.mustache @@ -0,0 +1 @@ +@Generated(value="{{generatorClass}}"{{^hideGenerationTimestamp}}, date="{{generatedDate}}"{{/hideGenerationTimestamp}}) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/licenseInfo.mustache new file mode 100644 index 00000000000..abc2f4578eb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/licenseInfo.mustache @@ -0,0 +1,11 @@ +/* + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/beanValidation.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/beanValidation.mustache new file mode 100644 index 00000000000..bbc797247ea --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/beanValidation.mustache @@ -0,0 +1,52 @@ +{{#useBeanValidation}}{{! +validate all pojos and enums +}}{{^isContainer}}{{#isModel}} @Valid +{{/isModel}}{{/isContainer}}{{! +nullable & nonnull +}}{{#required}}{{#isNullable}} @Nullable +{{/isNullable}}{{^isNullable}} @NotNull +{{/isNullable}}{{/required}}{{^required}} @Nullable +{{/required}}{{! +pattern +}}{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{pattern}}}") +{{/isByteArray}}{{/pattern}}{{! +both minLength && maxLength +}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}}, max={{maxLength}}) +{{/maxLength}}{{/minLength}}{{! +just minLength +}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}) +{{/maxLength}}{{/minLength}}{{! +just maxLength +}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}) +{{/maxLength}}{{/minLength}}{{! +@Size: both minItems && maxItems +}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}}, max={{maxItems}}) +{{/maxItems}}{{/minItems}}{{! +@Size: just minItems +}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}) +{{/maxItems}}{{/minItems}}{{! +@Size: just maxItems +}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}) +{{/maxItems}}{{/minItems}}{{! +@Email +}}{{#isEmail}} @Email +{{/isEmail}}{{! +check for integer or long / all others=decimal type with @Decimal* +isInteger set +}}{{#isInteger}}{{#minimum}} @Min({{minimum}}) +{{/minimum}}{{#maximum}} @Max({{maximum}}) +{{/maximum}}{{/isInteger}}{{! +isLong set +}}{{#isLong}}{{#minimum}} @Min({{minimum}}L) +{{/minimum}}{{#maximum}} @Max({{maximum}}L) +{{/maximum}}{{/isLong}}{{! +Not Integer, not Long => we have a decimal value! +}}{{^isInteger}}{{^isLong}}{{! +minimum for decimal value +}}{{#minimum}} @DecimalMin({{#exclusiveMinimum}}value={{/exclusiveMinimum}}"{{minimum}}"{{#exclusiveMinimum}}, inclusive=false{{/exclusiveMinimum}}) +{{/minimum}}{{! +maximal for decimal value +}}{{#maximum}} @DecimalMax({{#exclusiveMaximum}}value={{/exclusiveMaximum}}"{{maximum}}"{{#exclusiveMaximum}}, inclusive=false{{/exclusiveMaximum}}) +{{/maximum}}{{! +close decimal values +}}{{/isLong}}{{/isInteger}}{{/useBeanValidation}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/jackson_annotations.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/jackson_annotations.mustache new file mode 100644 index 00000000000..b7f047ee540 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/jackson_annotations.mustache @@ -0,0 +1,26 @@ +{{! + If this is map and items are nullable, make sure that nulls are included. + To determine what JsonInclude.Include method to use, consider the following: + * If the field is required, always include it, even if it is null. + * Else use custom behaviour, IOW use whatever is defined on the object mapper + }} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + @JsonInclude({{#isMap}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMap}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}}) + {{#withXml}} + {{^isContainer}} + @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isContainer}} + {{#isContainer}} + {{#isXmlWrapped}} + // items.xmlName={{items.xmlName}} + @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") + {{/isXmlWrapped}} + {{/isContainer}} + {{/withXml}} + {{#isDateTime}} + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") + {{/isDateTime}} + {{#isDate}} + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + {{/isDate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/model.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/model.mustache new file mode 100644 index 00000000000..d9bf0572982 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/model.mustache @@ -0,0 +1,48 @@ +{{>licenseInfo}} +package {{package}}; + +{{#useReflectionEqualsHashCode}} +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +{{/useReflectionEqualsHashCode}} +import java.util.Objects; +import java.util.Arrays; +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +import com.fasterxml.jackson.annotation.*; +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +import com.fasterxml.jackson.annotation.*; +{{/withXml}} +{{#withXml}} +import javax.xml.bind.annotation.*; +{{/withXml}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}}{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +{{#models}} + {{#model}} + {{#isEnum}} +{{>model/modelEnum}} + {{/isEnum}} + {{^isEnum}} + {{#vendorExtensions.x-is-one-of-interface}} +{{>model/oneof_interface}} + {{/vendorExtensions.x-is-one-of-interface}} + {{^vendorExtensions.x-is-one-of-interface}} +{{>model/pojo}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/isEnum}} + {{/model}} +{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/modelEnum.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/modelEnum.mustache new file mode 100644 index 00000000000..3bb6622f08d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/modelEnum.mustache @@ -0,0 +1,61 @@ +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +{{/jackson}} + +/** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + */ +{{#additionalEnumTypeAnnotations}} +{{{.}}} +{{/additionalEnumTypeAnnotations}}{{#useBeanValidation}}@Introspected +{{/useBeanValidation}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { + {{#allowableValues}} + {{#enumVars}} + {{#enumDescription}} + /** + * {{enumDescription}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + {{/allowableValues}} + + private {{{dataType}}} value; + + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + {{#jackson}} + @JsonValue + {{/jackson}} + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + {{#jackson}} + @JsonCreator + {{/jackson}} + public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.equals(value)) { + return b; + } + } + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + {{/isNullable}} + } +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/modelInnerEnum.mustache new file mode 100644 index 00000000000..cd49673d015 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/modelInnerEnum.mustache @@ -0,0 +1,60 @@ + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + */ +{{#withXml}} + @XmlType(name="{{datatypeWithEnum}}") + @XmlEnum({{dataType}}.class) +{{/withXml}} +{{#additionalEnumTypeAnnotations}} + {{{.}}} +{{/additionalEnumTypeAnnotations}} + public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}} + {{#enumVars}} + {{#enumDescription}} + /** + * {{enumDescription}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + {{/allowableValues}} + + private {{{dataType}}} value; + + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + {{#jackson}} + @JsonValue + {{/jackson}} + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + {{#jackson}} + @JsonCreator + {{/jackson}} + public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.equals(value)) { + return b; + } + } + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + {{/isNullable}} + } + } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/oneof_interface.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/oneof_interface.mustache new file mode 100644 index 00000000000..ca0a063d6d8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/oneof_interface.mustache @@ -0,0 +1,9 @@ +{{#additionalModelTypeAnnotations}} +{{{.}}} +{{/additionalModelTypeAnnotations}} +{{>generatedAnnotation}}{{>model/typeInfoAnnotation}}{{>model/xmlAnnotation}} +public interface {{classname}} {{#vendorExtensions.x-implements}}{{#-first}}extends {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { + {{#discriminator}} + public {{propertyType}} {{propertyGetter}}(); + {{/discriminator}} +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/pojo.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/pojo.mustache new file mode 100644 index 00000000000..bcf8b1f1774 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/pojo.mustache @@ -0,0 +1,330 @@ +/** + * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} + */ +{{#description}} +@ApiModel(description = "{{{description}}}") +{{/description}} +{{#jackson}} +@JsonPropertyOrder({ + {{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} + {{/vars}} +}) +@JsonTypeName("{{name}}") +{{/jackson}} +{{#additionalModelTypeAnnotations}} +{{{.}}} +{{/additionalModelTypeAnnotations}} +{{>generatedAnnotation}}{{#discriminator}}{{>model/typeInfoAnnotation}}{{/discriminator}}{{>model/xmlAnnotation}}{{#useBeanValidation}} +@Introspected +{{/useBeanValidation}}{{! +Declare the class with extends and implements +}}public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ + {{#serializableModel}} + private static final long serialVersionUID = 1L; + + {{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>model/modelInnerEnum}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>model/modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{#withXml}} + {{#isXmlAttribute}} + @XmlAttribute(name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}" + {{/isXmlAttribute}} + {{^isXmlAttribute}} + {{^isContainer}} + @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isContainer}} + {{#isContainer}} + // Is a container wrapped={{isXmlWrapped}} + {{#items}} + // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} + // items.example={{example}} items.type={{dataType}} + @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/items}} + {{#isXmlWrapped}} + @XmlElementWrapper({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlWrapped}} + {{/isContainer}} + {{/isXmlAttribute}} + {{/withXml}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + {{/isContainer}} + {{^isContainer}} + {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/vars}} + {{#parcelableModel}} + public {{classname}}() { + {{#parent}} + super(); + {{/parent}} + } + + {{/parcelableModel}} + {{#vars}} + {{^isReadOnly}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + + {{#isArray}} + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().add({{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{/isArray}} + {{#isMap}} + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().put(key, {{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{/isMap}} + {{/isReadOnly}} + /** + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} + * @return {{name}} + **/ +{{>model/beanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") + {{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} + {{/vendorExtensions.x-extra-annotation}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} +{{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} @JsonIgnore + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#jackson}} +{{>model/jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isReadOnly}} +{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}} if ({{name}} == null) { + {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + } + {{/isReadOnly}} + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + return {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{#vendorExtensions.x-is-jackson-optional-nullable}} +{{>model/jackson_annotations}} + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + {{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}} this.{{name}} = {{name}}; + } + + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^isReadOnly}} + {{#jackson}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} +{{>model/jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{/isReadOnly}} + {{/vars}} + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + {{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{/-last}}{{/vars}}{{#parent}} && + super.equals(o){{/parent}}; + {{/hasVars}} + {{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}}; + {{/hasVars}} + {{/useReflectionEqualsHashCode}} + } + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + {{/useReflectionEqualsHashCode}} + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}} + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + {{#parcelableModel}} + public void writeToParcel(Parcel out, int flags) { + {{#model}} + {{#isArray}} + out.writeList(this); + {{/isArray}} + {{^isArray}} + {{#parent}} + super.writeToParcel(out, flags); + {{/parent}} + {{#vars}} + out.writeValue({{name}}); + {{/vars}} + {{/isArray}} + {{/model}} + } + + {{classname}}(Parcel in) { + {{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); + {{/isArray}} + {{^isArray}} + {{#parent}} + super(in); + {{/parent}} + {{#vars}} + {{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); + {{/isPrimitiveType}} + {{/vars}} + {{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { + {{#model}} + {{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; + {{/isArray}} + {{^isArray}} + return new {{classname}}(in); + {{/isArray}} + {{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; + {{/parcelableModel}} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/typeInfoAnnotation.mustache new file mode 100644 index 00000000000..63eb42ea500 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/typeInfoAnnotation.mustache @@ -0,0 +1,16 @@ +{{#jackson}} + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +{{#discriminator.mappedModels}} +{{#-first}} +@JsonSubTypes({ +{{/-first}} + @JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), +{{#-last}} +}) +{{/-last}} +{{/discriminator.mappedModels}} +{{#isClassnameSanitized}} +@JsonTypeName("{{name}}") +{{/isClassnameSanitized}} +{{/jackson}} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model/xmlAnnotation.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/xmlAnnotation.mustache new file mode 100644 index 00000000000..04566fa1167 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model/xmlAnnotation.mustache @@ -0,0 +1,6 @@ +{{#withXml}} + +@XmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}") +@XmlAccessorType(XmlAccessType.FIELD) +{{#jackson}} +@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}"){{/jackson}}{{/withXml}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model_test.groovy.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model_test.groovy.mustache new file mode 100644 index 00000000000..fd5068a0947 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model_test.groovy.mustache @@ -0,0 +1,46 @@ +package {{package}} + +{{#imports}}import {{import}} +{{/imports}} +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject +{{#fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +/** + * Model tests for {{classname}} + */ +@MicronautTest +public class {{classname}}Spec extends Specification { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}() + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + void '{{classname}} test'() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + void '{{classname}} property {{name}} test'() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/model_test.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/model_test.mustache new file mode 100644 index 00000000000..7a213ec56fa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/model_test.mustache @@ -0,0 +1,49 @@ +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Assertions; + +{{#fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +/** + * Model tests for {{classname}} + */ +@MicronautTest +public class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + public void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + public void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/beanValidation.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/beanValidation.mustache new file mode 100644 index 00000000000..6fd7a75b066 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/beanValidation.mustache @@ -0,0 +1,34 @@ +{{#useBeanValidation}}{{! +validate all pojos and enums +}}{{^isContainer}}{{#isModel}}@Valid {{/isModel}}{{/isContainer}}{{! +nullable & nonnull +}}{{#required}}@NotNull {{/required}}{{#isNullable}}@Nullable {{/isNullable}}{{! +pattern +}}{{#pattern}}{{^isByteArray}}@Pattern(regexp="{{{pattern}}}") {{/isByteArray}}{{/pattern}}{{! +both minLength && maxLength +}}{{#minLength}}{{#maxLength}}@Size(min={{minLength}}, max={{maxLength}}) {{/maxLength}}{{/minLength}}{{! +just minLength +}}{{#minLength}}{{^maxLength}}@Size(min={{minLength}}) {{/maxLength}}{{/minLength}}{{! +just maxLength +}}{{^minLength}}{{#maxLength}}@Size(max={{maxLength}}) {{/maxLength}}{{/minLength}}{{! +@Size: both minItems && maxItems +}}{{#minItems}}{{#maxItems}}@Size(min={{minItems}}, max={{maxItems}}) {{/maxItems}}{{/minItems}}{{! +@Size: just minItems +}}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}) {{/maxItems}}{{/minItems}}{{! +@Size: just maxItems +}}{{^minItems}}{{#maxItems}}@Size(max={{maxItems}}) {{/maxItems}}{{/minItems}}{{! +@Email +}}{{#isEmail}}@Email{{/isEmail}}{{! +check for integer or long / all others=decimal type with @Decimal* +isInteger set +}}{{#isInteger}}{{#minimum}}@Min({{minimum}}) {{/minimum}}{{#maximum}}@Max({{maximum}}) {{/maximum}}{{/isInteger}}{{! +isLong set +}}{{#isLong}}{{#minimum}}@Min({{minimum}}L) {{/minimum}}{{#maximum}}@Max({{maximum}}L) {{/maximum}}{{/isLong}}{{! +Not Integer, not Long => we have a decimal value! +}}{{^isInteger}}{{^isLong}}{{! +minimum for decimal value +}}{{#minimum}}@DecimalMin({{#exclusiveMinimum}}value={{/exclusiveMinimum}}"{{minimum}}"{{#exclusiveMinimum}}, inclusive=false{{/exclusiveMinimum}}) {{/minimum}}{{! +maximal for decimal value +}}{{#maximum}}@DecimalMax({{#exclusiveMaximum}}value={{/exclusiveMaximum}}"{{maximum}}"{{#exclusiveMaximum}}, inclusive=false{{/exclusiveMaximum}}) {{/maximum}}{{! +close decimal values +}}{{/isLong}}{{/isInteger}}{{/useBeanValidation}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/bodyParams.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/bodyParams.mustache new file mode 100644 index 00000000000..b111ea9e05d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/bodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}@Body {{>params/beanValidation}}{{>params/type}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/cookieParams.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/cookieParams.mustache new file mode 100644 index 00000000000..fab940b7460 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/cookieParams.mustache @@ -0,0 +1 @@ +{{#isCookieParam}}@CookieValue(value="{{baseName}}"{{#defaultValue}}, defaultValue="{{defaultValue}}"{{/defaultValue}}) {{>params/beanValidationCore}}{{>params/type}} {{paramName}}{{/isCookieParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/formParams.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/formParams.mustache new file mode 100644 index 00000000000..e41f37e421f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/formParams.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{>params/beanValidation}}{{>params/type}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/headerParams.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/headerParams.mustache new file mode 100644 index 00000000000..9aab83b5462 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}@Header(name="{{baseName}}"{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{>params/beanValidation}}{{>params/type}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/pathParams.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/pathParams.mustache new file mode 100644 index 00000000000..c67b97ed3f6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/pathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}@PathVariable(name="{{baseName}}"{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{>params/beanValidation}}{{>params/type}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/queryParams.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/queryParams.mustache new file mode 100644 index 00000000000..7ef44500582 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/queryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}@QueryParam(name="{{{baseName}}}"{{!default value}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}{{!multi format}}{{#isCollectionFormatMulti}}, format=QueryParam.Format.MULTI{{/isCollectionFormatMulti}}{{!deep object}}{{#isDeepObject}}, format=QueryParam.Format.DEEP_OBJECT{{/isDeepObject}}{{!other collection formats}}{{^isCollectionFormatMulti}}{{^isDeepObject}}{{#collectionFormat}}, format=QueryParam.Format.{{#lambda.uppercase}}{{collectionFormat}}{{/lambda.uppercase}}{{/collectionFormat}}{{/isDeepObject}}{{/isCollectionFormatMulti}}) {{!validation and type}}{{>params/beanValidation}}{{>params/type}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/params/type.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/type.mustache new file mode 100644 index 00000000000..e8a56ad01d8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/params/type.mustache @@ -0,0 +1 @@ +{{!normal type}}{{^isDate}}{{^isDateTime}}{{{dataType}}}{{/isDateTime}}{{/isDate}}{{!date-time}}{{#isDateTime}}@Format("yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") {{{dataType}}}{{/isDateTime}}{{!date}}{{#isDate}}@Format("yyyy-MM-dd") {{{dataType}}}{{/isDate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/query/QueryParam.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/query/QueryParam.mustache new file mode 100644 index 00000000000..343602f340b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/query/QueryParam.mustache @@ -0,0 +1,78 @@ +{{>licenseInfo}} +package {{invokerPackage}}.query; + +import io.micronaut.context.annotation.AliasFor; +import io.micronaut.core.bind.annotation.Bindable; +import javax.annotation.Generated; +import java.lang.annotation.*; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + + +/** + * Indicates that the parameter is a query parameter + */ +{{>generatedAnnotation}} +@Documented +@Retention(RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE}) +@Bindable +@Inherited +public @interface QueryParam { + + /** + * @return The name of the parameter + */ + @AliasFor(annotation = Bindable.class, member = "value") + String value() default ""; + + /** + * @return The name of the parameter + */ + @AliasFor(annotation = Bindable.class, member = "value") + String name() default ""; + + /** + * @see Bindable#defaultValue() + * @return The default value + */ + @AliasFor(annotation = Bindable.class, member = "defaultValue") + String defaultValue() default ""; + + /** + * @return The format of the given values in the URL + */ + Format format() default Format.CSV; + + /** + * The possible formats of the query parameter in the URL. + * The conversion of various types is according to openapi v3 specification: + * @see openapi v3 specification + * Values are serialized using Jackson object mapper + */ + public static enum Format { + /** + * The values of iterator are comma-delimited. + * Ambiguity can arise if values of Iterator contain commas inside themselves. In such case, the MUTLI format + * should be preferred. + * Null values are not supported and will be removed during the conversion process. + */ + CSV, + /** + * The values are space-delimited, similarly to comma-delimited format. + */ + SSV, + /** + * The values a delimited by pipes "|", similarly to comma-delimited format. + */ + PIPES, + /** + * The values are repeated as separate parameters, e.g.: color=blue&color=black&color=brown. + */ + MULTI, + /** + * The format supports 1-depth recursion into objects with setting each attribute as a separate parameter, e.g.: + * 'color[R]=100&color[G]=200&color[B]=150'. + */ + DEEP_OBJECT + } +} diff --git a/modules/openapi-generator/src/main/resources/java-micronaut-client/query/QueryParamBinder.mustache b/modules/openapi-generator/src/main/resources/java-micronaut-client/query/QueryParamBinder.mustache new file mode 100644 index 00000000000..66ac28ad189 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-micronaut-client/query/QueryParamBinder.mustache @@ -0,0 +1,164 @@ +{{>licenseInfo}} +package {{invokerPackage}}.query; + +import io.micronaut.core.annotation.NonNull; +import io.micronaut.core.beans.BeanProperty; +import io.micronaut.core.beans.BeanWrapper; +import io.micronaut.core.convert.ArgumentConversionContext; +import io.micronaut.core.convert.ConversionContext; +import io.micronaut.core.convert.ConversionService; +import io.micronaut.core.util.StringUtils; +import io.micronaut.http.MutableHttpRequest; +import io.micronaut.http.client.bind.AnnotatedClientArgumentRequestBinder; +import io.micronaut.http.client.bind.ClientRequestUriContext; + +import java.util.Collection; +import java.util.Optional; +import jakarta.inject.Singleton; +import javax.annotation.Generated; + + +{{>generatedAnnotation}} +@Singleton +public class QueryParamBinder implements AnnotatedClientArgumentRequestBinder { + private static final Character COMMA_DELIMITER = ','; + private static final Character PIPE_DELIMITER = '|'; + private static final Character SPACE_DELIMITER = ' '; + + private final ConversionService conversionService; + + public QueryParamBinder(ConversionService conversionService) { + this.conversionService = conversionService; + } + + @NonNull + @Override + public Class getAnnotationType() { + return QueryParam.class; + } + + @Override + public void bind(@NonNull ArgumentConversionContext context, + @NonNull ClientRequestUriContext uriContext, + @NonNull Object value, + @NonNull MutableHttpRequest request + ) { + String key = context.getAnnotationMetadata().stringValue(QueryParam.class) + .filter(StringUtils::isNotEmpty) + .orElse(context.getArgument().getName()); + + QueryParam.Format format = context.getAnnotationMetadata() + .enumValue(QueryParam.class, "format", QueryParam.Format.class) + .orElse(QueryParam.Format.CSV); + + if (format == QueryParam.Format.DEEP_OBJECT) { + addDeepObjectParameters(context, value, key, uriContext); + } else if (format == QueryParam.Format.MULTI) { + addMultiParameters(context, value, key, uriContext); + } else { + Character delimiter = ' '; + switch (format) { + case SSV: + delimiter = SPACE_DELIMITER; + break; + case PIPES: + delimiter = PIPE_DELIMITER; + break; + case CSV: + delimiter = COMMA_DELIMITER; + break; + default: + } + createSeparatedQueryParam(context, value, delimiter) + .ifPresent(v -> uriContext.addQueryParameter(key, v)); + } + } + + private void addMultiParameters( + ArgumentConversionContext context, Object value, String key, ClientRequestUriContext uriContext + ) { + if (value instanceof Iterable) { + // noinspection unechecked + Iterable iterable = (Iterable) value; + + for (Object item : iterable) { + convertToString(context, item).ifPresent(v -> uriContext.addQueryParameter(key, v)); + } + } else { + convertToString(context, value).ifPresent(v -> uriContext.addQueryParameter(key, v)); + } + } + + private void addDeepObjectParameters( + ArgumentConversionContext context, Object value, String key, ClientRequestUriContext uriContext + ) { + if (value instanceof Iterable) { + StringBuilder builder = new StringBuilder(key); + + Iterable iterable = (Iterable) value; + + int i = 0; + for (Object item: iterable) { + if (item == null) { + continue; + } + String index = String.valueOf(i); + + builder.append('['); + builder.append(index); + builder.append(']'); + + convertToString(context, item).ifPresent(v -> uriContext.addQueryParameter(builder.toString(), v)); + builder.delete(builder.length() - index.length() - 2, builder.length()); + i++; + } + } else if (value != null) { + StringBuilder builder = new StringBuilder(key); + BeanWrapper wrapper = BeanWrapper.getWrapper(value); + Collection> properties = wrapper.getBeanProperties(); + for (BeanProperty property: properties) { + Object item = property.get(value); + if (item == null) { + continue; + } + builder.append('['); + builder.append(property.getName()); + builder.append(']'); + + convertToString(context, item).ifPresent(v -> uriContext.addQueryParameter(builder.toString(), v)); + builder.delete(builder.length() - property.getName().length() - 2, builder.length()); + } + } + } + + private Optional createSeparatedQueryParam( + ArgumentConversionContext context, Object value, Character delimiter + ) { + if (value instanceof Iterable) { + StringBuilder builder = new StringBuilder(); + // noinspection unechecked + Iterable iterable = (Iterable) value; + + boolean first = true; + for (Object item : iterable) { + Optional opt = convertToString(context, item); + if (opt.isPresent()) { + if (!first) { + builder.append(delimiter); + } + first = false; + builder.append(opt.get()); + } + } + + return Optional.of(builder.toString()); + } else { + return convertToString(context, value); + } + } + + private Optional convertToString(ArgumentConversionContext context, Object value) { + return conversionService.convert(value, ConversionContext.STRING.with(context.getAnnotationMetadata())) + .filter(StringUtils::isNotEmpty); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/micronaut/MicronautClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/micronaut/MicronautClientCodegenTest.java new file mode 100644 index 00000000000..16e65c34c5b --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/micronaut/MicronautClientCodegenTest.java @@ -0,0 +1,250 @@ +package org.openapitools.codegen.java.micronaut; + +import io.swagger.parser.OpenAPIParser; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.servers.Server; +import io.swagger.v3.parser.core.models.ParseOptions; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.languages.JavaMicronautClientCodegen; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +import static java.util.stream.Collectors.groupingBy; +import static org.testng.Assert.*; +import static org.testng.Assert.fail; + +public class MicronautClientCodegenTest { + private final String PETSTORE_PATH = "src/test/resources/petstore.json"; + + @Test + public void clientOptsUnicity() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.cliOptions() + .stream() + .collect(groupingBy(CliOption::getOpt)) + .forEach((k, v) -> assertEquals(v.size(), 1, k + " is described multiple times")); + } + + @Test + public void testInitialConfigValues() throws Exception { + final JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.processOpts(); + + OpenAPI openAPI = new OpenAPI(); + openAPI.addServersItem(new Server().url("https://one.com/v2")); + openAPI.setInfo(new Info()); + codegen.preprocessOpenAPI(openAPI); + + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE); + Assert.assertEquals(codegen.isHideGenerationTimestamp(), false); + Assert.assertEquals(codegen.modelPackage(), "org.openapitools.model"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "org.openapitools.model"); + Assert.assertEquals(codegen.apiPackage(), "org.openapitools.api"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "org.openapitools.api"); + Assert.assertEquals(codegen.getInvokerPackage(), "org.openapitools"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "org.openapitools"); + } + + @Test + public void doConfigureAuthParam() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_CONFIGURE_AUTH, "true"); + String outputPath = generateFiles(codegen, PETSTORE_PATH, + CodegenConstants.SUPPORTING_FILES, + CodegenConstants.APIS); + + // Files generated + assertFileExists(outputPath + "/src/main/java/org/openapitools/auth/Authorization.java"); + // Endpoints are annotated with @Authorization Bindable + assertFileContains(outputPath + "/src/main/java/org/openapitools/api/PetApi.java", "@Authorization"); + } + + @Test + public void doNotConfigureAuthParam() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_CONFIGURE_AUTH, "false"); + String outputPath = generateFiles(codegen, PETSTORE_PATH, + CodegenConstants.SUPPORTING_FILES, + CodegenConstants.APIS); + + // Files are not generated + assertFileNotExists(outputPath + "/src/main/java/org/openapitools/auth/"); + assertFileNotContains(outputPath + "/src/main/java/org/openapitools/api/PetApi.java", "@Authorization"); + } + + @Test + public void doUseValidationParam() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_CONFIGURE_AUTH, "false"); + String outputPath = generateFiles(codegen, PETSTORE_PATH, + CodegenConstants.APIS); + + // Files are not generated + assertFileContains(outputPath + "/src/main/java/org/openapitools/api/PetApi.java", "@Valid"); + assertFileContains(outputPath + "/src/main/java/org/openapitools/api/PetApi.java", "@NotNull"); + } + + @Test + public void doGenerateForMaven() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_BUILD, + JavaMicronautClientCodegen.OPT_BUILD_MAVEN); + String outputPath = generateFiles(codegen, PETSTORE_PATH, + CodegenConstants.SUPPORTING_FILES); + + // Files are not generated + assertFileExists(outputPath + "/pom.xml"); + assertFileNotExists(outputPath + "/build.gradle"); + } + + @Test + public void doGenerateForGradle() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_BUILD, + JavaMicronautClientCodegen.OPT_BUILD_GRADLE); + String outputPath = generateFiles(codegen, PETSTORE_PATH, + CodegenConstants.SUPPORTING_FILES); + + // Files are not generated + assertFileExists(outputPath + "/build.gradle"); + assertFileNotExists(outputPath + "/pom.xml"); + } + + @Test + public void doGenerateForTestJUnit() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_BUILD, + JavaMicronautClientCodegen.OPT_BUILD_ALL); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_TEST, + JavaMicronautClientCodegen.OPT_TEST_JUNIT); + String outputPath = generateFiles(codegen, PETSTORE_PATH, + CodegenConstants.SUPPORTING_FILES, + CodegenConstants.API_TESTS, CodegenConstants.APIS, CodegenConstants.MODELS); + + // Files are not generated + assertFileContains(outputPath + "build.gradle", "testRuntime(\"junit"); + assertFileContains(outputPath + "pom.xml", "micronaut-test-junit"); + assertFileNotContains(outputPath + "build.gradle", "testRuntime(\"spock"); + assertFileNotContains(outputPath + "pom.xml", "micronaut-test-spock"); + assertFileExists(outputPath + "src/test/java/"); + assertFileExists(outputPath + "src/test/java/org/openapitools/api/PetApiTest.java"); + assertFileContains(outputPath + "src/test/java/org/openapitools/api/PetApiTest.java", "PetApiTest", "@MicronautTest"); + } + + @Test + public void doGenerateForTestSpock() { + JavaMicronautClientCodegen codegen = new JavaMicronautClientCodegen(); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_BUILD, + JavaMicronautClientCodegen.OPT_BUILD_ALL); + codegen.additionalProperties().put(JavaMicronautClientCodegen.OPT_TEST, + JavaMicronautClientCodegen.OPT_TEST_SPOCK); + String outputPath = generateFiles(codegen, PETSTORE_PATH, + CodegenConstants.SUPPORTING_FILES, + CodegenConstants.API_TESTS, CodegenConstants.APIS, CodegenConstants.MODELS); + + // Files are not generated + assertFileNotContains(outputPath + "build.gradle", "testRuntime(\"junit"); + assertFileNotContains(outputPath + "pom.xml", "micronaut-test-junit"); + assertFileContains(outputPath + "build.gradle", "testRuntime(\"spock"); + assertFileContains(outputPath + "pom.xml", "micronaut-test-spock"); + assertFileExists(outputPath + "src/test/groovy"); + assertFileExists(outputPath + "src/test/groovy/org/openapitools/api/PetApiSpec.groovy"); + assertFileContains(outputPath + "src/test/groovy/org/openapitools/api/PetApiSpec.groovy", "PetApiSpec", "@MicronautTest"); + } + + /** + * + * @param codegen - the code generator + * @param configPath - the path to the config starting from src/test/resources + * @param filesToGenerate - which files to generate - can be CodegenConstants.MODELS, APIS, SUPPORTING_FILES, ... + * @return - the path to the generated folder + */ + protected String generateFiles(JavaMicronautClientCodegen codegen, String configPath, String... filesToGenerate) { + File output = null; + try { + output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + } catch (IOException e) { + fail("Unable to create temporary directory for output"); + } + output.deleteOnExit(); + + // Create parser + String outputPath = output.getAbsolutePath().replace('\\', '/'); + OpenAPI openAPI = new OpenAPIParser() + .readLocation(configPath, null, new ParseOptions()).getOpenAPI(); + + // Configure codegen + codegen.setOutputDir(outputPath); + + // Create input + ClientOptInput input = new ClientOptInput(); + input.openAPI(openAPI); + input.config(codegen); + + // Generate + DefaultGenerator generator = new DefaultGenerator(); + // by default nothing is generated + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.API_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.API_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + // set all the files user wants to generate + for (String files: filesToGenerate) { + generator.setGeneratorPropertyDefault(files, "true"); + } + + generator.opts(input).generate(); + + return outputPath + "/"; + } + + public static void assertFileContains(String path, String... lines) { + String file = readFile(path); + for (String line : lines) + assertTrue(file.contains(linearize(line)), "File does not contain line [" + line + "]"); + } + + public static void assertFileNotContains(String path, String... lines) { + String file = readFile(path); + for (String line : lines) + assertFalse(file.contains(linearize(line)), "File contains line [" + line + "]"); + } + + public static void assertFileExists(String path) { + assertTrue(Paths.get(path).toFile().exists(), "File \"" + path + "\" should exist"); + } + + public static void assertFileNotExists(String path) { + assertFalse(Paths.get(path).toFile().exists(), "File \"" + path + "\" should not exist"); + } + + public static String readFile(String path) { + String file = null; + try { + String generatedFile = new String(Files.readAllBytes(Paths.get(path)), StandardCharsets.UTF_8); + file = linearize(generatedFile); + assertNotNull(file); + } catch (IOException e) { + fail("Unable to evaluate file " + path.toString()); + } + + return file; + } + + public static String linearize(String target) { + return target.replaceAll("\r?\n", "").replaceAll("\\s+", "\\s"); + } +} diff --git a/pom.xml b/pom.xml index 38449ea2435..9e91c087a86 100644 --- a/pom.xml +++ b/pom.xml @@ -775,6 +775,18 @@ samples/client/petstore/scala-httpclient + + java-micronaut-client + + + env + java + + + + samples/client/petstore/java-micronaut-client + + java-msf4j-server diff --git a/samples/client/petstore/java-micronaut-client/.gitignore b/samples/client/petstore/java-micronaut-client/.gitignore new file mode 100644 index 00000000000..a530464afa1 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java-micronaut-client/.mvn/wrapper/MavenWrapperDownloader.java b/samples/client/petstore/java-micronaut-client/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 00000000000..fc435c409b3 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,124 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/.mvn/wrapper/maren-wrapper.properties b/samples/client/petstore/java-micronaut-client/.mvn/wrapper/maren-wrapper.properties new file mode 100644 index 00000000000..642d572ce90 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/.mvn/wrapper/maren-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/samples/client/petstore/java-micronaut-client/.openapi-generator-ignore b/samples/client/petstore/java-micronaut-client/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java-micronaut-client/.openapi-generator/FILES b/samples/client/petstore/java-micronaut-client/.openapi-generator/FILES new file mode 100644 index 00000000000..049c3b6f038 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/.openapi-generator/FILES @@ -0,0 +1,123 @@ +.gitignore +.mvn/wrapper/MavenWrapperDownloader.java +.mvn/wrapper/maren-wrapper.properties +.mvn/wrapper/maven-wrapper.jar +README.md +build.gradle +docs/AdditionalPropertiesAnyType.md +docs/AdditionalPropertiesArray.md +docs/AdditionalPropertiesBoolean.md +docs/AdditionalPropertiesClass.md +docs/AdditionalPropertiesInteger.md +docs/AdditionalPropertiesNumber.md +docs/AdditionalPropertiesObject.md +docs/AdditionalPropertiesString.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfNumberOnly.md +docs/ArrayTest.md +docs/BigCat.md +docs/BigCatAllOf.md +docs/Capitalization.md +docs/Cat.md +docs/CatAllOf.md +docs/Category.md +docs/ClassModel.md +docs/Dog.md +docs/DogAllOf.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumTest.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FileSchemaTestClass.md +docs/FormatTest.md +docs/HasOnlyReadOnly.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelClient.md +docs/ModelReturn.md +docs/Name.md +docs/NumberOnly.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/Pet.md +docs/PetApi.md +docs/ReadOnlyFirst.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/TypeHolderDefault.md +docs/TypeHolderExample.md +docs/User.md +docs/UserApi.md +docs/XmlItem.md +docs/auth.md +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +mvnw +mvnw.bat +pom.xml +settings.gradle +src/main/java/org/openapitools/api/AnotherFakeApi.java +src/main/java/org/openapitools/api/FakeApi.java +src/main/java/org/openapitools/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/api/PetApi.java +src/main/java/org/openapitools/api/StoreApi.java +src/main/java/org/openapitools/api/UserApi.java +src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java +src/main/java/org/openapitools/model/AdditionalPropertiesArray.java +src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java +src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java +src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java +src/main/java/org/openapitools/model/AdditionalPropertiesObject.java +src/main/java/org/openapitools/model/AdditionalPropertiesString.java +src/main/java/org/openapitools/model/Animal.java +src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/model/ArrayTest.java +src/main/java/org/openapitools/model/BigCat.java +src/main/java/org/openapitools/model/BigCatAllOf.java +src/main/java/org/openapitools/model/Capitalization.java +src/main/java/org/openapitools/model/Cat.java +src/main/java/org/openapitools/model/CatAllOf.java +src/main/java/org/openapitools/model/Category.java +src/main/java/org/openapitools/model/ClassModel.java +src/main/java/org/openapitools/model/Dog.java +src/main/java/org/openapitools/model/DogAllOf.java +src/main/java/org/openapitools/model/EnumArrays.java +src/main/java/org/openapitools/model/EnumClass.java +src/main/java/org/openapitools/model/EnumTest.java +src/main/java/org/openapitools/model/FileSchemaTestClass.java +src/main/java/org/openapitools/model/FormatTest.java +src/main/java/org/openapitools/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/model/MapTest.java +src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/model/Model200Response.java +src/main/java/org/openapitools/model/ModelApiResponse.java +src/main/java/org/openapitools/model/ModelClient.java +src/main/java/org/openapitools/model/ModelReturn.java +src/main/java/org/openapitools/model/Name.java +src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/Order.java +src/main/java/org/openapitools/model/OuterComposite.java +src/main/java/org/openapitools/model/OuterEnum.java +src/main/java/org/openapitools/model/Pet.java +src/main/java/org/openapitools/model/ReadOnlyFirst.java +src/main/java/org/openapitools/model/SpecialModelName.java +src/main/java/org/openapitools/model/Tag.java +src/main/java/org/openapitools/model/TypeHolderDefault.java +src/main/java/org/openapitools/model/TypeHolderExample.java +src/main/java/org/openapitools/model/User.java +src/main/java/org/openapitools/model/XmlItem.java +src/main/java/org/openapitools/query/QueryParam.java +src/main/java/org/openapitools/query/QueryParamBinder.java +src/main/resources/application.yml diff --git a/samples/client/petstore/java-micronaut-client/.openapi-generator/VERSION b/samples/client/petstore/java-micronaut-client/.openapi-generator/VERSION new file mode 100644 index 00000000000..6555596f931 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java-micronaut-client/README.md b/samples/client/petstore/java-micronaut-client/README.md new file mode 100644 index 00000000000..a61167f1d20 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/README.md @@ -0,0 +1,49 @@ +# petstore-micronaut + +This is a generated client based on [Micronaut](https://micronaut.io/) framework. + +## Configuration + +A Micronaut's application can be created by defyning a main class and running: +```java +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; + +public class Application { + + public static void main(String[] args) { + ApplicationContext context = Micronaut.run(Application.class); + } +} +``` + +More detailed description can be found in the [Micronaut Guide](https://docs.micronaut.io/latest/guide/#ideSetup). + +All the properties can be changed in the [application.yml][src/main/resources/application.yml] file or when creating micronaut application as described in [Configuration section of guide](https://docs.micronaut.io/latest/guide/#config). + +## Api Guides + +Description on how to create Apis is given inside individual api guides: + +* [AnotherFakeApi](docs//AnotherFakeApi.md) +* [FakeApi](docs//FakeApi.md) +* [FakeClassnameTags123Api](docs//FakeClassnameTags123Api.md) +* [PetApi](docs//PetApi.md) +* [StoreApi](docs//StoreApi.md) +* [UserApi](docs//UserApi.md) + + +## Auth methods + +Details on auth methods can be found in the [auth.md](doc/auth.md). + +## Author + + + + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/build.gradle b/samples/client/petstore/java-micronaut-client/build.gradle new file mode 100644 index 00000000000..856fe2d4349 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/build.gradle @@ -0,0 +1,44 @@ +plugins { + id("groovy") + id("com.github.johnrengelman.shadow") version "7.0.0" + id("io.micronaut.application") version "2.0.3" +} + +version = "1.0.0" +group = "org.openapitools" + +repositories { + mavenCentral() +} + +micronaut { + runtime("netty") + testRuntime("spock2") + processing { + incremental(true) + annotations("org.openapitools.*") + } +} + + +dependencies { + annotationProcessor("io.micronaut:micronaut-http-validation") + annotationProcessor("io.micronaut.security:micronaut-security-annotations") + implementation("io.micronaut:micronaut-http-client") + implementation("io.micronaut:micronaut-runtime") + implementation("io.micronaut:micronaut-validation") + 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") +} + +// TODO Set the main class +application { + mainClass.set("org.openapitools.Application") +} +java { + sourceCompatibility = JavaVersion.toVersion("1.8") + targetCompatibility = JavaVersion.toVersion("1.8") +} diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 00000000000..fddcd9d8e0f --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,16 @@ + + +# AdditionalPropertiesAnyType + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesArray.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesArray.md new file mode 100644 index 00000000000..c52113f687b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesArray.md @@ -0,0 +1,16 @@ + + +# AdditionalPropertiesArray + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesBoolean.md new file mode 100644 index 00000000000..9d626b44668 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesBoolean.md @@ -0,0 +1,16 @@ + + +# AdditionalPropertiesBoolean + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..84f88e3fdba --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesClass.md @@ -0,0 +1,26 @@ + + +# AdditionalPropertiesClass + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapString** | `Map<String, String>` | | [optional property] +**mapNumber** | `Map<String, BigDecimal>` | | [optional property] +**mapInteger** | `Map<String, Integer>` | | [optional property] +**mapBoolean** | `Map<String, Boolean>` | | [optional property] +**mapArrayInteger** | `Map<String, List<Integer>>` | | [optional property] +**mapArrayAnytype** | `Map<String, List<Object>>` | | [optional property] +**mapMapString** | `Map<String, Map<String, String>>` | | [optional property] +**mapMapAnytype** | `Map<String, Map<String, Object>>` | | [optional property] +**anytype1** | `Object` | | [optional property] +**anytype2** | `Object` | | [optional property] +**anytype3** | `Object` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesInteger.md new file mode 100644 index 00000000000..b17edb55655 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesInteger.md @@ -0,0 +1,16 @@ + + +# AdditionalPropertiesInteger + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesNumber.md new file mode 100644 index 00000000000..bd33c906eeb --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesNumber.md @@ -0,0 +1,16 @@ + + +# AdditionalPropertiesNumber + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesObject.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesObject.md new file mode 100644 index 00000000000..a77d38c7b19 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesObject.md @@ -0,0 +1,16 @@ + + +# AdditionalPropertiesObject + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesString.md b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesString.md new file mode 100644 index 00000000000..6f1ccd0910d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AdditionalPropertiesString.md @@ -0,0 +1,16 @@ + + +# AdditionalPropertiesString + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Animal.md b/samples/client/petstore/java-micronaut-client/docs/Animal.md new file mode 100644 index 00000000000..4d92e8e7e29 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Animal.md @@ -0,0 +1,17 @@ + + +# Animal + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | `String` | | +**color** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/AnotherFakeApi.md b/samples/client/petstore/java-micronaut-client/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..df06b72730b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/AnotherFakeApi.md @@ -0,0 +1,62 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags + + +## Creating AnotherFakeApi + +To initiate an instance of `AnotherFakeApi`, you can use micronaut's `ApplicationContext`: +```java +/* imports +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; +import org.openapitools.api.AnotherFakeApi; +*/ + +ApplicationContext context = Micronaut.run(/* ... */); +PetApi apiInstance = context.getBean(AnotherFakeApi.class); +``` + +Or the `@Inject` annotation: +```java +@Singleton +class MyClass { + @Inject + AnotherFakeApi anotherFakeApi; + + /* ... use the injected variable */ +} +``` +Note that the class needs to be annotated with one of Micronaut's [scope annotations](https://docs.micronaut.io/latest/guide/#scopes) like `Singleton` in order to be processed. + +More information can be found inside [Inversion of Control guide section](https://docs.micronaut.io/latest/guide/#ioc). + + +# **call123testSpecialTags** +```java +Mono AnotherFakeApi.call123testSpecialTags(_body) +``` + +To test special tags + +To test special tags and operation ID starting with number + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**ModelClient**](ModelClient.md)| client model | + + +### Return type +[**ModelClient**](ModelClient.md) + + + +### HTTP request headers + - **Content-Type**: `application/json` + - **Accept**: `application/json` + diff --git a/samples/client/petstore/java-micronaut-client/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java-micronaut-client/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..65f6fb827f1 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,16 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | `List<List<BigDecimal>>` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java-micronaut-client/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..2909608f6e8 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ArrayOfNumberOnly.md @@ -0,0 +1,16 @@ + + +# ArrayOfNumberOnly + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | `List<BigDecimal>` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/ArrayTest.md b/samples/client/petstore/java-micronaut-client/docs/ArrayTest.md new file mode 100644 index 00000000000..ee3f7633b28 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ArrayTest.md @@ -0,0 +1,18 @@ + + +# ArrayTest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | `List<String>` | | [optional property] +**arrayArrayOfInteger** | `List<List<Long>>` | | [optional property] +**arrayArrayOfModel** | `List<List<ReadOnlyFirst>>` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/BigCat.md b/samples/client/petstore/java-micronaut-client/docs/BigCat.md new file mode 100644 index 00000000000..e368f81567f --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/BigCat.md @@ -0,0 +1,26 @@ + + +# BigCat + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional property] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | `"lions"` +TIGERS | `"tigers"` +LEOPARDS | `"leopards"` +JAGUARS | `"jaguars"` + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/BigCatAllOf.md b/samples/client/petstore/java-micronaut-client/docs/BigCatAllOf.md new file mode 100644 index 00000000000..869236ae81d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/BigCatAllOf.md @@ -0,0 +1,26 @@ + + +# BigCatAllOf + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional property] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | `"lions"` +TIGERS | `"tigers"` +LEOPARDS | `"leopards"` +JAGUARS | `"jaguars"` + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Capitalization.md b/samples/client/petstore/java-micronaut-client/docs/Capitalization.md new file mode 100644 index 00000000000..fb5232d52de --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Capitalization.md @@ -0,0 +1,21 @@ + + +# Capitalization + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | `String` | | [optional property] +**capitalCamel** | `String` | | [optional property] +**smallSnake** | `String` | | [optional property] +**capitalSnake** | `String` | | [optional property] +**scAETHFlowPoints** | `String` | | [optional property] +**ATT_NAME** | `String` | Name of the pet | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Cat.md b/samples/client/petstore/java-micronaut-client/docs/Cat.md new file mode 100644 index 00000000000..4a7e1503b1e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Cat.md @@ -0,0 +1,16 @@ + + +# Cat + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | `Boolean` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/CatAllOf.md b/samples/client/petstore/java-micronaut-client/docs/CatAllOf.md new file mode 100644 index 00000000000..41f0898e7c0 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/CatAllOf.md @@ -0,0 +1,16 @@ + + +# CatAllOf + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | `Boolean` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Category.md b/samples/client/petstore/java-micronaut-client/docs/Category.md new file mode 100644 index 00000000000..497a0ce8d45 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Category.md @@ -0,0 +1,17 @@ + + +# Category + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | `Long` | | [optional property] +**name** | `String` | | + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/ClassModel.md b/samples/client/petstore/java-micronaut-client/docs/ClassModel.md new file mode 100644 index 00000000000..e428f3bc207 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ClassModel.md @@ -0,0 +1,17 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyClass** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Dog.md b/samples/client/petstore/java-micronaut-client/docs/Dog.md new file mode 100644 index 00000000000..db403946fcd --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Dog.md @@ -0,0 +1,16 @@ + + +# Dog + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/DogAllOf.md b/samples/client/petstore/java-micronaut-client/docs/DogAllOf.md new file mode 100644 index 00000000000..e89dd640696 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/DogAllOf.md @@ -0,0 +1,16 @@ + + +# DogAllOf + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/EnumArrays.md b/samples/client/petstore/java-micronaut-client/docs/EnumArrays.md new file mode 100644 index 00000000000..f905c2dab35 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/EnumArrays.md @@ -0,0 +1,33 @@ + + +# EnumArrays + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional property] +**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional property] + + + +## Enum: JustSymbolEnum + +Name | Value +---- | ----- +GREATER_THAN_OR_EQUAL_TO | `">="` +DOLLAR | `"$"` + + +## Enum: List<ArrayEnumEnum> + +Name | Value +---- | ----- +FISH | `"fish"` +CRAB | `"crab"` + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/EnumClass.md b/samples/client/petstore/java-micronaut-client/docs/EnumClass.md new file mode 100644 index 00000000000..b314590a759 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/EnumTest.md b/samples/client/petstore/java-micronaut-client/docs/EnumTest.md new file mode 100644 index 00000000000..d2a2431223e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/EnumTest.md @@ -0,0 +1,54 @@ + + +# EnumTest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional property] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | +**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional property] +**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional property] +**outerEnum** | `OuterEnum` | | [optional property] + + + +## Enum: EnumStringEnum + +Name | Value +---- | ----- +UPPER | `"UPPER"` +LOWER | `"lower"` +EMPTY | `""` + + +## Enum: EnumStringRequiredEnum + +Name | Value +---- | ----- +UPPER | `"UPPER"` +LOWER | `"lower"` +EMPTY | `""` + + +## Enum: EnumIntegerEnum + +Name | Value +---- | ----- +NUMBER_1 | `1` +NUMBER_MINUS_1 | `-1` + + +## Enum: EnumNumberEnum + +Name | Value +---- | ----- +NUMBER_1_DOT_1 | `1.1` +NUMBER_MINUS_1_DOT_2 | `-1.2` + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/FakeApi.md b/samples/client/petstore/java-micronaut-client/docs/FakeApi.md new file mode 100644 index 00000000000..5baa181a600 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/FakeApi.md @@ -0,0 +1,417 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | + + +## Creating FakeApi + +To initiate an instance of `FakeApi`, you can use micronaut's `ApplicationContext`: +```java +/* imports +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; +import org.openapitools.api.FakeApi; +*/ + +ApplicationContext context = Micronaut.run(/* ... */); +PetApi apiInstance = context.getBean(FakeApi.class); +``` + +Or the `@Inject` annotation: +```java +@Singleton +class MyClass { + @Inject + FakeApi fakeApi; + + /* ... use the injected variable */ +} +``` +Note that the class needs to be annotated with one of Micronaut's [scope annotations](https://docs.micronaut.io/latest/guide/#scopes) like `Singleton` in order to be processed. + +More information can be found inside [Inversion of Control guide section](https://docs.micronaut.io/latest/guide/#ioc). + + +# **createXmlItem** +```java +Mono FakeApi.createXmlItem(xmlItem) +``` + +creates an XmlItem + +this route creates an XmlItem + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | + + + + + + +### HTTP request headers + - **Content-Type**: `application/xml`, `application/xml; charset=utf-8`, `application/xml; charset=utf-16`, `text/xml`, `text/xml; charset=utf-8`, `text/xml; charset=utf-16` + - **Accept**: Not defined + + +# **fakeOuterBooleanSerialize** +```java +Mono FakeApi.fakeOuterBooleanSerialize(_body) +``` + + + +Test serialization of outer boolean types + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | `Boolean`| Input boolean as post body | [optional parameter] + + +### Return type +`Boolean` + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `*/*` + + +# **fakeOuterCompositeSerialize** +```java +Mono FakeApi.fakeOuterCompositeSerialize(_body) +``` + + + +Test serialization of object with outer number type + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional parameter] + + +### Return type +[**OuterComposite**](OuterComposite.md) + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `*/*` + + +# **fakeOuterNumberSerialize** +```java +Mono FakeApi.fakeOuterNumberSerialize(_body) +``` + + + +Test serialization of outer number types + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | `BigDecimal`| Input number as post body | [optional parameter] + + +### Return type +[**BigDecimal**](BigDecimal.md) + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `*/*` + + +# **fakeOuterStringSerialize** +```java +Mono FakeApi.fakeOuterStringSerialize(_body) +``` + + + +Test serialization of outer string types + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | `String`| Input string as post body | [optional parameter] + + +### Return type +`String` + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `*/*` + + +# **testBodyWithFileSchema** +```java +Mono FakeApi.testBodyWithFileSchema(_body) +``` + + + +For this test, the body for this request much reference a schema named `File`. + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + + + + + + +### HTTP request headers + - **Content-Type**: `application/json` + - **Accept**: Not defined + + +# **testBodyWithQueryParams** +```java +Mono FakeApi.testBodyWithQueryParams(query_body) +``` + + + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | `String`| | + **_body** | [**User**](User.md)| | + + + + + + +### HTTP request headers + - **Content-Type**: `application/json` + - **Accept**: Not defined + + +# **testClientModel** +```java +Mono FakeApi.testClientModel(_body) +``` + +To test \"client\" model + +To test \"client\" model + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**ModelClient**](ModelClient.md)| client model | + + +### Return type +[**ModelClient**](ModelClient.md) + + + +### HTTP request headers + - **Content-Type**: `application/json` + - **Accept**: `application/json` + + +# **testEndpointParameters** +```java +Mono FakeApi.testEndpointParameters(number_doublepatternWithoutDelimiter_byteintegerint32int64_floatstringbinarydatedateTimepasswordparamCallback) +``` + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | `BigDecimal`| None | + **_double** | `Double`| None | + **patternWithoutDelimiter** | `String`| None | + **_byte** | `byte[]`| None | + **integer** | `Integer`| None | [optional parameter] + **int32** | `Integer`| None | [optional parameter] + **int64** | `Long`| None | [optional parameter] + **_float** | `Float`| None | [optional parameter] + **string** | `String`| None | [optional parameter] + **binary** | `File`| None | [optional parameter] + **date** | `LocalDate`| None | [optional parameter] + **dateTime** | `LocalDateTime`| None | [optional parameter] + **password** | `String`| None | [optional parameter] + **paramCallback** | `String`| None | [optional parameter] + + + + +### Authorization +* **[http_basic_test](auth.md#http_basic_test)** + +### HTTP request headers + - **Content-Type**: `application/x-www-form-urlencoded` + - **Accept**: Not defined + + +# **testEnumParameters** +```java +Mono FakeApi.testEnumParameters(enumHeaderStringArrayenumHeaderStringenumQueryStringArrayenumQueryStringenumQueryIntegerenumQueryDoubleenumFormStringArrayenumFormString) +``` + +To test enum parameters + +To test enum parameters + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional parameter] [enum: `>`, `$`] + **enumHeaderString** | `String`| Header parameter enum test (string) | [optional parameter] [default to `-efg`] [enum: `_abc`, `-efg`, `(xyz)`] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional parameter] [enum: `>`, `$`] + **enumQueryString** | `String`| Query parameter enum test (string) | [optional parameter] [default to `-efg`] [enum: `_abc`, `-efg`, `(xyz)`] + **enumQueryInteger** | `Integer`| Query parameter enum test (double) | [optional parameter] [enum: `1`, `-2`] + **enumQueryDouble** | `Double`| Query parameter enum test (double) | [optional parameter] [enum: `1.1`, `-1.2`] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional parameter] [default to `$`] [enum: `>`, `$`] + **enumFormString** | `String`| Form parameter enum test (string) | [optional parameter] [default to `-efg`] [enum: `_abc`, `-efg`, `(xyz)`] + + + + + + +### HTTP request headers + - **Content-Type**: `application/x-www-form-urlencoded` + - **Accept**: Not defined + + +# **testGroupParameters** +```java +Mono FakeApi.testGroupParameters(requiredStringGrouprequiredBooleanGrouprequiredInt64GroupstringGroupbooleanGroupint64Group) +``` + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | `Integer`| Required String in group parameters | + **requiredBooleanGroup** | `Boolean`| Required Boolean in group parameters | + **requiredInt64Group** | `Long`| Required Integer in group parameters | + **stringGroup** | `Integer`| String in group parameters | [optional parameter] + **booleanGroup** | `Boolean`| Boolean in group parameters | [optional parameter] + **int64Group** | `Long`| Integer in group parameters | [optional parameter] + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **testInlineAdditionalProperties** +```java +Mono FakeApi.testInlineAdditionalProperties(param) +``` + +test inline additionalProperties + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**Map<String, String>**](String.md)| request body | + + + + + + +### HTTP request headers + - **Content-Type**: `application/json` + - **Accept**: Not defined + + +# **testJsonFormData** +```java +Mono FakeApi.testJsonFormData(paramparam2) +``` + +test json serialization of form data + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | `String`| field1 | + **param2** | `String`| field2 | + + + + + + +### HTTP request headers + - **Content-Type**: `application/x-www-form-urlencoded` + - **Accept**: Not defined + + +# **testQueryParameterCollectionFormat** +```java +Mono FakeApi.testQueryParameterCollectionFormat(pipeioutilhttpurlcontext) +``` + + + +To test the collection format in query parameters + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List<String>**](String.md)| | + **ioutil** | [**List<String>**](String.md)| | + **http** | [**List<String>**](String.md)| | + **url** | [**List<String>**](String.md)| | + **context** | [**List<String>**](String.md)| | + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + diff --git a/samples/client/petstore/java-micronaut-client/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java-micronaut-client/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..6cc84918111 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/FakeClassnameTags123Api.md @@ -0,0 +1,63 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +## Creating FakeClassnameTags123Api + +To initiate an instance of `FakeClassnameTags123Api`, you can use micronaut's `ApplicationContext`: +```java +/* imports +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; +import org.openapitools.api.FakeClassnameTags123Api; +*/ + +ApplicationContext context = Micronaut.run(/* ... */); +PetApi apiInstance = context.getBean(FakeClassnameTags123Api.class); +``` + +Or the `@Inject` annotation: +```java +@Singleton +class MyClass { + @Inject + FakeClassnameTags123Api fakeClassnameTags123Api; + + /* ... use the injected variable */ +} +``` +Note that the class needs to be annotated with one of Micronaut's [scope annotations](https://docs.micronaut.io/latest/guide/#scopes) like `Singleton` in order to be processed. + +More information can be found inside [Inversion of Control guide section](https://docs.micronaut.io/latest/guide/#ioc). + + +# **testClassname** +```java +Mono FakeClassnameTags123Api.testClassname(_body) +``` + +To test class name in snake case + +To test class name in snake case + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**ModelClient**](ModelClient.md)| client model | + + +### Return type +[**ModelClient**](ModelClient.md) + +### Authorization +* **[api_key_query](auth.md#api_key_query)** + +### HTTP request headers + - **Content-Type**: `application/json` + - **Accept**: `application/json` + diff --git a/samples/client/petstore/java-micronaut-client/docs/FileSchemaTestClass.md b/samples/client/petstore/java-micronaut-client/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..c9ba66f887b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/FileSchemaTestClass.md @@ -0,0 +1,17 @@ + + +# FileSchemaTestClass + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [`java.io.File`](java.io.File.md) | | [optional property] +**files** | [`List<java.io.File>`](java.io.File.md) | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/FormatTest.md b/samples/client/petstore/java-micronaut-client/docs/FormatTest.md new file mode 100644 index 00000000000..74c29bb97b2 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/FormatTest.md @@ -0,0 +1,29 @@ + + +# FormatTest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | `Integer` | | [optional property] +**int32** | `Integer` | | [optional property] +**int64** | `Long` | | [optional property] +**number** | `BigDecimal` | | +**_float** | `Float` | | [optional property] +**_double** | `Double` | | [optional property] +**string** | `String` | | [optional property] +**_byte** | `byte[]` | | +**binary** | `File` | | [optional property] +**date** | `LocalDate` | | +**dateTime** | `LocalDateTime` | | [optional property] +**uuid** | `UUID` | | [optional property] +**password** | `String` | | +**bigDecimal** | `BigDecimal` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/HasOnlyReadOnly.md b/samples/client/petstore/java-micronaut-client/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..c53bce80f62 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/HasOnlyReadOnly.md @@ -0,0 +1,17 @@ + + +# HasOnlyReadOnly + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | `String` | | [optional property] [readonly property] +**foo** | `String` | | [optional property] [readonly property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/MapTest.md b/samples/client/petstore/java-micronaut-client/docs/MapTest.md new file mode 100644 index 00000000000..8b868a1ae7e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/MapTest.md @@ -0,0 +1,27 @@ + + +# MapTest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | `Map<String, Map<String, String>>` | | [optional property] +**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional property] +**directMap** | `Map<String, Boolean>` | | [optional property] +**indirectMap** | `Map<String, Boolean>` | | [optional property] + + + +## Enum: Map<String, InnerEnum> + +Name | Value +---- | ----- +UPPER | `"UPPER"` +LOWER | `"lower"` + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java-micronaut-client/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..40f3a82effd --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,18 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | `UUID` | | [optional property] +**dateTime** | `LocalDateTime` | | [optional property] +**map** | [`Map<String, Animal>`](Animal.md) | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Model200Response.md b/samples/client/petstore/java-micronaut-client/docs/Model200Response.md new file mode 100644 index 00000000000..bc8078d0bed --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Model200Response.md @@ -0,0 +1,18 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `Integer` | | [optional property] +**propertyClass** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/ModelApiResponse.md b/samples/client/petstore/java-micronaut-client/docs/ModelApiResponse.md new file mode 100644 index 00000000000..950119dc1f1 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ModelApiResponse.md @@ -0,0 +1,18 @@ + + +# ModelApiResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | `Integer` | | [optional property] +**type** | `String` | | [optional property] +**message** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/ModelClient.md b/samples/client/petstore/java-micronaut-client/docs/ModelClient.md new file mode 100644 index 00000000000..74770bad073 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ModelClient.md @@ -0,0 +1,16 @@ + + +# ModelClient + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_client** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/ModelReturn.md b/samples/client/petstore/java-micronaut-client/docs/ModelReturn.md new file mode 100644 index 00000000000..f907f3a956b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ModelReturn.md @@ -0,0 +1,17 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | `Integer` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Name.md b/samples/client/petstore/java-micronaut-client/docs/Name.md new file mode 100644 index 00000000000..e9e41d13435 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Name.md @@ -0,0 +1,20 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | `Integer` | | +**snakeCase** | `Integer` | | [optional property] [readonly property] +**property** | `String` | | [optional property] +**_123number** | `Integer` | | [optional property] [readonly property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/NumberOnly.md b/samples/client/petstore/java-micronaut-client/docs/NumberOnly.md new file mode 100644 index 00000000000..ff8408617c5 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/NumberOnly.md @@ -0,0 +1,16 @@ + + +# NumberOnly + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | `BigDecimal` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Order.md b/samples/client/petstore/java-micronaut-client/docs/Order.md new file mode 100644 index 00000000000..2522ec781e4 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Order.md @@ -0,0 +1,30 @@ + + +# Order + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | `Long` | | [optional property] +**petId** | `Long` | | [optional property] +**quantity** | `Integer` | | [optional property] +**shipDate** | `LocalDateTime` | | [optional property] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional property] +**complete** | `Boolean` | | [optional property] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +PLACED | `"placed"` +APPROVED | `"approved"` +DELIVERED | `"delivered"` + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/OuterComposite.md b/samples/client/petstore/java-micronaut-client/docs/OuterComposite.md new file mode 100644 index 00000000000..dc004d557a5 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/OuterComposite.md @@ -0,0 +1,18 @@ + + +# OuterComposite + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | `BigDecimal` | | [optional property] +**myString** | `String` | | [optional property] +**myBoolean** | `Boolean` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/OuterEnum.md b/samples/client/petstore/java-micronaut-client/docs/OuterEnum.md new file mode 100644 index 00000000000..1f9b723eb8e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/OuterEnum.md @@ -0,0 +1,15 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/Pet.md b/samples/client/petstore/java-micronaut-client/docs/Pet.md new file mode 100644 index 00000000000..6a18fe4238d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Pet.md @@ -0,0 +1,30 @@ + + +# Pet + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | `Long` | | [optional property] +**category** | [`Category`](Category.md) | | [optional property] +**name** | `String` | | +**photoUrls** | `Set<String>` | | +**tags** | [`List<Tag>`](Tag.md) | | [optional property] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional property] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +AVAILABLE | `"available"` +PENDING | `"pending"` +SOLD | `"sold"` + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/PetApi.md b/samples/client/petstore/java-micronaut-client/docs/PetApi.md new file mode 100644 index 00000000000..44f7e649a26 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/PetApi.md @@ -0,0 +1,270 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +## Creating PetApi + +To initiate an instance of `PetApi`, you can use micronaut's `ApplicationContext`: +```java +/* imports +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; +import org.openapitools.api.PetApi; +*/ + +ApplicationContext context = Micronaut.run(/* ... */); +PetApi apiInstance = context.getBean(PetApi.class); +``` + +Or the `@Inject` annotation: +```java +@Singleton +class MyClass { + @Inject + PetApi petApi; + + /* ... use the injected variable */ +} +``` +Note that the class needs to be annotated with one of Micronaut's [scope annotations](https://docs.micronaut.io/latest/guide/#scopes) like `Singleton` in order to be processed. + +More information can be found inside [Inversion of Control guide section](https://docs.micronaut.io/latest/guide/#ioc). + + +# **addPet** +```java +Mono PetApi.addPet(_body) +``` + +Add a new pet to the store + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + + + + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: `application/json`, `application/xml` + - **Accept**: Not defined + + +# **deletePet** +```java +Mono PetApi.deletePet(petIdapiKey) +``` + +Deletes a pet + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | `Long`| Pet id to delete | + **apiKey** | `String`| | [optional parameter] + + + + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **findPetsByStatus** +```java +Mono> PetApi.findPetsByStatus(status) +``` + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: `available`, `pending`, `sold`] + + +### Return type +[**List<Pet>**](Pet.md) + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/xml`, `application/json` + + +# **findPetsByTags** +```java +Mono> PetApi.findPetsByTags(tags) +``` + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**Set<String>**](String.md)| Tags to filter by | + + +### Return type +[**Set<Pet>**](Pet.md) + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/xml`, `application/json` + + +# **getPetById** +```java +Mono PetApi.getPetById(petId) +``` + +Find pet by ID + +Returns a single pet + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | `Long`| ID of pet to return | + + +### Return type +[**Pet**](Pet.md) + +### Authorization +* **[api_key](auth.md#api_key)** + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/xml`, `application/json` + + +# **updatePet** +```java +Mono PetApi.updatePet(_body) +``` + +Update an existing pet + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + + + + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: `application/json`, `application/xml` + - **Accept**: Not defined + + +# **updatePetWithForm** +```java +Mono PetApi.updatePetWithForm(petIdnamestatus) +``` + +Updates a pet in the store with form data + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | `Long`| ID of pet that needs to be updated | + **name** | `String`| Updated name of the pet | [optional parameter] + **status** | `String`| Updated status of the pet | [optional parameter] + + + + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: `application/x-www-form-urlencoded` + - **Accept**: Not defined + + +# **uploadFile** +```java +Mono PetApi.uploadFile(petIdadditionalMetadatafile) +``` + +uploads an image + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | `Long`| ID of pet to update | + **additionalMetadata** | `String`| Additional data to pass to server | [optional parameter] + **file** | `File`| file to upload | [optional parameter] + + +### Return type +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: `multipart/form-data` + - **Accept**: `application/json` + + +# **uploadFileWithRequiredFile** +```java +Mono PetApi.uploadFileWithRequiredFile(petIdrequiredFileadditionalMetadata) +``` + +uploads an image (required) + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | `Long`| ID of pet to update | + **requiredFile** | `File`| file to upload | + **additionalMetadata** | `String`| Additional data to pass to server | [optional parameter] + + +### Return type +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization +* **[petstore_auth](auth.md#petstore_auth)**, scopes: `write:pets`, `read:pets` + +### HTTP request headers + - **Content-Type**: `multipart/form-data` + - **Accept**: `application/json` + diff --git a/samples/client/petstore/java-micronaut-client/docs/ReadOnlyFirst.md b/samples/client/petstore/java-micronaut-client/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..503ba210dbf --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/ReadOnlyFirst.md @@ -0,0 +1,17 @@ + + +# ReadOnlyFirst + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | `String` | | [optional property] [readonly property] +**baz** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/SpecialModelName.md b/samples/client/petstore/java-micronaut-client/docs/SpecialModelName.md new file mode 100644 index 00000000000..88dbe302799 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/SpecialModelName.md @@ -0,0 +1,16 @@ + + +# SpecialModelName + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**$specialPropertyName** | `Long` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/StoreApi.md b/samples/client/petstore/java-micronaut-client/docs/StoreApi.md new file mode 100644 index 00000000000..eb32b4a754c --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/StoreApi.md @@ -0,0 +1,134 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + +## Creating StoreApi + +To initiate an instance of `StoreApi`, you can use micronaut's `ApplicationContext`: +```java +/* imports +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; +import org.openapitools.api.StoreApi; +*/ + +ApplicationContext context = Micronaut.run(/* ... */); +PetApi apiInstance = context.getBean(StoreApi.class); +``` + +Or the `@Inject` annotation: +```java +@Singleton +class MyClass { + @Inject + StoreApi storeApi; + + /* ... use the injected variable */ +} +``` +Note that the class needs to be annotated with one of Micronaut's [scope annotations](https://docs.micronaut.io/latest/guide/#scopes) like `Singleton` in order to be processed. + +More information can be found inside [Inversion of Control guide section](https://docs.micronaut.io/latest/guide/#ioc). + + +# **deleteOrder** +```java +Mono StoreApi.deleteOrder(orderId) +``` + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | `String`| ID of the order that needs to be deleted | + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **getInventory** +```java +Mono> StoreApi.getInventory() +``` + +Returns pet inventories by status + +Returns a map of status codes to quantities + + + +### Return type +`Map<String, Integer>` + +### Authorization +* **[api_key](auth.md#api_key)** + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/json` + + +# **getOrderById** +```java +Mono StoreApi.getOrderById(orderId) +``` + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | `Long`| ID of pet that needs to be fetched | + + +### Return type +[**Order**](Order.md) + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/xml`, `application/json` + + +# **placeOrder** +```java +Mono StoreApi.placeOrder(_body) +``` + +Place an order for a pet + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**Order**](Order.md)| order placed for purchasing the pet | + + +### Return type +[**Order**](Order.md) + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/xml`, `application/json` + diff --git a/samples/client/petstore/java-micronaut-client/docs/Tag.md b/samples/client/petstore/java-micronaut-client/docs/Tag.md new file mode 100644 index 00000000000..7de5f5be77f --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/Tag.md @@ -0,0 +1,17 @@ + + +# Tag + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | `Long` | | [optional property] +**name** | `String` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/TypeHolderDefault.md b/samples/client/petstore/java-micronaut-client/docs/TypeHolderDefault.md new file mode 100644 index 00000000000..1cd7787e495 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/TypeHolderDefault.md @@ -0,0 +1,20 @@ + + +# TypeHolderDefault + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | `String` | | +**numberItem** | `BigDecimal` | | +**integerItem** | `Integer` | | +**boolItem** | `Boolean` | | +**arrayItem** | `List<Integer>` | | + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/TypeHolderExample.md b/samples/client/petstore/java-micronaut-client/docs/TypeHolderExample.md new file mode 100644 index 00000000000..805608ae2b9 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/TypeHolderExample.md @@ -0,0 +1,21 @@ + + +# TypeHolderExample + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | `String` | | +**numberItem** | `BigDecimal` | | +**floatItem** | `Float` | | +**integerItem** | `Integer` | | +**boolItem** | `Boolean` | | +**arrayItem** | `List<Integer>` | | + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/User.md b/samples/client/petstore/java-micronaut-client/docs/User.md new file mode 100644 index 00000000000..73274c63f19 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/User.md @@ -0,0 +1,23 @@ + + +# User + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | `Long` | | [optional property] +**username** | `String` | | [optional property] +**firstName** | `String` | | [optional property] +**lastName** | `String` | | [optional property] +**email** | `String` | | [optional property] +**password** | `String` | | [optional property] +**phone** | `String` | | [optional property] +**userStatus** | `Integer` | User Status | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/UserApi.md b/samples/client/petstore/java-micronaut-client/docs/UserApi.md new file mode 100644 index 00000000000..3eb55a90d4f --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/UserApi.md @@ -0,0 +1,226 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Creating UserApi + +To initiate an instance of `UserApi`, you can use micronaut's `ApplicationContext`: +```java +/* imports +import io.micronaut.runtime.Micronaut; +import io.micronaut.context.ApplicationContext; +import org.openapitools.api.UserApi; +*/ + +ApplicationContext context = Micronaut.run(/* ... */); +PetApi apiInstance = context.getBean(UserApi.class); +``` + +Or the `@Inject` annotation: +```java +@Singleton +class MyClass { + @Inject + UserApi userApi; + + /* ... use the injected variable */ +} +``` +Note that the class needs to be annotated with one of Micronaut's [scope annotations](https://docs.micronaut.io/latest/guide/#scopes) like `Singleton` in order to be processed. + +More information can be found inside [Inversion of Control guide section](https://docs.micronaut.io/latest/guide/#ioc). + + +# **createUser** +```java +Mono UserApi.createUser(_body) +``` + +Create user + +This can only be done by the logged in user. + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**User**](User.md)| Created user object | + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **createUsersWithArrayInput** +```java +Mono UserApi.createUsersWithArrayInput(_body) +``` + +Creates list of users with given input array + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**List<User>**](User.md)| List of user object | + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **createUsersWithListInput** +```java +Mono UserApi.createUsersWithListInput(_body) +``` + +Creates list of users with given input array + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **_body** | [**List<User>**](User.md)| List of user object | + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **deleteUser** +```java +Mono UserApi.deleteUser(username) +``` + +Delete user + +This can only be done by the logged in user. + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | `String`| The name that needs to be deleted | + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **getUserByName** +```java +Mono UserApi.getUserByName(username) +``` + +Get user by user name + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | `String`| The name that needs to be fetched. Use user1 for testing. | + + +### Return type +[**User**](User.md) + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/xml`, `application/json` + + +# **loginUser** +```java +Mono UserApi.loginUser(usernamepassword) +``` + +Logs user into the system + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | `String`| The user name for login | + **password** | `String`| The password for login in clear text | + + +### Return type +`String` + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: `application/xml`, `application/json` + + +# **logoutUser** +```java +Mono UserApi.logoutUser() +``` + +Logs out current logged in user session + + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **updateUser** +```java +Mono UserApi.updateUser(username_body) +``` + +Updated user + +This can only be done by the logged in user. + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | `String`| name that need to be deleted | + **_body** | [**User**](User.md)| Updated user object | + + + + + + +### HTTP request headers + - **Content-Type**: Not defined + - **Accept**: Not defined + diff --git a/samples/client/petstore/java-micronaut-client/docs/XmlItem.md b/samples/client/petstore/java-micronaut-client/docs/XmlItem.md new file mode 100644 index 00000000000..2f07c8efbf6 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/XmlItem.md @@ -0,0 +1,44 @@ + + +# XmlItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attributeString** | `String` | | [optional property] +**attributeNumber** | `BigDecimal` | | [optional property] +**attributeInteger** | `Integer` | | [optional property] +**attributeBoolean** | `Boolean` | | [optional property] +**wrappedArray** | `List<Integer>` | | [optional property] +**nameString** | `String` | | [optional property] +**nameNumber** | `BigDecimal` | | [optional property] +**nameInteger** | `Integer` | | [optional property] +**nameBoolean** | `Boolean` | | [optional property] +**nameArray** | `List<Integer>` | | [optional property] +**nameWrappedArray** | `List<Integer>` | | [optional property] +**prefixString** | `String` | | [optional property] +**prefixNumber** | `BigDecimal` | | [optional property] +**prefixInteger** | `Integer` | | [optional property] +**prefixBoolean** | `Boolean` | | [optional property] +**prefixArray** | `List<Integer>` | | [optional property] +**prefixWrappedArray** | `List<Integer>` | | [optional property] +**namespaceString** | `String` | | [optional property] +**namespaceNumber** | `BigDecimal` | | [optional property] +**namespaceInteger** | `Integer` | | [optional property] +**namespaceBoolean** | `Boolean` | | [optional property] +**namespaceArray** | `List<Integer>` | | [optional property] +**namespaceWrappedArray** | `List<Integer>` | | [optional property] +**prefixNsString** | `String` | | [optional property] +**prefixNsNumber** | `BigDecimal` | | [optional property] +**prefixNsInteger** | `Integer` | | [optional property] +**prefixNsBoolean** | `Boolean` | | [optional property] +**prefixNsArray** | `List<Integer>` | | [optional property] +**prefixNsWrappedArray** | `List<Integer>` | | [optional property] + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/docs/auth.md b/samples/client/petstore/java-micronaut-client/docs/auth.md new file mode 100644 index 00000000000..97f37d68202 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/docs/auth.md @@ -0,0 +1,26 @@ +# Authorization methods + +# api_key +Authorization method is of **api key type**. The parameter `api_key` is located in `header`. + +It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features. + +# api_key_query +Authorization method is of **api key type**. The parameter `api_key_query` is located in `query`. + +It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features. + +# http_basic_test +Authorization method is of **basic auth**. + +It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features. + +# petstore_auth +Authorization method is **OAuth2** with `implicit` flow. +The scopes are: + * `write:pets` + * `read:pets` + +It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features. + +More information on configuring can be found in [Micronaut Security Guide](https://micronaut-projects.github.io/micronaut-security/latest/guide/#oauth). diff --git a/samples/client/petstore/java-micronaut-client/gradle.properties b/samples/client/petstore/java-micronaut-client/gradle.properties new file mode 100644 index 00000000000..4804e049014 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/gradle.properties @@ -0,0 +1 @@ +micronautVersion=3.0.0-M5 \ No newline at end of file diff --git a/samples/client/petstore/java-micronaut-client/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java-micronaut-client/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/java-micronaut-client/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java-micronaut-client/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..f2e1eb1fd47 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip diff --git a/samples/client/petstore/java-micronaut-client/gradlew b/samples/client/petstore/java-micronaut-client/gradlew new file mode 100644 index 00000000000..4f906e0c811 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java-micronaut-client/gradlew.bat b/samples/client/petstore/java-micronaut-client/gradlew.bat new file mode 100644 index 00000000000..107acd32c4e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java-micronaut-client/hello.txt b/samples/client/petstore/java-micronaut-client/hello.txt new file mode 100644 index 00000000000..6769dd60bdf --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/hello.txt @@ -0,0 +1 @@ +Hello world! \ No newline at end of file diff --git a/samples/client/petstore/java-micronaut-client/mvnw b/samples/client/petstore/java-micronaut-client/mvnw new file mode 100644 index 00000000000..a16b5431b4c --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/samples/client/petstore/java-micronaut-client/mvnw.bat b/samples/client/petstore/java-micronaut-client/mvnw.bat new file mode 100644 index 00000000000..c8d43372c98 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/mvnw.bat @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/samples/client/petstore/java-micronaut-client/pom.xml b/samples/client/petstore/java-micronaut-client/pom.xml new file mode 100644 index 00000000000..c64bc3bb07c --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/pom.xml @@ -0,0 +1,174 @@ + + + 4.0.0 + org.openapitools + petstore-micronaut + 1.0.0 + ${packaging} + + + io.micronaut + micronaut-parent + 3.0.0-M5 + + + + jar + 1.8 + + + 3.0.0-M5 + org.openapitools.Application + netty + 1.5.21 + + + + + central + https://repo.maven.apache.org/maven2 + + + + + + io.micronaut + micronaut-inject + compile + + + io.micronaut + micronaut-validation + compile + + + io.micronaut + micronaut-inject-groovy + test + + + org.spockframework + spock-core + test + + + org.codehaus.groovy + groovy-all + + + + + io.micronaut.test + micronaut-test-spock + test + + + io.micronaut + micronaut-http-client + compile + + + io.micronaut + micronaut-http-server-netty + compile + + + io.micronaut + micronaut-runtime + compile + + + io.micronaut.reactor + micronaut-reactor + compile + + + io.micronaut.security + micronaut-security + compile + + + io.micronaut.security + micronaut-security-oauth2 + compile + + + ch.qos.logback + logback-classic + runtime + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + + + + io.micronaut.build + micronaut-maven-plugin + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + io.micronaut + micronaut-http-validation + ${micronaut.version} + + + io.micronaut.security + micronaut-security-annotations + ${micronaut.security.version} + + + + -Amicronaut.processing.group=org.openapitools + -Amicronaut.processing.module=petstore-micronaut + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*Spec.* + **/*Test.* + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.9.0 + + + + addSources + generateStubs + compile + removeStubs + addTestSources + generateTestStubs + compileTests + removeTestStubs + + + + + + + + diff --git a/samples/client/petstore/java-micronaut-client/settings.gradle b/samples/client/petstore/java-micronaut-client/settings.gradle new file mode 100644 index 00000000000..c9092ffe7ac --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-micronaut" \ No newline at end of file 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 new file mode 100644 index 00000000000..09c1c9fb397 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/AnotherFakeApi.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.api; + +import io.micronaut.http.annotation.*; +import io.micronaut.core.annotation.*; +import io.micronaut.http.client.annotation.Client; +import org.openapitools.query.QueryParam; +import io.micronaut.core.convert.format.Format; +import reactor.core.publisher.Mono; +import org.openapitools.model.ModelClient; +import javax.annotation.Generated; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.validation.Valid; +import javax.validation.constraints.*; + +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Client("${base-path}") +public interface AnotherFakeApi { + + /** + * To test special tags + * To test special tags and operation ID starting with number + * + * @param _body client model (required) + * @return ModelClient + */ + @Patch(uri="/another-fake/dummy") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono call123testSpecialTags( + @Body @Valid @NotNull 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 new file mode 100644 index 00000000000..3f2bb9df3da --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeApi.java @@ -0,0 +1,280 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.api; + +import io.micronaut.http.annotation.*; +import io.micronaut.core.annotation.*; +import io.micronaut.http.client.annotation.Client; +import org.openapitools.query.QueryParam; +import io.micronaut.core.convert.format.Format; +import reactor.core.publisher.Mono; +import java.math.BigDecimal; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.time.LocalDateTime; +import org.openapitools.model.ModelClient; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.User; +import org.openapitools.model.XmlItem; +import javax.annotation.Generated; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.validation.Valid; +import javax.validation.constraints.*; + +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Client("${base-path}") +public interface FakeApi { + + /** + * creates an XmlItem + * this route creates an XmlItem + * + * @param xmlItem XmlItem Body (required) + */ + @Post(uri="/fake/create_xml_item") + @Produces(value={"application/xml"}) + @Consumes(value={"application/json"}) + Mono createXmlItem( + @Body @Valid @NotNull XmlItem xmlItem + ); + + /** + * Test serialization of outer boolean types + * + * @param _body Input boolean as post body (optional) + * @return Boolean + */ + @Post(uri="/fake/outer/boolean") + @Produces(value={"*/*"}) + @Consumes(value={"*/*"}) + Mono fakeOuterBooleanSerialize( + @Body Boolean _body + ); + + /** + * Test serialization of object with outer number type + * + * @param _body Input composite as post body (optional) + * @return OuterComposite + */ + @Post(uri="/fake/outer/composite") + @Produces(value={"*/*"}) + @Consumes(value={"*/*"}) + Mono fakeOuterCompositeSerialize( + @Body @Valid OuterComposite _body + ); + + /** + * Test serialization of outer number types + * + * @param _body Input number as post body (optional) + * @return BigDecimal + */ + @Post(uri="/fake/outer/number") + @Produces(value={"*/*"}) + @Consumes(value={"*/*"}) + Mono fakeOuterNumberSerialize( + @Body BigDecimal _body + ); + + /** + * Test serialization of outer string types + * + * @param _body Input string as post body (optional) + * @return String + */ + @Post(uri="/fake/outer/string") + @Produces(value={"*/*"}) + @Consumes(value={"*/*"}) + Mono fakeOuterStringSerialize( + @Body String _body + ); + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @param _body (required) + */ + @Put(uri="/fake/body-with-file-schema") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono testBodyWithFileSchema( + @Body @Valid @NotNull FileSchemaTestClass _body + ); + + /** + * testBodyWithQueryParams + * + * @param query (required) + * @param _body (required) + */ + @Put(uri="/fake/body-with-query-params") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono testBodyWithQueryParams( + @QueryParam(name="query") @NotNull String query, + @Body @Valid @NotNull User _body + ); + + /** + * To test \"client\" model + * To test \"client\" model + * + * @param _body client model (required) + * @return ModelClient + */ + @Patch(uri="/fake") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono testClientModel( + @Body @Valid @NotNull ModelClient _body + ); + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + */ + @Post(uri="/fake") + @Produces(value={"application/x-www-form-urlencoded"}) + @Consumes(value={"application/json"}) + Mono testEndpointParameters( + @NotNull @DecimalMin("32.1") @DecimalMax("543.2") BigDecimal number, + @NotNull @DecimalMin("67.8") @DecimalMax("123.4") Double _double, + @NotNull @Pattern(regexp="^[A-Z].*") String patternWithoutDelimiter, + @NotNull byte[] _byte, + @Min(10) @Max(100) Integer integer, + @Min(20) @Max(200) Integer int32, + Long int64, + @DecimalMax("987.6") Float _float, + @Pattern(regexp="/[a-z]/i") String string, + File binary, + @Format("yyyy-MM-dd") LocalDate date, + @Format("yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") LocalDateTime dateTime, + @Size(min=10, max=64) String password, + String paramCallback + ); + + /** + * To test enum parameters + * To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + */ + @Get(uri="/fake") + @Produces(value={"application/x-www-form-urlencoded"}) + @Consumes(value={"application/json"}) + Mono testEnumParameters( + @Header(name="enum_header_string_array") List enumHeaderStringArray, + @Header(name="enum_header_string", defaultValue="-efg") String enumHeaderString, + @QueryParam(name="enum_query_string_array", format=QueryParam.Format.CSV) List enumQueryStringArray, + @QueryParam(name="enum_query_string", defaultValue="-efg") String enumQueryString, + @QueryParam(name="enum_query_integer") Integer enumQueryInteger, + @QueryParam(name="enum_query_double") Double enumQueryDouble, + List enumFormStringArray, + String enumFormString + ); + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + */ + @Delete(uri="/fake") + @Consumes(value={"application/json"}) + Mono testGroupParameters( + @QueryParam(name="required_string_group") @NotNull Integer requiredStringGroup, + @Header(name="required_boolean_group") @NotNull Boolean requiredBooleanGroup, + @QueryParam(name="required_int64_group") @NotNull Long requiredInt64Group, + @QueryParam(name="string_group") Integer stringGroup, + @Header(name="boolean_group") Boolean booleanGroup, + @QueryParam(name="int64_group") Long int64Group + ); + + /** + * test inline additionalProperties + * + * @param param request body (required) + */ + @Post(uri="/fake/inline-additionalProperties") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono testInlineAdditionalProperties( + @Body @NotNull Map param + ); + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + */ + @Get(uri="/fake/jsonFormData") + @Produces(value={"application/x-www-form-urlencoded"}) + @Consumes(value={"application/json"}) + Mono testJsonFormData( + @NotNull String param, + @NotNull String param2 + ); + + /** + * To test the collection format in query parameters + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + */ + @Put(uri="/fake/test-query-paramters") + @Consumes(value={"application/json"}) + Mono testQueryParameterCollectionFormat( + @QueryParam(name="pipe", format=QueryParam.Format.CSV) @NotNull List pipe, + @QueryParam(name="ioutil", format=QueryParam.Format.CSV) @NotNull List ioutil, + @QueryParam(name="http", format=QueryParam.Format.SSV) @NotNull List http, + @QueryParam(name="url", format=QueryParam.Format.CSV) @NotNull List url, + @QueryParam(name="context", format=QueryParam.Format.MULTI) @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 new file mode 100644 index 00000000000..e586776bc7d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/FakeClassnameTags123Api.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.api; + +import io.micronaut.http.annotation.*; +import io.micronaut.core.annotation.*; +import io.micronaut.http.client.annotation.Client; +import org.openapitools.query.QueryParam; +import io.micronaut.core.convert.format.Format; +import reactor.core.publisher.Mono; +import org.openapitools.model.ModelClient; +import javax.annotation.Generated; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.validation.Valid; +import javax.validation.constraints.*; + +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Client("${base-path}") +public interface FakeClassnameTags123Api { + + /** + * To test class name in snake case + * To test class name in snake case + * + * @param _body client model (required) + * @return ModelClient + */ + @Patch(uri="/fake_classname_test") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono testClassname( + @Body @Valid @NotNull 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 new file mode 100644 index 00000000000..e570abe961d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/PetApi.java @@ -0,0 +1,163 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.api; + +import io.micronaut.http.annotation.*; +import io.micronaut.core.annotation.*; +import io.micronaut.http.client.annotation.Client; +import org.openapitools.query.QueryParam; +import io.micronaut.core.convert.format.Format; +import reactor.core.publisher.Mono; +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; +import javax.annotation.Generated; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.validation.Valid; +import javax.validation.constraints.*; + +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Client("${base-path}") +public interface PetApi { + + /** + * Add a new pet to the store + * + * @param _body Pet object that needs to be added to the store (required) + */ + @Post(uri="/pet") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono addPet( + @Body @Valid @NotNull Pet _body + ); + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + */ + @Delete(uri="/pet/{petId}") + @Consumes(value={"application/json"}) + Mono deletePet( + @PathVariable(name="petId") @NotNull Long petId, + @Header(name="api_key") String apiKey + ); + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + */ + @Get(uri="/pet/findByStatus") + @Consumes(value={"application/json"}) + Mono> findPetsByStatus( + @QueryParam(name="status", format=QueryParam.Format.CSV) @NotNull List status + ); + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return Set<Pet> + */ + @Get(uri="/pet/findByTags") + @Consumes(value={"application/json"}) + Mono> findPetsByTags( + @QueryParam(name="tags", format=QueryParam.Format.CSV) @NotNull Set tags + ); + + /** + * Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return Pet + */ + @Get(uri="/pet/{petId}") + @Consumes(value={"application/json"}) + Mono getPetById( + @PathVariable(name="petId") @NotNull Long petId + ); + + /** + * Update an existing pet + * + * @param _body Pet object that needs to be added to the store (required) + */ + @Put(uri="/pet") + @Produces(value={"application/json"}) + @Consumes(value={"application/json"}) + Mono updatePet( + @Body @Valid @NotNull Pet _body + ); + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + */ + @Post(uri="/pet/{petId}") + @Produces(value={"application/x-www-form-urlencoded"}) + @Consumes(value={"application/json"}) + Mono updatePetWithForm( + @PathVariable(name="petId") @NotNull Long petId, + String name, + String status + ); + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + */ + @Post(uri="/pet/{petId}/uploadImage") + @Produces(value={"multipart/form-data"}) + @Consumes(value={"application/json"}) + Mono uploadFile( + @PathVariable(name="petId") @NotNull Long petId, + String additionalMetadata, + File file + ); + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ModelApiResponse + */ + @Post(uri="/fake/{petId}/uploadImageWithRequiredFile") + @Produces(value={"multipart/form-data"}) + @Consumes(value={"application/json"}) + Mono uploadFileWithRequiredFile( + @PathVariable(name="petId") @NotNull Long petId, + @NotNull File requiredFile, + 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 new file mode 100644 index 00000000000..5a0bb8af787 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/StoreApi.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.api; + +import io.micronaut.http.annotation.*; +import io.micronaut.core.annotation.*; +import io.micronaut.http.client.annotation.Client; +import org.openapitools.query.QueryParam; +import io.micronaut.core.convert.format.Format; +import reactor.core.publisher.Mono; +import org.openapitools.model.Order; +import javax.annotation.Generated; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.validation.Valid; +import javax.validation.constraints.*; + +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Client("${base-path}") +public interface StoreApi { + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @param orderId ID of the order that needs to be deleted (required) + */ + @Delete(uri="/store/order/{order_id}") + @Consumes(value={"application/json"}) + Mono deleteOrder( + @PathVariable(name="order_id") @NotNull String orderId + ); + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return Map<String, Integer> + */ + @Get(uri="/store/inventory") + @Consumes(value={"application/json"}) + Mono> getInventory(); + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + */ + @Get(uri="/store/order/{order_id}") + @Consumes(value={"application/json"}) + Mono getOrderById( + @PathVariable(name="order_id") @NotNull @Min(1L) @Max(5L) Long orderId + ); + + /** + * Place an order for a pet + * + * @param _body order placed for purchasing the pet (required) + * @return Order + */ + @Post(uri="/store/order") + @Produces(value={"*/*"}) + @Consumes(value={"application/json"}) + Mono placeOrder( + @Body @Valid @NotNull Order _body + ); +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/UserApi.java new file mode 100644 index 00000000000..e29a340990c --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/UserApi.java @@ -0,0 +1,132 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.api; + +import io.micronaut.http.annotation.*; +import io.micronaut.core.annotation.*; +import io.micronaut.http.client.annotation.Client; +import org.openapitools.query.QueryParam; +import io.micronaut.core.convert.format.Format; +import reactor.core.publisher.Mono; +import org.openapitools.model.User; +import javax.annotation.Generated; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.validation.Valid; +import javax.validation.constraints.*; + +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Client("${base-path}") +public interface UserApi { + + /** + * Create user + * This can only be done by the logged in user. + * + * @param _body Created user object (required) + */ + @Post(uri="/user") + @Produces(value={"*/*"}) + @Consumes(value={"application/json"}) + Mono createUser( + @Body @Valid @NotNull User _body + ); + + /** + * Creates list of users with given input array + * + * @param _body List of user object (required) + */ + @Post(uri="/user/createWithArray") + @Produces(value={"*/*"}) + @Consumes(value={"application/json"}) + Mono createUsersWithArrayInput( + @Body @NotNull List _body + ); + + /** + * Creates list of users with given input array + * + * @param _body List of user object (required) + */ + @Post(uri="/user/createWithList") + @Produces(value={"*/*"}) + @Consumes(value={"application/json"}) + Mono createUsersWithListInput( + @Body @NotNull List _body + ); + + /** + * Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + */ + @Delete(uri="/user/{username}") + @Consumes(value={"application/json"}) + Mono deleteUser( + @PathVariable(name="username") @NotNull String username + ); + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + */ + @Get(uri="/user/{username}") + @Consumes(value={"application/json"}) + Mono getUserByName( + @PathVariable(name="username") @NotNull String username + ); + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + */ + @Get(uri="/user/login") + @Consumes(value={"application/json"}) + Mono loginUser( + @QueryParam(name="username") @NotNull String username, + @QueryParam(name="password") @NotNull String password + ); + + /** + * Logs out current logged in user session + * + */ + @Get(uri="/user/logout") + @Consumes(value={"application/json"}) + Mono logoutUser(); + + /** + * Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param _body Updated user object (required) + */ + @Put(uri="/user/{username}") + @Produces(value={"*/*"}) + @Consumes(value={"application/json"}) + Mono updateUser( + @PathVariable(name="username") @NotNull String username, + @Body @Valid @NotNull User _body + ); +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java new file mode 100644 index 00000000000..c727e3389ab --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesAnyType + */ +@JsonPropertyOrder({ + AdditionalPropertiesAnyType.JSON_PROPERTY_NAME +}) +@JsonTypeName("AdditionalPropertiesAnyType") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesAnyType extends HashMap { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AdditionalPropertiesAnyType name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; + return Objects.equals(this.name, additionalPropertiesAnyType.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesAnyType {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java new file mode 100644 index 00000000000..749c516be0a --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesArray.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesArray + */ +@JsonPropertyOrder({ + AdditionalPropertiesArray.JSON_PROPERTY_NAME +}) +@JsonTypeName("AdditionalPropertiesArray") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesArray extends HashMap { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AdditionalPropertiesArray name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; + return Objects.equals(this.name, additionalPropertiesArray.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesArray {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java new file mode 100644 index 00000000000..859739c31a5 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesBoolean + */ +@JsonPropertyOrder({ + AdditionalPropertiesBoolean.JSON_PROPERTY_NAME +}) +@JsonTypeName("AdditionalPropertiesBoolean") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesBoolean extends HashMap { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AdditionalPropertiesBoolean name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; + return Objects.equals(this.name, additionalPropertiesBoolean.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesBoolean {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..aef32243b4e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -0,0 +1,457 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesClass + */ +@JsonPropertyOrder({ + AdditionalPropertiesClass.JSON_PROPERTY_MAP_STRING, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_NUMBER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_INTEGER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_BOOLEAN, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_INTEGER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_ANYTYPE, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_STRING, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_ANYTYPE, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3 +}) +@JsonTypeName("AdditionalPropertiesClass") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_STRING = "map_string"; + private Map mapString = null; + + public static final String JSON_PROPERTY_MAP_NUMBER = "map_number"; + private Map mapNumber = null; + + public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer"; + private Map mapInteger = null; + + public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean"; + private Map mapBoolean = null; + + public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer"; + private Map> mapArrayInteger = null; + + public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype"; + private Map> mapArrayAnytype = null; + + public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string"; + private Map> mapMapString = null; + + public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype"; + private Map> mapMapAnytype = null; + + public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + private Object anytype1; + + public static final String JSON_PROPERTY_ANYTYPE2 = "anytype_2"; + private Object anytype2; + + public static final String JSON_PROPERTY_ANYTYPE3 = "anytype_3"; + private Object anytype3; + + public AdditionalPropertiesClass mapString(Map mapString) { + this.mapString = mapString; + return this; + } + + public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { + if (this.mapString == null) { + this.mapString = new HashMap(); + } + this.mapString.put(key, mapStringItem); + return this; + } + + /** + * Get mapString + * @return mapString + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMapString() { + return mapString; + } + + @JsonProperty(JSON_PROPERTY_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapString(Map mapString) { + this.mapString = mapString; + } + + public AdditionalPropertiesClass mapNumber(Map mapNumber) { + this.mapNumber = mapNumber; + return this; + } + + public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { + if (this.mapNumber == null) { + this.mapNumber = new HashMap(); + } + this.mapNumber.put(key, mapNumberItem); + return this; + } + + /** + * Get mapNumber + * @return mapNumber + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMapNumber() { + return mapNumber; + } + + @JsonProperty(JSON_PROPERTY_MAP_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapNumber(Map mapNumber) { + this.mapNumber = mapNumber; + } + + public AdditionalPropertiesClass mapInteger(Map mapInteger) { + this.mapInteger = mapInteger; + return this; + } + + public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { + if (this.mapInteger == null) { + this.mapInteger = new HashMap(); + } + this.mapInteger.put(key, mapIntegerItem); + return this; + } + + /** + * Get mapInteger + * @return mapInteger + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMapInteger() { + return mapInteger; + } + + @JsonProperty(JSON_PROPERTY_MAP_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapInteger(Map mapInteger) { + this.mapInteger = mapInteger; + } + + public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { + this.mapBoolean = mapBoolean; + return this; + } + + public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { + if (this.mapBoolean == null) { + this.mapBoolean = new HashMap(); + } + this.mapBoolean.put(key, mapBooleanItem); + return this; + } + + /** + * Get mapBoolean + * @return mapBoolean + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMapBoolean() { + return mapBoolean; + } + + @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapBoolean(Map mapBoolean) { + this.mapBoolean = mapBoolean; + } + + public AdditionalPropertiesClass mapArrayInteger(Map> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + return this; + } + + public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { + if (this.mapArrayInteger == null) { + this.mapArrayInteger = new HashMap>(); + } + this.mapArrayInteger.put(key, mapArrayIntegerItem); + return this; + } + + /** + * Get mapArrayInteger + * @return mapArrayInteger + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map> getMapArrayInteger() { + return mapArrayInteger; + } + + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapArrayInteger(Map> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + } + + public AdditionalPropertiesClass mapArrayAnytype(Map> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + return this; + } + + public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { + if (this.mapArrayAnytype == null) { + this.mapArrayAnytype = new HashMap>(); + } + this.mapArrayAnytype.put(key, mapArrayAnytypeItem); + return this; + } + + /** + * Get mapArrayAnytype + * @return mapArrayAnytype + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map> getMapArrayAnytype() { + return mapArrayAnytype; + } + + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapArrayAnytype(Map> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + } + + public AdditionalPropertiesClass mapMapString(Map> mapMapString) { + this.mapMapString = mapMapString; + return this; + } + + public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { + if (this.mapMapString == null) { + this.mapMapString = new HashMap>(); + } + this.mapMapString.put(key, mapMapStringItem); + return this; + } + + /** + * Get mapMapString + * @return mapMapString + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map> getMapMapString() { + return mapMapString; + } + + @JsonProperty(JSON_PROPERTY_MAP_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapMapString(Map> mapMapString) { + this.mapMapString = mapMapString; + } + + public AdditionalPropertiesClass mapMapAnytype(Map> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + return this; + } + + public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { + if (this.mapMapAnytype == null) { + this.mapMapAnytype = new HashMap>(); + } + this.mapMapAnytype.put(key, mapMapAnytypeItem); + return this; + } + + /** + * Get mapMapAnytype + * @return mapMapAnytype + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map> getMapMapAnytype() { + return mapMapAnytype; + } + + @JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapMapAnytype(Map> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + } + + public AdditionalPropertiesClass anytype1(Object anytype1) { + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getAnytype1() { + return anytype1; + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnytype1(Object anytype1) { + this.anytype1 = anytype1; + } + + public AdditionalPropertiesClass anytype2(Object anytype2) { + this.anytype2 = anytype2; + return this; + } + + /** + * Get anytype2 + * @return anytype2 + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE2) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getAnytype2() { + return anytype2; + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE2) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnytype2(Object anytype2) { + this.anytype2 = anytype2; + } + + public AdditionalPropertiesClass anytype3(Object anytype3) { + this.anytype3 = anytype3; + return this; + } + + /** + * Get anytype3 + * @return anytype3 + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE3) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getAnytype3() { + return anytype3; + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE3) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnytype3(Object anytype3) { + this.anytype3 = anytype3; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && + Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && + Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && + Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && + Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && + Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && + Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && + Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && + Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && + Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && + Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + } + + @Override + public int hashCode() { + return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); + sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); + sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); + sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); + sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); + sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); + sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); + sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); + sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); + sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); + sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java new file mode 100644 index 00000000000..5d6f4bcec0f --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesInteger + */ +@JsonPropertyOrder({ + AdditionalPropertiesInteger.JSON_PROPERTY_NAME +}) +@JsonTypeName("AdditionalPropertiesInteger") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesInteger extends HashMap { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AdditionalPropertiesInteger name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; + return Objects.equals(this.name, additionalPropertiesInteger.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesInteger {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java new file mode 100644 index 00000000000..88dfc96af1b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesNumber + */ +@JsonPropertyOrder({ + AdditionalPropertiesNumber.JSON_PROPERTY_NAME +}) +@JsonTypeName("AdditionalPropertiesNumber") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesNumber extends HashMap { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AdditionalPropertiesNumber name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; + return Objects.equals(this.name, additionalPropertiesNumber.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesNumber {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java new file mode 100644 index 00000000000..393746a2f1d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesObject.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesObject + */ +@JsonPropertyOrder({ + AdditionalPropertiesObject.JSON_PROPERTY_NAME +}) +@JsonTypeName("AdditionalPropertiesObject") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesObject extends HashMap { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AdditionalPropertiesObject name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; + return Objects.equals(this.name, additionalPropertiesObject.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesObject {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesString.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesString.java new file mode 100644 index 00000000000..cefd74bd15d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/AdditionalPropertiesString.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * AdditionalPropertiesString + */ +@JsonPropertyOrder({ + AdditionalPropertiesString.JSON_PROPERTY_NAME +}) +@JsonTypeName("AdditionalPropertiesString") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class AdditionalPropertiesString extends HashMap { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public AdditionalPropertiesString name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; + return Objects.equals(this.name, additionalPropertiesString.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesString {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Animal.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Animal.java new file mode 100644 index 00000000000..5225322d5c8 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Animal.java @@ -0,0 +1,137 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) +@JsonTypeName("Animal") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), +}) + +@Introspected +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + protected String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + private String color = "red"; + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClassName() { + return className; + } + + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(String className) { + this.className = className; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getColor() { + return color; + } + + @JsonProperty(JSON_PROPERTY_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setColor(String color) { + this.color = color; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 00000000000..0388c7c5ae6 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) +@JsonTypeName("ArrayOfArrayOfNumberOnly") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + private List> arrayArrayNumber = null; + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java new file mode 100644 index 00000000000..721d788bd90 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) +@JsonTypeName("ArrayOfNumberOnly") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + private List arrayNumber = null; + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getArrayNumber() { + return arrayNumber; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayTest.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayTest.java new file mode 100644 index 00000000000..07578136d1e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ArrayTest.java @@ -0,0 +1,184 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.model.ReadOnlyFirst; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * ArrayTest + */ +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) +@JsonTypeName("ArrayTest") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + private List arrayOfString = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + private List> arrayArrayOfInteger = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + private List> arrayArrayOfModel = null; + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getArrayOfString() { + return arrayOfString; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/BigCat.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..badc9384314 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) +@JsonTypeName("BigCat") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + TIGERS("tigers"), + LEOPARDS("leopards"), + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public KindEnum getKind() { + return kind; + } + + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setKind(KindEnum kind) { + this.kind = kind; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..cdc464b8e9d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,134 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) +@JsonTypeName("BigCat_allOf") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + TIGERS("tigers"), + LEOPARDS("leopards"), + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public KindEnum getKind() { + return kind; + } + + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setKind(KindEnum kind) { + this.kind = kind; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Capitalization.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Capitalization.java new file mode 100644 index 00000000000..dd01342a8a6 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Capitalization.java @@ -0,0 +1,244 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Capitalization + */ +@JsonPropertyOrder({ + Capitalization.JSON_PROPERTY_SMALL_CAMEL, + Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, + Capitalization.JSON_PROPERTY_SMALL_SNAKE, + Capitalization.JSON_PROPERTY_CAPITAL_SNAKE, + Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, + Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E +}) +@JsonTypeName("Capitalization") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + private String ATT_NAME; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSmallCamel() { + return smallCamel; + } + + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCapitalCamel() { + return capitalCamel; + } + + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSmallSnake() { + return smallSnake; + } + + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCapitalSnake() { + return capitalSnake; + } + + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @Nullable + @ApiModelProperty(value = "Name of the pet ") + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getATTNAME() { + return ATT_NAME; + } + + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Cat.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Cat.java new file mode 100644 index 00000000000..8f9fe12d884 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Cat.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Animal; +import org.openapitools.model.CatAllOf; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) +@JsonTypeName("Cat") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeclawed() { + return declawed; + } + + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/CatAllOf.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/CatAllOf.java new file mode 100644 index 00000000000..4ee623d649b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/CatAllOf.java @@ -0,0 +1,99 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * CatAllOf + */ +@JsonPropertyOrder({ + CatAllOf.JSON_PROPERTY_DECLAWED +}) +@JsonTypeName("Cat_allOf") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class CatAllOf { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + public CatAllOf declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeclawed() { + return declawed; + } + + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatAllOf catAllOf = (CatAllOf) o; + return Objects.equals(this.declawed, catAllOf.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatAllOf {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Category.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Category.java new file mode 100644 index 00000000000..552c577d79a --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Category.java @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@JsonTypeName("Category") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name = "default-name"; + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ClassModel.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ClassModel.java new file mode 100644 index 00000000000..2f94229b7e8 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ClassModel.java @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("ClassModel") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + private String propertyClass; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Dog.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Dog.java new file mode 100644 index 00000000000..8bde5e0809e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Dog.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Animal; +import org.openapitools.model.DogAllOf; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) +@JsonTypeName("Dog") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBreed() { + return breed; + } + + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(String breed) { + this.breed = breed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/DogAllOf.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/DogAllOf.java new file mode 100644 index 00000000000..51dec00ea10 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/DogAllOf.java @@ -0,0 +1,99 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * DogAllOf + */ +@JsonPropertyOrder({ + DogAllOf.JSON_PROPERTY_BREED +}) +@JsonTypeName("Dog_allOf") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class DogAllOf { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + public DogAllOf breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBreed() { + return breed; + } + + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(String breed) { + this.breed = breed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DogAllOf dogAllOf = (DogAllOf) o; + return Objects.equals(this.breed, dogAllOf.breed); + } + + @Override + public int hashCode() { + return Objects.hash(breed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DogAllOf {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumArrays.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumArrays.java new file mode 100644 index 00000000000..c71f5edf0c4 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumArrays.java @@ -0,0 +1,204 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) +@JsonTypeName("EnumArrays") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; + private List arrayEnum = null; + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getArrayEnum() { + return arrayEnum; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumClass.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumClass.java new file mode 100644 index 00000000000..1ee1b126d03 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumClass.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +@Introspected +public enum EnumClass { + _ABC("_abc"), + _EFG("-efg"), + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumTest.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumTest.java new file mode 100644 index 00000000000..0b9c758a822 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/EnumTest.java @@ -0,0 +1,350 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OuterEnum; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * EnumTest + */ +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM +}) +@JsonTypeName("Enum_Test") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + LOWER("lower"), + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + LOWER("lower"), + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @JsonValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_ENUM_NUMBER = "enum_number"; + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + private OuterEnum outerEnum; + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumStringEnum getEnumString() { + return enumString; + } + + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OuterEnum getOuterEnum() { + return outerEnum; + } + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/FileSchemaTestClass.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 00000000000..083b6db28cf --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * FileSchemaTestClass + */ +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) +@JsonTypeName("FileSchemaTestClass") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + private java.io.File file; + + public static final String JSON_PROPERTY_FILES = "files"; + private List files = null; + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @Valid + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public java.io.File getFile() { + return file; + } + + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFiles() { + return files; + } + + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFiles(List files) { + this.files = files; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/FormatTest.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/FormatTest.java new file mode 100644 index 00000000000..239ef22ecb2 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/FormatTest.java @@ -0,0 +1,507 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * FormatTest + */ +@JsonPropertyOrder({ + FormatTest.JSON_PROPERTY_INTEGER, + FormatTest.JSON_PROPERTY_INT32, + FormatTest.JSON_PROPERTY_INT64, + FormatTest.JSON_PROPERTY_NUMBER, + FormatTest.JSON_PROPERTY_FLOAT, + FormatTest.JSON_PROPERTY_DOUBLE, + FormatTest.JSON_PROPERTY_STRING, + FormatTest.JSON_PROPERTY_BYTE, + FormatTest.JSON_PROPERTY_BINARY, + FormatTest.JSON_PROPERTY_DATE, + FormatTest.JSON_PROPERTY_DATE_TIME, + FormatTest.JSON_PROPERTY_UUID, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_BIG_DECIMAL +}) +@JsonTypeName("format_test") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private LocalDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_BIG_DECIMAL = "BigDecimal"; + private BigDecimal bigDecimal; + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @Nullable + @Min(10) + @Max(100) + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInteger() { + return integer; + } + + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @Nullable + @Min(20) + @Max(200) + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInt32() { + return int32; + } + + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getInt64() { + return int64; + } + + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @NotNull + @DecimalMin("32.1") + @DecimalMax("543.2") + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BigDecimal getNumber() { + return number; + } + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @Nullable + @DecimalMin("54.3") + @DecimalMax("987.6") + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Float getFloat() { + return _float; + } + + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @Nullable + @DecimalMin("67.8") + @DecimalMax("123.4") + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getDouble() { + return _double; + } + + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @Nullable + @Pattern(regexp="/[a-z]/i") + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getString() { + return string; + } + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(String string) { + this.string = string; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public byte[] getByte() { + return _byte; + } + + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public File getBinary() { + return binary; + } + + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBinary(File binary) { + this.binary = binary; + } + + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public LocalDate getDate() { + return date; + } + + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") + public void setDate(LocalDate date) { + this.date = date; + } + + public FormatTest dateTime(LocalDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") + public LocalDateTime getDateTime() { + return dateTime; + } + + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") + public void setDateTime(LocalDateTime dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @Nullable + @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getUuid() { + return uuid; + } + + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @NotNull + @Size(min=10, max=64) + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPassword() { + return password; + } + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPassword(String password) { + this.password = password; + } + + public FormatTest bigDecimal(BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + return this; + } + + /** + * Get bigDecimal + * @return bigDecimal + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BIG_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getBigDecimal() { + return bigDecimal; + } + + @JsonProperty(JSON_PROPERTY_BIG_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBigDecimal(BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.bigDecimal, formatTest.bigDecimal); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/HasOnlyReadOnly.java new file mode 100644 index 00000000000..43e713b0305 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) +@JsonTypeName("hasOnlyReadOnly") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + private String foo; + + /** + * Get bar + * @return bar + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBar() { + return bar; + } + + /** + * Get foo + * @return foo + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FOO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFoo() { + return foo; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/MapTest.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/MapTest.java new file mode 100644 index 00000000000..259929412b2 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/MapTest.java @@ -0,0 +1,254 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * MapTest + */ +@JsonPropertyOrder({ + MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, + MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, + MapTest.JSON_PROPERTY_DIRECT_MAP, + MapTest.JSON_PROPERTY_INDIRECT_MAP +}) +@JsonTypeName("MapTest") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + private Map> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string"; + private Map mapOfEnumString = null; + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + private Map directMap = null; + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + private Map indirectMap = null; + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map> getMapMapOfString() { + return mapMapOfString; + } + + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getDirectMap() { + return directMap; + } + + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getIndirectMap() { + return indirectMap; + } + + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..4f546fae5f9 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,173 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.model.Animal; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) +@JsonTypeName("MixedPropertiesAndAdditionalPropertiesClass") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private LocalDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + private Map map = null; + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getUuid() { + return uuid; + } + + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(LocalDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") + public LocalDateTime getDateTime() { + return dateTime; + } + + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") + public void setDateTime(LocalDateTime dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMap() { + return map; + } + + @JsonProperty(JSON_PROPERTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMap(Map map) { + this.map = map; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Model200Response.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Model200Response.java new file mode 100644 index 00000000000..34604b7b3bf --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Model200Response.java @@ -0,0 +1,129 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("200_response") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + private String propertyClass; + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(Integer name) { + this.name = name; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelApiResponse.java new file mode 100644 index 00000000000..7d185d9d0ba --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -0,0 +1,157 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * ModelApiResponse + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@JsonTypeName("ApiResponse") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { + return code; + } + + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelClient.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelClient.java new file mode 100644 index 00000000000..af4f73af5cc --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelClient.java @@ -0,0 +1,99 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * ModelClient + */ +@JsonPropertyOrder({ + ModelClient.JSON_PROPERTY_CLIENT +}) +@JsonTypeName("Client") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ModelClient { + public static final String JSON_PROPERTY_CLIENT = "client"; + private String _client; + + public ModelClient _client(String _client) { + this._client = _client; + return this; + } + + /** + * Get _client + * @return _client + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClient() { + return _client; + } + + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setClient(String _client) { + this._client = _client; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelClient _client = (ModelClient) o; + return Objects.equals(this._client, _client._client); + } + + @Override + public int hashCode() { + return Objects.hash(_client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelClient {\n"); + sb.append(" _client: ").append(toIndentedString(_client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelReturn.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelReturn.java new file mode 100644 index 00000000000..2688ecad262 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ModelReturn.java @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) +@JsonTypeName("Return") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + private Integer _return; + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_RETURN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getReturn() { + return _return; + } + + @JsonProperty(JSON_PROPERTY_RETURN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReturn(Integer _return) { + this._return = _return; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Name.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Name.java new file mode 100644 index 00000000000..018d3cf558e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Name.java @@ -0,0 +1,165 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) +@JsonTypeName("Name") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + private Integer _123number; + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(Integer name) { + this.name = name; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getSnakeCase() { + return snakeCase; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getProperty() { + return property; + } + + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperty(String property) { + this.property = property; + } + + /** + * Get _123number + * @return _123number + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_123NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer get123number() { + return _123number; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/NumberOnly.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/NumberOnly.java new file mode 100644 index 00000000000..e4197f390e5 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/NumberOnly.java @@ -0,0 +1,100 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) +@JsonTypeName("NumberOnly") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + private BigDecimal justNumber; + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getJustNumber() { + return justNumber; + } + + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Order.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Order.java new file mode 100644 index 00000000000..8ecdbda1260 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Order.java @@ -0,0 +1,281 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Order + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +@JsonTypeName("Order") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + private LocalDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + APPROVED("approved"), + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + private Boolean complete = false; + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPetId() { + return petId; + } + + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getQuantity() { + return quantity; + } + + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(LocalDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") + public LocalDateTime getShipDate() { + return shipDate; + } + + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX") + public void setShipDate(LocalDateTime shipDate) { + this.shipDate = shipDate; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @Nullable + @ApiModelProperty(value = "Order Status") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getComplete() { + return complete; + } + + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(Boolean complete) { + this.complete = complete; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/OuterComposite.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/OuterComposite.java new file mode 100644 index 00000000000..4c41ddc658f --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/OuterComposite.java @@ -0,0 +1,158 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * OuterComposite + */ +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) +@JsonTypeName("OuterComposite") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + private Boolean myBoolean; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getMyNumber() { + return myNumber; + } + + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMyString() { + return myString; + } + + @JsonProperty(JSON_PROPERTY_MY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getMyBoolean() { + return myBoolean; + } + + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/OuterEnum.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/OuterEnum.java new file mode 100644 index 00000000000..76fe37007e9 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/OuterEnum.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +@Introspected +public enum OuterEnum { + PLACED("placed"), + APPROVED("approved"), + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Pet.java new file mode 100644 index 00000000000..70fffbf6574 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Pet.java @@ -0,0 +1,298 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.model.Category; +import org.openapitools.model.Tag; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Pet + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +@JsonTypeName("Pet") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + private Set photoUrls = new LinkedHashSet(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + PENDING("pending"), + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @Valid + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Category getCategory() { + return category; + } + + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(Category category) { + this.category = category; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(String name) { + this.name = name; + } + + public Pet photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Set getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(List tags) { + this.tags = tags; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @Nullable + @ApiModelProperty(value = "pet status in the store") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(StatusEnum status) { + this.status = status; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..a9827ceca00 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -0,0 +1,117 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) +@JsonTypeName("ReadOnlyFirst") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + private String baz; + + /** + * Get bar + * @return bar + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBar() { + return bar; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAZ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBaz() { + return baz; + } + + @JsonProperty(JSON_PROPERTY_BAZ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBaz(String baz) { + this.baz = baz; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/SpecialModelName.java new file mode 100644 index 00000000000..0845ebff638 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/SpecialModelName.java @@ -0,0 +1,99 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME +}) +@JsonTypeName("$special[model.name]") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + private Long $specialPropertyName; + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName $specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Tag.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Tag.java new file mode 100644 index 00000000000..eee95fd360d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/Tag.java @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@JsonTypeName("Tag") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/TypeHolderDefault.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/TypeHolderDefault.java new file mode 100644 index 00000000000..7475ae2ec45 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/TypeHolderDefault.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * TypeHolderDefault + */ +@JsonPropertyOrder({ + TypeHolderDefault.JSON_PROPERTY_STRING_ITEM, + TypeHolderDefault.JSON_PROPERTY_NUMBER_ITEM, + TypeHolderDefault.JSON_PROPERTY_INTEGER_ITEM, + TypeHolderDefault.JSON_PROPERTY_BOOL_ITEM, + TypeHolderDefault.JSON_PROPERTY_ARRAY_ITEM +}) +@JsonTypeName("TypeHolderDefault") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class TypeHolderDefault { + public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + private String stringItem = "what"; + + public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + private BigDecimal numberItem; + + public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + private Integer integerItem; + + public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + private Boolean boolItem = true; + + public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + private List arrayItem = new ArrayList(); + + public TypeHolderDefault stringItem(String stringItem) { + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStringItem() { + return stringItem; + } + + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStringItem(String stringItem) { + this.stringItem = stringItem; + } + + public TypeHolderDefault numberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BigDecimal getNumberItem() { + return numberItem; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + } + + public TypeHolderDefault integerItem(Integer integerItem) { + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getIntegerItem() { + return integerItem; + } + + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIntegerItem(Integer integerItem) { + this.integerItem = integerItem; + } + + public TypeHolderDefault boolItem(Boolean boolItem) { + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getBoolItem() { + return boolItem; + } + + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBoolItem(Boolean boolItem) { + this.boolItem = boolItem; + } + + public TypeHolderDefault arrayItem(List arrayItem) { + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getArrayItem() { + return arrayItem; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayItem(List arrayItem) { + this.arrayItem = arrayItem; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; + return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && + Objects.equals(this.numberItem, typeHolderDefault.numberItem) && + Objects.equals(this.integerItem, typeHolderDefault.integerItem) && + Objects.equals(this.boolItem, typeHolderDefault.boolItem) && + Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderDefault {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/TypeHolderExample.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/TypeHolderExample.java new file mode 100644 index 00000000000..539ef489b97 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/TypeHolderExample.java @@ -0,0 +1,252 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * TypeHolderExample + */ +@JsonPropertyOrder({ + TypeHolderExample.JSON_PROPERTY_STRING_ITEM, + TypeHolderExample.JSON_PROPERTY_NUMBER_ITEM, + TypeHolderExample.JSON_PROPERTY_FLOAT_ITEM, + TypeHolderExample.JSON_PROPERTY_INTEGER_ITEM, + TypeHolderExample.JSON_PROPERTY_BOOL_ITEM, + TypeHolderExample.JSON_PROPERTY_ARRAY_ITEM +}) +@JsonTypeName("TypeHolderExample") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class TypeHolderExample { + public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + private String stringItem; + + public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + private BigDecimal numberItem; + + public static final String JSON_PROPERTY_FLOAT_ITEM = "float_item"; + private Float floatItem; + + public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + private Integer integerItem; + + public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + private Boolean boolItem; + + public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + private List arrayItem = new ArrayList(); + + public TypeHolderExample stringItem(String stringItem) { + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + **/ + @NotNull + @ApiModelProperty(example = "what", required = true, value = "") + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStringItem() { + return stringItem; + } + + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStringItem(String stringItem) { + this.stringItem = stringItem; + } + + public TypeHolderExample numberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + **/ + @NotNull + @ApiModelProperty(example = "1.234", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BigDecimal getNumberItem() { + return numberItem; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + } + + public TypeHolderExample floatItem(Float floatItem) { + this.floatItem = floatItem; + return this; + } + + /** + * Get floatItem + * @return floatItem + **/ + @NotNull + @ApiModelProperty(example = "1.234", required = true, value = "") + @JsonProperty(JSON_PROPERTY_FLOAT_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Float getFloatItem() { + return floatItem; + } + + @JsonProperty(JSON_PROPERTY_FLOAT_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFloatItem(Float floatItem) { + this.floatItem = floatItem; + } + + public TypeHolderExample integerItem(Integer integerItem) { + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + **/ + @NotNull + @ApiModelProperty(example = "-2", required = true, value = "") + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getIntegerItem() { + return integerItem; + } + + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIntegerItem(Integer integerItem) { + this.integerItem = integerItem; + } + + public TypeHolderExample boolItem(Boolean boolItem) { + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + **/ + @NotNull + @ApiModelProperty(example = "true", required = true, value = "") + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getBoolItem() { + return boolItem; + } + + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBoolItem(Boolean boolItem) { + this.boolItem = boolItem; + } + + public TypeHolderExample arrayItem(List arrayItem) { + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + **/ + @NotNull + @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getArrayItem() { + return arrayItem; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayItem(List arrayItem) { + this.arrayItem = arrayItem; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderExample typeHolderExample = (TypeHolderExample) o; + return Objects.equals(this.stringItem, typeHolderExample.stringItem) && + Objects.equals(this.numberItem, typeHolderExample.numberItem) && + Objects.equals(this.floatItem, typeHolderExample.floatItem) && + Objects.equals(this.integerItem, typeHolderExample.integerItem) && + Objects.equals(this.boolItem, typeHolderExample.boolItem) && + Objects.equals(this.arrayItem, typeHolderExample.arrayItem); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderExample {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/User.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/User.java new file mode 100644 index 00000000000..caea2374d87 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/User.java @@ -0,0 +1,302 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * User + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) +@JsonTypeName("User") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class User { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + private Integer userStatus; + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(Long id) { + this.id = id; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { + return username; + } + + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(String username) { + this.username = username; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirstName() { + return firstName; + } + + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastName() { + return lastName; + } + + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(String email) { + this.email = email; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(String password) { + this.password = password; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPhone() { + return phone; + } + + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(String phone) { + this.phone = phone; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @Nullable + @ApiModelProperty(value = "User Status") + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getUserStatus() { + return userStatus; + } + + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/XmlItem.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/XmlItem.java new file mode 100644 index 00000000000..5ef91590040 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/model/XmlItem.java @@ -0,0 +1,986 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.*; + +import javax.validation.constraints.*; +import javax.validation.Valid; +import io.micronaut.core.annotation.*; +import javax.annotation.Generated; + +/** + * XmlItem + */ +@JsonPropertyOrder({ + XmlItem.JSON_PROPERTY_ATTRIBUTE_STRING, + XmlItem.JSON_PROPERTY_ATTRIBUTE_NUMBER, + XmlItem.JSON_PROPERTY_ATTRIBUTE_INTEGER, + XmlItem.JSON_PROPERTY_ATTRIBUTE_BOOLEAN, + XmlItem.JSON_PROPERTY_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_NAME_STRING, + XmlItem.JSON_PROPERTY_NAME_NUMBER, + XmlItem.JSON_PROPERTY_NAME_INTEGER, + XmlItem.JSON_PROPERTY_NAME_BOOLEAN, + XmlItem.JSON_PROPERTY_NAME_ARRAY, + XmlItem.JSON_PROPERTY_NAME_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_STRING, + XmlItem.JSON_PROPERTY_PREFIX_NUMBER, + XmlItem.JSON_PROPERTY_PREFIX_INTEGER, + XmlItem.JSON_PROPERTY_PREFIX_BOOLEAN, + XmlItem.JSON_PROPERTY_PREFIX_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_NAMESPACE_STRING, + XmlItem.JSON_PROPERTY_NAMESPACE_NUMBER, + XmlItem.JSON_PROPERTY_NAMESPACE_INTEGER, + XmlItem.JSON_PROPERTY_NAMESPACE_BOOLEAN, + XmlItem.JSON_PROPERTY_NAMESPACE_ARRAY, + XmlItem.JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_NS_STRING, + XmlItem.JSON_PROPERTY_PREFIX_NS_NUMBER, + XmlItem.JSON_PROPERTY_PREFIX_NS_INTEGER, + XmlItem.JSON_PROPERTY_PREFIX_NS_BOOLEAN, + XmlItem.JSON_PROPERTY_PREFIX_NS_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY +}) +@JsonTypeName("XmlItem") +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Introspected +public class XmlItem { + public static final String JSON_PROPERTY_ATTRIBUTE_STRING = "attribute_string"; + private String attributeString; + + public static final String JSON_PROPERTY_ATTRIBUTE_NUMBER = "attribute_number"; + private BigDecimal attributeNumber; + + public static final String JSON_PROPERTY_ATTRIBUTE_INTEGER = "attribute_integer"; + private Integer attributeInteger; + + public static final String JSON_PROPERTY_ATTRIBUTE_BOOLEAN = "attribute_boolean"; + private Boolean attributeBoolean; + + public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array"; + private List wrappedArray = null; + + public static final String JSON_PROPERTY_NAME_STRING = "name_string"; + private String nameString; + + public static final String JSON_PROPERTY_NAME_NUMBER = "name_number"; + private BigDecimal nameNumber; + + public static final String JSON_PROPERTY_NAME_INTEGER = "name_integer"; + private Integer nameInteger; + + public static final String JSON_PROPERTY_NAME_BOOLEAN = "name_boolean"; + private Boolean nameBoolean; + + public static final String JSON_PROPERTY_NAME_ARRAY = "name_array"; + private List nameArray = null; + + public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array"; + private List nameWrappedArray = null; + + public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string"; + private String prefixString; + + public static final String JSON_PROPERTY_PREFIX_NUMBER = "prefix_number"; + private BigDecimal prefixNumber; + + public static final String JSON_PROPERTY_PREFIX_INTEGER = "prefix_integer"; + private Integer prefixInteger; + + public static final String JSON_PROPERTY_PREFIX_BOOLEAN = "prefix_boolean"; + private Boolean prefixBoolean; + + public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array"; + private List prefixArray = null; + + public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; + private List prefixWrappedArray = null; + + public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string"; + private String namespaceString; + + public static final String JSON_PROPERTY_NAMESPACE_NUMBER = "namespace_number"; + private BigDecimal namespaceNumber; + + public static final String JSON_PROPERTY_NAMESPACE_INTEGER = "namespace_integer"; + private Integer namespaceInteger; + + public static final String JSON_PROPERTY_NAMESPACE_BOOLEAN = "namespace_boolean"; + private Boolean namespaceBoolean; + + public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array"; + private List namespaceArray = null; + + public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; + private List namespaceWrappedArray = null; + + public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string"; + private String prefixNsString; + + public static final String JSON_PROPERTY_PREFIX_NS_NUMBER = "prefix_ns_number"; + private BigDecimal prefixNsNumber; + + public static final String JSON_PROPERTY_PREFIX_NS_INTEGER = "prefix_ns_integer"; + private Integer prefixNsInteger; + + public static final String JSON_PROPERTY_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; + private Boolean prefixNsBoolean; + + public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array"; + private List prefixNsArray = null; + + public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; + private List prefixNsWrappedArray = null; + + public XmlItem attributeString(String attributeString) { + this.attributeString = attributeString; + return this; + } + + /** + * Get attributeString + * @return attributeString + **/ + @Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAttributeString() { + return attributeString; + } + + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAttributeString(String attributeString) { + this.attributeString = attributeString; + } + + public XmlItem attributeNumber(BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + return this; + } + + /** + * Get attributeNumber + * @return attributeNumber + **/ + @Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getAttributeNumber() { + return attributeNumber; + } + + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAttributeNumber(BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + } + + public XmlItem attributeInteger(Integer attributeInteger) { + this.attributeInteger = attributeInteger; + return this; + } + + /** + * Get attributeInteger + * @return attributeInteger + **/ + @Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getAttributeInteger() { + return attributeInteger; + } + + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAttributeInteger(Integer attributeInteger) { + this.attributeInteger = attributeInteger; + } + + public XmlItem attributeBoolean(Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + return this; + } + + /** + * Get attributeBoolean + * @return attributeBoolean + **/ + @Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getAttributeBoolean() { + return attributeBoolean; + } + + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAttributeBoolean(Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + } + + public XmlItem wrappedArray(List wrappedArray) { + this.wrappedArray = wrappedArray; + return this; + } + + public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { + if (this.wrappedArray == null) { + this.wrappedArray = new ArrayList(); + } + this.wrappedArray.add(wrappedArrayItem); + return this; + } + + /** + * Get wrappedArray + * @return wrappedArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getWrappedArray() { + return wrappedArray; + } + + @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWrappedArray(List wrappedArray) { + this.wrappedArray = wrappedArray; + } + + public XmlItem nameString(String nameString) { + this.nameString = nameString; + return this; + } + + /** + * Get nameString + * @return nameString + **/ + @Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_NAME_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNameString() { + return nameString; + } + + @JsonProperty(JSON_PROPERTY_NAME_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNameString(String nameString) { + this.nameString = nameString; + } + + public XmlItem nameNumber(BigDecimal nameNumber) { + this.nameNumber = nameNumber; + return this; + } + + /** + * Get nameNumber + * @return nameNumber + **/ + @Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_NAME_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getNameNumber() { + return nameNumber; + } + + @JsonProperty(JSON_PROPERTY_NAME_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNameNumber(BigDecimal nameNumber) { + this.nameNumber = nameNumber; + } + + public XmlItem nameInteger(Integer nameInteger) { + this.nameInteger = nameInteger; + return this; + } + + /** + * Get nameInteger + * @return nameInteger + **/ + @Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_NAME_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getNameInteger() { + return nameInteger; + } + + @JsonProperty(JSON_PROPERTY_NAME_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNameInteger(Integer nameInteger) { + this.nameInteger = nameInteger; + } + + public XmlItem nameBoolean(Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + return this; + } + + /** + * Get nameBoolean + * @return nameBoolean + **/ + @Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_NAME_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getNameBoolean() { + return nameBoolean; + } + + @JsonProperty(JSON_PROPERTY_NAME_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNameBoolean(Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + } + + public XmlItem nameArray(List nameArray) { + this.nameArray = nameArray; + return this; + } + + public XmlItem addNameArrayItem(Integer nameArrayItem) { + if (this.nameArray == null) { + this.nameArray = new ArrayList(); + } + this.nameArray.add(nameArrayItem); + return this; + } + + /** + * Get nameArray + * @return nameArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNameArray() { + return nameArray; + } + + @JsonProperty(JSON_PROPERTY_NAME_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNameArray(List nameArray) { + this.nameArray = nameArray; + } + + public XmlItem nameWrappedArray(List nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + return this; + } + + public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { + if (this.nameWrappedArray == null) { + this.nameWrappedArray = new ArrayList(); + } + this.nameWrappedArray.add(nameWrappedArrayItem); + return this; + } + + /** + * Get nameWrappedArray + * @return nameWrappedArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNameWrappedArray() { + return nameWrappedArray; + } + + @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNameWrappedArray(List nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + } + + public XmlItem prefixString(String prefixString) { + this.prefixString = prefixString; + return this; + } + + /** + * Get prefixString + * @return prefixString + **/ + @Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrefixString() { + return prefixString; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixString(String prefixString) { + this.prefixString = prefixString; + } + + public XmlItem prefixNumber(BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + return this; + } + + /** + * Get prefixNumber + * @return prefixNumber + **/ + @Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getPrefixNumber() { + return prefixNumber; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixNumber(BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + } + + public XmlItem prefixInteger(Integer prefixInteger) { + this.prefixInteger = prefixInteger; + return this; + } + + /** + * Get prefixInteger + * @return prefixInteger + **/ + @Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getPrefixInteger() { + return prefixInteger; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixInteger(Integer prefixInteger) { + this.prefixInteger = prefixInteger; + } + + public XmlItem prefixBoolean(Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + return this; + } + + /** + * Get prefixBoolean + * @return prefixBoolean + **/ + @Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getPrefixBoolean() { + return prefixBoolean; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixBoolean(Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + } + + public XmlItem prefixArray(List prefixArray) { + this.prefixArray = prefixArray; + return this; + } + + public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { + if (this.prefixArray == null) { + this.prefixArray = new ArrayList(); + } + this.prefixArray.add(prefixArrayItem); + return this; + } + + /** + * Get prefixArray + * @return prefixArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getPrefixArray() { + return prefixArray; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixArray(List prefixArray) { + this.prefixArray = prefixArray; + } + + public XmlItem prefixWrappedArray(List prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + return this; + } + + public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { + if (this.prefixWrappedArray == null) { + this.prefixWrappedArray = new ArrayList(); + } + this.prefixWrappedArray.add(prefixWrappedArrayItem); + return this; + } + + /** + * Get prefixWrappedArray + * @return prefixWrappedArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getPrefixWrappedArray() { + return prefixWrappedArray; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixWrappedArray(List prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + } + + public XmlItem namespaceString(String namespaceString) { + this.namespaceString = namespaceString; + return this; + } + + /** + * Get namespaceString + * @return namespaceString + **/ + @Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNamespaceString() { + return namespaceString; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespaceString(String namespaceString) { + this.namespaceString = namespaceString; + } + + public XmlItem namespaceNumber(BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + return this; + } + + /** + * Get namespaceNumber + * @return namespaceNumber + **/ + @Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getNamespaceNumber() { + return namespaceNumber; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespaceNumber(BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + } + + public XmlItem namespaceInteger(Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + return this; + } + + /** + * Get namespaceInteger + * @return namespaceInteger + **/ + @Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getNamespaceInteger() { + return namespaceInteger; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespaceInteger(Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + } + + public XmlItem namespaceBoolean(Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + return this; + } + + /** + * Get namespaceBoolean + * @return namespaceBoolean + **/ + @Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getNamespaceBoolean() { + return namespaceBoolean; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespaceBoolean(Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + } + + public XmlItem namespaceArray(List namespaceArray) { + this.namespaceArray = namespaceArray; + return this; + } + + public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { + if (this.namespaceArray == null) { + this.namespaceArray = new ArrayList(); + } + this.namespaceArray.add(namespaceArrayItem); + return this; + } + + /** + * Get namespaceArray + * @return namespaceArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNamespaceArray() { + return namespaceArray; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespaceArray(List namespaceArray) { + this.namespaceArray = namespaceArray; + } + + public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + return this; + } + + public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { + if (this.namespaceWrappedArray == null) { + this.namespaceWrappedArray = new ArrayList(); + } + this.namespaceWrappedArray.add(namespaceWrappedArrayItem); + return this; + } + + /** + * Get namespaceWrappedArray + * @return namespaceWrappedArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getNamespaceWrappedArray() { + return namespaceWrappedArray; + } + + @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNamespaceWrappedArray(List namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + } + + public XmlItem prefixNsString(String prefixNsString) { + this.prefixNsString = prefixNsString; + return this; + } + + /** + * Get prefixNsString + * @return prefixNsString + **/ + @Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrefixNsString() { + return prefixNsString; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixNsString(String prefixNsString) { + this.prefixNsString = prefixNsString; + } + + public XmlItem prefixNsNumber(BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + return this; + } + + /** + * Get prefixNsNumber + * @return prefixNsNumber + **/ + @Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getPrefixNsNumber() { + return prefixNsNumber; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixNsNumber(BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + } + + public XmlItem prefixNsInteger(Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + return this; + } + + /** + * Get prefixNsInteger + * @return prefixNsInteger + **/ + @Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getPrefixNsInteger() { + return prefixNsInteger; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_NS_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixNsInteger(Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + } + + public XmlItem prefixNsBoolean(Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + return this; + } + + /** + * Get prefixNsBoolean + * @return prefixNsBoolean + **/ + @Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getPrefixNsBoolean() { + return prefixNsBoolean; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_NS_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixNsBoolean(Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + } + + public XmlItem prefixNsArray(List prefixNsArray) { + this.prefixNsArray = prefixNsArray; + return this; + } + + public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { + if (this.prefixNsArray == null) { + this.prefixNsArray = new ArrayList(); + } + this.prefixNsArray.add(prefixNsArrayItem); + return this; + } + + /** + * Get prefixNsArray + * @return prefixNsArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getPrefixNsArray() { + return prefixNsArray; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixNsArray(List prefixNsArray) { + this.prefixNsArray = prefixNsArray; + } + + public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + return this; + } + + public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { + if (this.prefixNsWrappedArray == null) { + this.prefixNsWrappedArray = new ArrayList(); + } + this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); + return this; + } + + /** + * Get prefixNsWrappedArray + * @return prefixNsWrappedArray + **/ + @Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getPrefixNsWrappedArray() { + return prefixNsWrappedArray; + } + + @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrefixNsWrappedArray(List prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + XmlItem xmlItem = (XmlItem) o; + return Objects.equals(this.attributeString, xmlItem.attributeString) && + Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && + Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && + Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && + Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && + Objects.equals(this.nameString, xmlItem.nameString) && + Objects.equals(this.nameNumber, xmlItem.nameNumber) && + Objects.equals(this.nameInteger, xmlItem.nameInteger) && + Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && + Objects.equals(this.nameArray, xmlItem.nameArray) && + Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && + Objects.equals(this.prefixString, xmlItem.prefixString) && + Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && + Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && + Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && + Objects.equals(this.prefixArray, xmlItem.prefixArray) && + Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && + Objects.equals(this.namespaceString, xmlItem.namespaceString) && + Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && + Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && + Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && + Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && + Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && + Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && + Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && + Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && + Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && + Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && + Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); + } + + @Override + public int hashCode() { + return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XmlItem {\n"); + sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); + sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); + sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); + sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); + sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); + sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); + sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); + sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); + sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); + sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); + sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); + sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); + sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); + sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); + sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); + sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); + sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); + sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); + sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); + sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); + sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); + sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); + sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); + sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); + sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); + sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); + sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); + sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); + sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/query/QueryParam.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/query/QueryParam.java new file mode 100644 index 00000000000..f6b153387d8 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/query/QueryParam.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.query; + +import io.micronaut.context.annotation.AliasFor; +import io.micronaut.core.bind.annotation.Bindable; +import javax.annotation.Generated; +import java.lang.annotation.*; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + + +/** + * Indicates that the parameter is a query parameter + */ +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Documented +@Retention(RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE}) +@Bindable +@Inherited +public @interface QueryParam { + + /** + * @return The name of the parameter + */ + @AliasFor(annotation = Bindable.class, member = "value") + String value() default ""; + + /** + * @return The name of the parameter + */ + @AliasFor(annotation = Bindable.class, member = "value") + String name() default ""; + + /** + * @see Bindable#defaultValue() + * @return The default value + */ + @AliasFor(annotation = Bindable.class, member = "defaultValue") + String defaultValue() default ""; + + /** + * @return The format of the given values in the URL + */ + Format format() default Format.CSV; + + /** + * The possible formats of the query parameter in the URL. + * The conversion of various types is according to openapi v3 specification: + * @see openapi v3 specification + * Values are serialized using Jackson object mapper + */ + public static enum Format { + /** + * The values of iterator are comma-delimited. + * Ambiguity can arise if values of Iterator contain commas inside themselves. In such case, the MUTLI format + * should be preferred. + * Null values are not supported and will be removed during the conversion process. + */ + CSV, + /** + * The values are space-delimited, similarly to comma-delimited format. + */ + SSV, + /** + * The values a delimited by pipes "|", similarly to comma-delimited format. + */ + PIPES, + /** + * The values are repeated as separate parameters, e.g.: color=blue&color=black&color=brown. + */ + MULTI, + /** + * The format supports 1-depth recursion into objects with setting each attribute as a separate parameter, e.g.: + * 'color[R]=100&color[G]=200&color[B]=150'. + */ + DEEP_OBJECT + } +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/query/QueryParamBinder.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/query/QueryParamBinder.java new file mode 100644 index 00000000000..302b4bfabe5 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/query/QueryParamBinder.java @@ -0,0 +1,175 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.query; + +import io.micronaut.core.annotation.NonNull; +import io.micronaut.core.beans.BeanProperty; +import io.micronaut.core.beans.BeanWrapper; +import io.micronaut.core.convert.ArgumentConversionContext; +import io.micronaut.core.convert.ConversionContext; +import io.micronaut.core.convert.ConversionService; +import io.micronaut.core.util.StringUtils; +import io.micronaut.http.MutableHttpRequest; +import io.micronaut.http.client.bind.AnnotatedClientArgumentRequestBinder; +import io.micronaut.http.client.bind.ClientRequestUriContext; + +import java.util.Collection; +import java.util.Optional; +import jakarta.inject.Singleton; +import javax.annotation.Generated; + + +@Generated(value="org.openapitools.codegen.languages.JavaMicronautClientCodegen") +@Singleton +public class QueryParamBinder implements AnnotatedClientArgumentRequestBinder { + private static final Character COMMA_DELIMITER = ','; + private static final Character PIPE_DELIMITER = '|'; + private static final Character SPACE_DELIMITER = ' '; + + private final ConversionService conversionService; + + public QueryParamBinder(ConversionService conversionService) { + this.conversionService = conversionService; + } + + @NonNull + @Override + public Class getAnnotationType() { + return QueryParam.class; + } + + @Override + public void bind(@NonNull ArgumentConversionContext context, + @NonNull ClientRequestUriContext uriContext, + @NonNull Object value, + @NonNull MutableHttpRequest request + ) { + String key = context.getAnnotationMetadata().stringValue(QueryParam.class) + .filter(StringUtils::isNotEmpty) + .orElse(context.getArgument().getName()); + + QueryParam.Format format = context.getAnnotationMetadata() + .enumValue(QueryParam.class, "format", QueryParam.Format.class) + .orElse(QueryParam.Format.CSV); + + if (format == QueryParam.Format.DEEP_OBJECT) { + addDeepObjectParameters(context, value, key, uriContext); + } else if (format == QueryParam.Format.MULTI) { + addMultiParameters(context, value, key, uriContext); + } else { + Character delimiter = ' '; + switch (format) { + case SSV: + delimiter = SPACE_DELIMITER; + break; + case PIPES: + delimiter = PIPE_DELIMITER; + break; + case CSV: + delimiter = COMMA_DELIMITER; + break; + default: + } + createSeparatedQueryParam(context, value, delimiter) + .ifPresent(v -> uriContext.addQueryParameter(key, v)); + } + } + + private void addMultiParameters( + ArgumentConversionContext context, Object value, String key, ClientRequestUriContext uriContext + ) { + if (value instanceof Iterable) { + // noinspection unechecked + Iterable iterable = (Iterable) value; + + for (Object item : iterable) { + convertToString(context, item).ifPresent(v -> uriContext.addQueryParameter(key, v)); + } + } else { + convertToString(context, value).ifPresent(v -> uriContext.addQueryParameter(key, v)); + } + } + + private void addDeepObjectParameters( + ArgumentConversionContext context, Object value, String key, ClientRequestUriContext uriContext + ) { + if (value instanceof Iterable) { + StringBuilder builder = new StringBuilder(key); + + Iterable iterable = (Iterable) value; + + int i = 0; + for (Object item: iterable) { + if (item == null) { + continue; + } + String index = String.valueOf(i); + + builder.append('['); + builder.append(index); + builder.append(']'); + + convertToString(context, item).ifPresent(v -> uriContext.addQueryParameter(builder.toString(), v)); + builder.delete(builder.length() - index.length() - 2, builder.length()); + i++; + } + } else if (value != null) { + StringBuilder builder = new StringBuilder(key); + BeanWrapper wrapper = BeanWrapper.getWrapper(value); + Collection> properties = wrapper.getBeanProperties(); + for (BeanProperty property: properties) { + Object item = property.get(value); + if (item == null) { + continue; + } + builder.append('['); + builder.append(property.getName()); + builder.append(']'); + + convertToString(context, item).ifPresent(v -> uriContext.addQueryParameter(builder.toString(), v)); + builder.delete(builder.length() - property.getName().length() - 2, builder.length()); + } + } + } + + private Optional createSeparatedQueryParam( + ArgumentConversionContext context, Object value, Character delimiter + ) { + if (value instanceof Iterable) { + StringBuilder builder = new StringBuilder(); + // noinspection unechecked + Iterable iterable = (Iterable) value; + + boolean first = true; + for (Object item : iterable) { + Optional opt = convertToString(context, item); + if (opt.isPresent()) { + if (!first) { + builder.append(delimiter); + } + first = false; + builder.append(opt.get()); + } + } + + return Optional.of(builder.toString()); + } else { + return convertToString(context, value); + } + } + + private Optional convertToString(ArgumentConversionContext context, Object value) { + return conversionService.convert(value, ConversionContext.STRING.with(context.getAnnotationMetadata())) + .filter(StringUtils::isNotEmpty); + } +} diff --git a/samples/client/petstore/java-micronaut-client/src/main/resources/application.yml b/samples/client/petstore/java-micronaut-client/src/main/resources/application.yml new file mode 100644 index 00000000000..bf9e0df6cad --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/main/resources/application.yml @@ -0,0 +1,32 @@ +base-path: "http://petstore.swagger.io:80/v2" +context-path: "/v2" + +micronaut: + application: + name: petstore-micronaut + # 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 + + + +jackson: + serialization: + writeEnumsUsingToString: true + writeDatesAsTimestamps: false + deserialization: + readEnumsUsingToString: true + failOnUnknownProperties: false + failOnInvalidSubtype: false diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/AnotherFakeApiSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/AnotherFakeApiSpec.groovy new file mode 100644 index 00000000000..a4a79ed3c06 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/AnotherFakeApiSpec.groovy @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelClient +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject +import reactor.core.publisher.Mono +import java.util.ArrayList +import java.util.HashMap +import java.util.List +import java.util.Map + + +/** + * API tests for AnotherFakeApi + */ +@MicronautTest +class AnotherFakeApiSpec extends Specification { + + @Inject + AnotherFakeApi api + + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + */ + void "call123testSpecialTags() test"() { + given: + ModelClient _body = null + // ModelClient response = api.call123testSpecialTags(_body).block() + // Mono asyncResponse = api.call123testSpecialTags(_body) + + expect: + true + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/FakeApiSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/FakeApiSpec.groovy new file mode 100644 index 00000000000..b3b45c1e555 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/FakeApiSpec.groovy @@ -0,0 +1,295 @@ +package org.openapitools.api + +import java.math.BigDecimal +import java.io.File +import org.openapitools.model.FileSchemaTestClass +import java.time.LocalDate +import java.time.LocalDateTime +import org.openapitools.model.ModelClient +import org.openapitools.model.OuterComposite +import org.openapitools.model.User +import org.openapitools.model.XmlItem +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject +import reactor.core.publisher.Mono +import java.util.ArrayList +import java.util.HashMap +import java.util.List +import java.util.Map + + +/** + * API tests for FakeApi + */ +@MicronautTest +class FakeApiSpec extends Specification { + + @Inject + FakeApi api + + + /** + * creates an XmlItem + * + * this route creates an XmlItem + */ + void "createXmlItem() test"() { + given: + XmlItem xmlItem = null + // api.createXmlItem(xmlItem).block() + // Mono asyncResponse = api.createXmlItem(xmlItem) + + expect: + true + // TODO: test validations + } + + + /** + * + * + * Test serialization of outer boolean types + */ + void "fakeOuterBooleanSerialize() test"() { + given: + Boolean _body = null + // Boolean response = api.fakeOuterBooleanSerialize(_body).block() + // Mono asyncResponse = api.fakeOuterBooleanSerialize(_body) + + expect: + true + // TODO: test validations + } + + + /** + * + * + * Test serialization of object with outer number type + */ + void "fakeOuterCompositeSerialize() test"() { + given: + OuterComposite _body = null + // OuterComposite response = api.fakeOuterCompositeSerialize(_body).block() + // Mono asyncResponse = api.fakeOuterCompositeSerialize(_body) + + expect: + true + // TODO: test validations + } + + + /** + * + * + * Test serialization of outer number types + */ + void "fakeOuterNumberSerialize() test"() { + given: + BigDecimal _body = null + // BigDecimal response = api.fakeOuterNumberSerialize(_body).block() + // Mono asyncResponse = api.fakeOuterNumberSerialize(_body) + + expect: + true + // TODO: test validations + } + + + /** + * + * + * Test serialization of outer string types + */ + void "fakeOuterStringSerialize() test"() { + given: + String _body = null + // String response = api.fakeOuterStringSerialize(_body).block() + // Mono asyncResponse = api.fakeOuterStringSerialize(_body) + + expect: + true + // TODO: test validations + } + + + /** + * + * + * For this test, the body for this request much reference a schema named `File`. + */ + void "testBodyWithFileSchema() test"() { + given: + FileSchemaTestClass _body = null + // api.testBodyWithFileSchema(_body).block() + // Mono asyncResponse = api.testBodyWithFileSchema(_body) + + expect: + true + // TODO: test validations + } + + + /** + * + */ + void "testBodyWithQueryParams() test"() { + given: + String query = null + User _body = null + // api.testBodyWithQueryParams(query, _body).block() + // Mono asyncResponse = api.testBodyWithQueryParams(query, _body) + + expect: + true + // TODO: test validations + } + + + /** + * To test \"client\" model + * + * To test \"client\" model + */ + void "testClientModel() test"() { + given: + ModelClient _body = null + // ModelClient response = api.testClientModel(_body).block() + // Mono asyncResponse = api.testClientModel(_body) + + expect: + true + // TODO: test validations + } + + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + */ + void "testEndpointParameters() test"() { + given: + BigDecimal number = null + Double _double = null + String patternWithoutDelimiter = null + byte[] _byte = null + Integer integer = null + Integer int32 = null + Long int64 = null + Float _float = null + String string = null + File binary = null + LocalDate date = null + LocalDateTime dateTime = null + String password = null + String paramCallback = null + // api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback).block() + // Mono asyncResponse = api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) + + expect: + true + // TODO: test validations + } + + + /** + * To test enum parameters + * + * To test enum parameters + */ + void "testEnumParameters() test"() { + given: + List enumHeaderStringArray = null + String enumHeaderString = null + List enumQueryStringArray = null + String enumQueryString = null + Integer enumQueryInteger = null + Double enumQueryDouble = null + List enumFormStringArray = null + String enumFormString = null + // api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString).block() + // Mono asyncResponse = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + + expect: + true + // TODO: test validations + } + + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + */ + void "testGroupParameters() test"() { + given: + Integer requiredStringGroup = null + Boolean requiredBooleanGroup = null + Long requiredInt64Group = null + Integer stringGroup = null + Boolean booleanGroup = null + Long int64Group = null + // api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group).block() + // Mono asyncResponse = api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + + expect: + true + // TODO: test validations + } + + + /** + * test inline additionalProperties + */ + void "testInlineAdditionalProperties() test"() { + given: + Map param = null + // api.testInlineAdditionalProperties(param).block() + // Mono asyncResponse = api.testInlineAdditionalProperties(param) + + expect: + true + // TODO: test validations + } + + + /** + * test json serialization of form data + */ + void "testJsonFormData() test"() { + given: + String param = null + String param2 = null + // api.testJsonFormData(param, param2).block() + // Mono asyncResponse = api.testJsonFormData(param, param2) + + expect: + true + // TODO: test validations + } + + + /** + * + * + * To test the collection format in query parameters + */ + void "testQueryParameterCollectionFormat() test"() { + given: + List pipe = null + List ioutil = null + List http = null + List url = null + List context = null + // api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context).block() + // Mono asyncResponse = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + expect: + true + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/FakeClassnameTags123ApiSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/FakeClassnameTags123ApiSpec.groovy new file mode 100644 index 00000000000..a1ed9f1bff7 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/FakeClassnameTags123ApiSpec.groovy @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelClient +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject +import reactor.core.publisher.Mono +import java.util.ArrayList +import java.util.HashMap +import java.util.List +import java.util.Map + + +/** + * API tests for FakeClassnameTags123Api + */ +@MicronautTest +class FakeClassnameTags123ApiSpec extends Specification { + + @Inject + FakeClassnameTags123Api api + + + /** + * To test class name in snake case + * + * To test class name in snake case + */ + void "testClassname() test"() { + given: + ModelClient _body = null + // ModelClient response = api.testClassname(_body).block() + // Mono asyncResponse = api.testClassname(_body) + + expect: + true + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/PetApiSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/PetApiSpec.groovy new file mode 100644 index 00000000000..9133776726e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/PetApiSpec.groovy @@ -0,0 +1,258 @@ +package org.openapitools.api + +import io.micronaut.http.HttpStatus +import io.micronaut.http.client.exceptions.HttpClientResponseException +import org.openapitools.model.Category +import org.openapitools.model.Tag + + +import org.openapitools.model.Pet +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + + +/** + * API tests for PetApi + */ +@MicronautTest +class PetApiSpec extends Specification { + + @Inject + PetApi api + + /** + * Find pet by ID + * Returns a pet when ID < 10. + */ + void "getPetById() test"() { + given: + Long petId = 5L + Pet response = api.getPetById(petId).block() + + expect: + response != null + response.getId() == petId + response.getName() != null + } + + /** + * ID > 10 or nonintegers will simulate API error conditions + */ + void "getPetById() error test"() { + given: + Long petId = -11L + + when: + api.getPetById(petId).block() + + then: + var e = thrown(HttpClientResponseException.class) + e.getMessage() == "Pet not found" + e.getStatus() == HttpStatus.NOT_FOUND + } + + void "add and get pet test"() { + given: + Pet pet = new Pet() + .id(1002L) + .name("Bob") + .status(Pet.StatusEnum.AVAILABLE) + .category(new Category().id(0L).name("string")) + .photoUrls(["string"].toSet()) + .tags([new Tag().id(0L).name("string")]) + + api.addPet(pet).block() + Pet received = api.getPetById(pet.getId()).block() + + expect: + received != null + pet == received + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + */ + void "findPetsByStatus() test"() { + given: + Pet pet = new Pet() + .id(1005L) + .name("Tom") + .status(Pet.StatusEnum.AVAILABLE) + .category(new Category().id(105L).name("Cat category")) + .photoUrls([].toSet()) + .tags([new Tag().id(1L).name("meowing"), new Tag().id(2L).name("purring")]) + + Pet pet2 = new Pet().id(1007L).name("Bob").status(Pet.StatusEnum.AVAILABLE) + Pet pet3 = new Pet().id(1008L).name("Unnamed").status(Pet.StatusEnum.SOLD) + .category(new Category().id(6L).name("Young dog category")) + .tags(new ArrayList<>()).photoUrls([].toSet()) + + when: + api.addPet(pet).block() + api.addPet(pet2).block() + api.addPet(pet3).block() + + List available = api.findPetsByStatus(["available"]).block() + List sold = api.findPetsByStatus(["sold"]).block() + // The description says that it needs to be comma separated, but the actual format is multi + List both = api.findPetsByStatus(["available,sold"]).block() + + then: + // Available pets + available != null + and: "The first pet should be present and match the added pet" + Pet receivedPet = available.stream().filter(p -> p.getId() == pet.getId()).findFirst().orElse(null) + receivedPet != null + pet == receivedPet + and: "The second added pet should be present in the available pets" + available.stream().anyMatch(p -> p.getId() == pet2.getId() && p.getName() == pet2.getName()) + and: "The third pet was sold and should not be present in available pets" + available.stream().allMatch(p -> p.getId() != pet3.getId()) + + // Sold pets + and: "The third added pet should be present in the sold pets" + sold.stream().anyMatch(p -> p.getId() == pet3.getId() && p.getName() == pet3.getName()) + and: "The first pet was sold and should not be present in available pets" + sold.stream().allMatch(p -> p.getId() != pet.getId()) + and: "The second pet was sold and should not be present in available pets" + sold.stream().allMatch(p -> p.getId() != pet2.getId()) + + // Both pets + // The formatting of query needs to be correct for this one + and: "The third pet should be present in all the pets and match the added pet" + Pet receivedPet3 = both.stream().filter(p -> p.getId() == pet3.getId()).findFirst().orElse(null) + receivedPet3 != null + pet3 == receivedPet3 + and: "The second added pet should be present in the all pets" + both.stream().anyMatch(p -> p.getId() == pet2.getId() && p.getName() == pet2.getName()) + and: "The first added pet should be present in the all pets" + both.stream().anyMatch(p -> p.getId() == pet.getId() && p.getName() == pet.getName()) + } + + void "delete non-existing pet error test"() { + when: + api.deletePet(-1L, "special-key").block() + + then: + var e = thrown(HttpClientResponseException.class) + e.getMessage() == "Not Found" + } + + void "add and delete pet test"() { + given: + List status = ["available"] + + List initialPets = api.findPetsByStatus(status).block() + + when: + Pet pet1 = new Pet().id(101L).name("Bob").status(Pet.StatusEnum.AVAILABLE) + Pet pet2 = new Pet().id(103L).name("Rat").status(Pet.StatusEnum.AVAILABLE) + api.addPet(pet1).block() + api.addPet(pet2).block() + + List pets = api.findPetsByStatus(status).block() + + then: "The 2 pets should have been added correctly" + pets != null + pets.size() - initialPets.size() == 2 + pets.stream().anyMatch(p -> p.getId() == pet1.getId() && p.getName() == pet1.getName()) + pets.stream().anyMatch(p -> p.getId() == pet2.getId() && p.getName() == pet2.getName()) + + when: + api.deletePet(pet1.getId(), "special-key").block() + api.deletePet(pet2.getId(), "special-key").block() + + List finalPets = api.findPetsByStatus(status).block() + + then: "The 2 pets should have been deleted" + finalPets != null + pets.size() - finalPets.size() == 2 + finalPets.stream().allMatch(p -> p.getId() != pet1.getId()) + finalPets.stream().allMatch(p -> p.getId() != pet2.getId()) + } + + /** + * Update an existing pet + */ + void "updatePet() test"() { + given: + Pet pet = new Pet().id(1L).name("Jazz") + + when: + api.updatePet(pet).block() + + then: "The pet should be available and match the updates" + Pet received = api.getPetById(1L).block() + pet.getId() == received.getId() + pet.getName() == received.getName() + } + + + /** + * Updates a pet in the store with form data + */ + void "updatePetWithForm() test"() { + given: + Long petId = 2L + String name = "Jack the Bull" + String status = "sold" + + when: + api.updatePetWithForm(petId, name, status).block() + + then: + Pet pet = api.getPetById(2L).block() + petId == pet.getId() + name == pet.getName() + status == pet.getStatus().toString() + } + + + /** + * uploads an image + */ + void "upload file test"() throws IOException { + given: + Long petId = 2L + String additionalMetadata = "a test file" + + File file = new File("hello.txt") + BufferedWriter writer = new BufferedWriter(new FileWriter(file)) + writer.write("Hello world!") + writer.close() + + when: + api.uploadFile(petId, additionalMetadata, new File(file.getAbsolutePath())) + + then: + notThrown() + } + + void "findPetByTags() test"() { + given: + Tag tag = new Tag().name("cute").id(2L) + + Pet pet1 = new Pet().id(2000L).name("Conor").category(new Category().name("cats").id(10L)) + .photoUrls([].toSet()).tags([tag]) + Pet pet2 = new Pet().id(2001L).name("Mike").category(new Category().name("dogs").id(10L)) + .photoUrls([].toSet()).tags([tag]) + + when: + api.addPet(pet1).block() + api.addPet(pet2).block() + + then: "The 2 pets should be successfully found with the given tag" + Set pets = api.findPetsByTags([tag.getName()].toSet()).block() + + pets.stream().allMatch(p -> p.getTags().contains(tag)) + + Pet receivedPet1 = pets.stream().filter(p -> p.getId() == pet1.getId()).findFirst().orElse(null) + Pet receivedPet2 = pets.stream().filter(p -> p.getId() == pet2.getId()).findFirst().orElse(null) + receivedPet1 != null + receivedPet2 != null + pet1 == receivedPet1 + pet2 == receivedPet2 + } +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/StoreApiSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/StoreApiSpec.groovy new file mode 100644 index 00000000000..157f85ee7c7 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/StoreApiSpec.groovy @@ -0,0 +1,79 @@ +package org.openapitools.api + +import io.micronaut.http.client.exceptions.HttpClientResponseException +import org.openapitools.model.Order +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Ignore +import spock.lang.Specification +import jakarta.inject.Inject +import java.time.LocalDateTime + + +/** + * API tests for StoreApi + */ +@MicronautTest +public class StoreApiSpec extends Specification { + + @Inject + StoreApi api + + /** + * Place an order for a pet + */ + @Ignore("The test fails because the produces is specified as */* instead of a specific value") + void "placeOrder() test"() { + given: + Order order = new Order().id(1L).shipDate(LocalDateTime.MIN).complete(true) + .petId(5L).quantity(1).status(Order.StatusEnum.DELIVERED) + + when: + Order response = api.placeOrder(order).block() + + then: + order == response + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + void "getInventory() test"() { + when: + Map response = api.getInventory().block() + + then: + response != null + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + */ + void "getOrderById() test"() { + when: + Long orderId = 4L + Order response = api.getOrderById(orderId).block() + + then: + response != null + orderId == response.getId() + } + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + */ + void "deleteOrder() not existing order error test"() { + given: + String orderId = "1001" + + when: + api.deleteOrder(orderId).block() + + then: + thrown(HttpClientResponseException) + } +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/UserApiSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/UserApiSpec.groovy new file mode 100644 index 00000000000..81e8400577e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/api/UserApiSpec.groovy @@ -0,0 +1,151 @@ +package org.openapitools.api + +import org.openapitools.model.User +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject +import reactor.core.publisher.Mono +import java.util.ArrayList +import java.util.HashMap +import java.util.List +import java.util.Map + + +/** + * API tests for UserApi + */ +@MicronautTest +class UserApiSpec extends Specification { + + @Inject + UserApi api + + + /** + * Create user + * + * This can only be done by the logged in user. + */ + void "createUser() test"() { + given: + User _body = null + // api.createUser(_body).block() + // Mono asyncResponse = api.createUser(_body) + + expect: + true + // TODO: test validations + } + + + /** + * Creates list of users with given input array + */ + void "createUsersWithArrayInput() test"() { + given: + List _body = null + // api.createUsersWithArrayInput(_body).block() + // Mono asyncResponse = api.createUsersWithArrayInput(_body) + + expect: + true + // TODO: test validations + } + + + /** + * Creates list of users with given input array + */ + void "createUsersWithListInput() test"() { + given: + List _body = null + // api.createUsersWithListInput(_body).block() + // Mono asyncResponse = api.createUsersWithListInput(_body) + + expect: + true + // TODO: test validations + } + + + /** + * Delete user + * + * This can only be done by the logged in user. + */ + void "deleteUser() test"() { + given: + String username = null + // api.deleteUser(username).block() + // Mono asyncResponse = api.deleteUser(username) + + expect: + true + // TODO: test validations + } + + + /** + * Get user by user name + */ + void "getUserByName() test"() { + given: + String username = null + // User response = api.getUserByName(username).block() + // Mono asyncResponse = api.getUserByName(username) + + expect: + true + // TODO: test validations + } + + + /** + * Logs user into the system + */ + void "loginUser() test"() { + given: + String username = null + String password = null + // String response = api.loginUser(username, password).block() + // Mono asyncResponse = api.loginUser(username, password) + + expect: + true + // TODO: test validations + } + + + /** + * Logs out current logged in user session + */ + void "logoutUser() test"() { + given: + // api.logoutUser().block() + // Mono asyncResponse = api.logoutUser() + + expect: + true + // TODO: test validations + } + + + /** + * Updated user + * + * This can only be done by the logged in user. + */ + void "updateUser() test"() { + given: + String username = null + User _body = null + // api.updateUser(username, _body).block() + // Mono asyncResponse = api.updateUser(username, _body) + + expect: + true + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesAnyTypeSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesAnyTypeSpec.groovy new file mode 100644 index 00000000000..cf38af5eb11 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesAnyTypeSpec.groovy @@ -0,0 +1,32 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.HashMap +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesAnyType + */ +@MicronautTest +public class AdditionalPropertiesAnyTypeSpec extends Specification { + private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType() + + /** + * Model tests for AdditionalPropertiesAnyType + */ + void "AdditionalPropertiesAnyType test"() { + // TODO: test AdditionalPropertiesAnyType + } + + /** + * Test the property 'name' + */ + void "AdditionalPropertiesAnyType property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesArraySpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesArraySpec.groovy new file mode 100644 index 00000000000..7724dbd9d71 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesArraySpec.groovy @@ -0,0 +1,33 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.HashMap +import java.util.List +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesArray + */ +@MicronautTest +public class AdditionalPropertiesArraySpec extends Specification { + private final AdditionalPropertiesArray model = new AdditionalPropertiesArray() + + /** + * Model tests for AdditionalPropertiesArray + */ + void "AdditionalPropertiesArray test"() { + // TODO: test AdditionalPropertiesArray + } + + /** + * Test the property 'name' + */ + void "AdditionalPropertiesArray property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesBooleanSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesBooleanSpec.groovy new file mode 100644 index 00000000000..a0a8981087d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesBooleanSpec.groovy @@ -0,0 +1,32 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.HashMap +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesBoolean + */ +@MicronautTest +public class AdditionalPropertiesBooleanSpec extends Specification { + private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean() + + /** + * Model tests for AdditionalPropertiesBoolean + */ + void "AdditionalPropertiesBoolean test"() { + // TODO: test AdditionalPropertiesBoolean + } + + /** + * Test the property 'name' + */ + void "AdditionalPropertiesBoolean property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesClassSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesClassSpec.groovy new file mode 100644 index 00000000000..f11a43776d4 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesClassSpec.groovy @@ -0,0 +1,104 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import java.util.HashMap +import java.util.List +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesClass + */ +@MicronautTest +public class AdditionalPropertiesClassSpec extends Specification { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass() + + /** + * Model tests for AdditionalPropertiesClass + */ + void "AdditionalPropertiesClass test"() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapString' + */ + void "AdditionalPropertiesClass property mapString test"() { + // TODO: test mapString + } + + /** + * Test the property 'mapNumber' + */ + void "AdditionalPropertiesClass property mapNumber test"() { + // TODO: test mapNumber + } + + /** + * Test the property 'mapInteger' + */ + void "AdditionalPropertiesClass property mapInteger test"() { + // TODO: test mapInteger + } + + /** + * Test the property 'mapBoolean' + */ + void "AdditionalPropertiesClass property mapBoolean test"() { + // TODO: test mapBoolean + } + + /** + * Test the property 'mapArrayInteger' + */ + void "AdditionalPropertiesClass property mapArrayInteger test"() { + // TODO: test mapArrayInteger + } + + /** + * Test the property 'mapArrayAnytype' + */ + void "AdditionalPropertiesClass property mapArrayAnytype test"() { + // TODO: test mapArrayAnytype + } + + /** + * Test the property 'mapMapString' + */ + void "AdditionalPropertiesClass property mapMapString test"() { + // TODO: test mapMapString + } + + /** + * Test the property 'mapMapAnytype' + */ + void "AdditionalPropertiesClass property mapMapAnytype test"() { + // TODO: test mapMapAnytype + } + + /** + * Test the property 'anytype1' + */ + void "AdditionalPropertiesClass property anytype1 test"() { + // TODO: test anytype1 + } + + /** + * Test the property 'anytype2' + */ + void "AdditionalPropertiesClass property anytype2 test"() { + // TODO: test anytype2 + } + + /** + * Test the property 'anytype3' + */ + void "AdditionalPropertiesClass property anytype3 test"() { + // TODO: test anytype3 + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesIntegerSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesIntegerSpec.groovy new file mode 100644 index 00000000000..160361ef1ec --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesIntegerSpec.groovy @@ -0,0 +1,32 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.HashMap +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesInteger + */ +@MicronautTest +public class AdditionalPropertiesIntegerSpec extends Specification { + private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger() + + /** + * Model tests for AdditionalPropertiesInteger + */ + void "AdditionalPropertiesInteger test"() { + // TODO: test AdditionalPropertiesInteger + } + + /** + * Test the property 'name' + */ + void "AdditionalPropertiesInteger property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesNumberSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesNumberSpec.groovy new file mode 100644 index 00000000000..ec09dae257c --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesNumberSpec.groovy @@ -0,0 +1,33 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import java.util.HashMap +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesNumber + */ +@MicronautTest +public class AdditionalPropertiesNumberSpec extends Specification { + private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber() + + /** + * Model tests for AdditionalPropertiesNumber + */ + void "AdditionalPropertiesNumber test"() { + // TODO: test AdditionalPropertiesNumber + } + + /** + * Test the property 'name' + */ + void "AdditionalPropertiesNumber property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesObjectSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesObjectSpec.groovy new file mode 100644 index 00000000000..013a6271f48 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesObjectSpec.groovy @@ -0,0 +1,32 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.HashMap +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesObject + */ +@MicronautTest +public class AdditionalPropertiesObjectSpec extends Specification { + private final AdditionalPropertiesObject model = new AdditionalPropertiesObject() + + /** + * Model tests for AdditionalPropertiesObject + */ + void "AdditionalPropertiesObject test"() { + // TODO: test AdditionalPropertiesObject + } + + /** + * Test the property 'name' + */ + void "AdditionalPropertiesObject property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesStringSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesStringSpec.groovy new file mode 100644 index 00000000000..c7eb9462b92 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AdditionalPropertiesStringSpec.groovy @@ -0,0 +1,32 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.HashMap +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for AdditionalPropertiesString + */ +@MicronautTest +public class AdditionalPropertiesStringSpec extends Specification { + private final AdditionalPropertiesString model = new AdditionalPropertiesString() + + /** + * Model tests for AdditionalPropertiesString + */ + void "AdditionalPropertiesString test"() { + // TODO: test AdditionalPropertiesString + } + + /** + * Test the property 'name' + */ + void "AdditionalPropertiesString property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AnimalSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AnimalSpec.groovy new file mode 100644 index 00000000000..11fcb24d201 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/AnimalSpec.groovy @@ -0,0 +1,39 @@ +package org.openapitools.model + +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Animal + */ +@MicronautTest +public class AnimalSpec extends Specification { + private final Animal model = new Animal() + + /** + * Model tests for Animal + */ + void "Animal test"() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + void "Animal property className test"() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + void "Animal property color test"() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayOfArrayOfNumberOnlySpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayOfArrayOfNumberOnlySpec.groovy new file mode 100644 index 00000000000..d364a888027 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayOfArrayOfNumberOnlySpec.groovy @@ -0,0 +1,33 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import java.util.ArrayList +import java.util.List +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +@MicronautTest +public class ArrayOfArrayOfNumberOnlySpec extends Specification { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly() + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + void "ArrayOfArrayOfNumberOnly test"() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + void "ArrayOfArrayOfNumberOnly property arrayArrayNumber test"() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayOfNumberOnlySpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayOfNumberOnlySpec.groovy new file mode 100644 index 00000000000..750d991c189 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayOfNumberOnlySpec.groovy @@ -0,0 +1,33 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import java.util.ArrayList +import java.util.List +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ArrayOfNumberOnly + */ +@MicronautTest +public class ArrayOfNumberOnlySpec extends Specification { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly() + + /** + * Model tests for ArrayOfNumberOnly + */ + void "ArrayOfNumberOnly test"() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + void "ArrayOfNumberOnly property arrayNumber test"() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayTestSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayTestSpec.groovy new file mode 100644 index 00000000000..14067f25c49 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ArrayTestSpec.groovy @@ -0,0 +1,47 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.ArrayList +import java.util.List +import org.openapitools.model.ReadOnlyFirst +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ArrayTest + */ +@MicronautTest +public class ArrayTestSpec extends Specification { + private final ArrayTest model = new ArrayTest() + + /** + * Model tests for ArrayTest + */ + void "ArrayTest test"() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + void "ArrayTest property arrayOfString test"() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + void "ArrayTest property arrayArrayOfInteger test"() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + void "ArrayTest property arrayArrayOfModel test"() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/BigCatAllOfSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/BigCatAllOfSpec.groovy new file mode 100644 index 00000000000..9e56d921ef1 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/BigCatAllOfSpec.groovy @@ -0,0 +1,30 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for BigCatAllOf + */ +@MicronautTest +public class BigCatAllOfSpec extends Specification { + private final BigCatAllOf model = new BigCatAllOf() + + /** + * Model tests for BigCatAllOf + */ + void "BigCatAllOf test"() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + void "BigCatAllOf property kind test"() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/BigCatSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/BigCatSpec.groovy new file mode 100644 index 00000000000..3edb46ca10e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/BigCatSpec.groovy @@ -0,0 +1,53 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import org.openapitools.model.BigCatAllOf +import org.openapitools.model.Cat +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for BigCat + */ +@MicronautTest +public class BigCatSpec extends Specification { + private final BigCat model = new BigCat() + + /** + * Model tests for BigCat + */ + void "BigCat test"() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + void "BigCat property className test"() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + void "BigCat property color test"() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + void "BigCat property declawed test"() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + void "BigCat property kind test"() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CapitalizationSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CapitalizationSpec.groovy new file mode 100644 index 00000000000..5ffc7f1d8bf --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CapitalizationSpec.groovy @@ -0,0 +1,65 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Capitalization + */ +@MicronautTest +public class CapitalizationSpec extends Specification { + private final Capitalization model = new Capitalization() + + /** + * Model tests for Capitalization + */ + void "Capitalization test"() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + void "Capitalization property smallCamel test"() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + void "Capitalization property capitalCamel test"() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + void "Capitalization property smallSnake test"() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + void "Capitalization property capitalSnake test"() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + void "Capitalization property scAETHFlowPoints test"() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + void "Capitalization property ATT_NAME test"() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CatAllOfSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CatAllOfSpec.groovy new file mode 100644 index 00000000000..c4762339d43 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CatAllOfSpec.groovy @@ -0,0 +1,30 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for CatAllOf + */ +@MicronautTest +public class CatAllOfSpec extends Specification { + private final CatAllOf model = new CatAllOf() + + /** + * Model tests for CatAllOf + */ + void "CatAllOf test"() { + // TODO: test CatAllOf + } + + /** + * Test the property 'declawed' + */ + void "CatAllOf property declawed test"() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CatSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CatSpec.groovy new file mode 100644 index 00000000000..eede5552627 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CatSpec.groovy @@ -0,0 +1,46 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import org.openapitools.model.Animal +import org.openapitools.model.CatAllOf +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Cat + */ +@MicronautTest +public class CatSpec extends Specification { + private final Cat model = new Cat() + + /** + * Model tests for Cat + */ + void "Cat test"() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + void "Cat property className test"() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + void "Cat property color test"() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + void "Cat property declawed test"() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CategorySpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CategorySpec.groovy new file mode 100644 index 00000000000..58e243ddfae --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/CategorySpec.groovy @@ -0,0 +1,37 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Category + */ +@MicronautTest +public class CategorySpec extends Specification { + private final Category model = new Category() + + /** + * Model tests for Category + */ + void "Category test"() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + void "Category property id test"() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + void "Category property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ClassModelSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ClassModelSpec.groovy new file mode 100644 index 00000000000..491cd582644 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ClassModelSpec.groovy @@ -0,0 +1,30 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ClassModel + */ +@MicronautTest +public class ClassModelSpec extends Specification { + private final ClassModel model = new ClassModel() + + /** + * Model tests for ClassModel + */ + void "ClassModel test"() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + void "ClassModel property propertyClass test"() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/DogAllOfSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/DogAllOfSpec.groovy new file mode 100644 index 00000000000..733d8487c5d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/DogAllOfSpec.groovy @@ -0,0 +1,30 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for DogAllOf + */ +@MicronautTest +public class DogAllOfSpec extends Specification { + private final DogAllOf model = new DogAllOf() + + /** + * Model tests for DogAllOf + */ + void "DogAllOf test"() { + // TODO: test DogAllOf + } + + /** + * Test the property 'breed' + */ + void "DogAllOf property breed test"() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/DogSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/DogSpec.groovy new file mode 100644 index 00000000000..b56f98b8fc5 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/DogSpec.groovy @@ -0,0 +1,46 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import org.openapitools.model.Animal +import org.openapitools.model.DogAllOf +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Dog + */ +@MicronautTest +public class DogSpec extends Specification { + private final Dog model = new Dog() + + /** + * Model tests for Dog + */ + void "Dog test"() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + void "Dog property className test"() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + void "Dog property color test"() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + void "Dog property breed test"() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumArraysSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumArraysSpec.groovy new file mode 100644 index 00000000000..fd3f8cd8c1e --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumArraysSpec.groovy @@ -0,0 +1,39 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.ArrayList +import java.util.List +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for EnumArrays + */ +@MicronautTest +public class EnumArraysSpec extends Specification { + private final EnumArrays model = new EnumArrays() + + /** + * Model tests for EnumArrays + */ + void "EnumArrays test"() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + void "EnumArrays property justSymbol test"() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + void "EnumArrays property arrayEnum test"() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumClassSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumClassSpec.groovy new file mode 100644 index 00000000000..fb0f558262d --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumClassSpec.groovy @@ -0,0 +1,19 @@ +package org.openapitools.model + +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for EnumClass + */ +@MicronautTest +public class EnumClassSpec extends Specification { + /** + * Model tests for EnumClass + */ + void "EnumClass test"() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumTestSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumTestSpec.groovy new file mode 100644 index 00000000000..5b1e4a3b87a --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/EnumTestSpec.groovy @@ -0,0 +1,59 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import org.openapitools.model.OuterEnum +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for EnumTest + */ +@MicronautTest +public class EnumTestSpec extends Specification { + private final EnumTest model = new EnumTest() + + /** + * Model tests for EnumTest + */ + void "EnumTest test"() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + void "EnumTest property enumString test"() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + void "EnumTest property enumStringRequired test"() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + void "EnumTest property enumInteger test"() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumNumber' + */ + void "EnumTest property enumNumber test"() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + void "EnumTest property outerEnum test"() { + // TODO: test outerEnum + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/FileSchemaTestClassSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/FileSchemaTestClassSpec.groovy new file mode 100644 index 00000000000..d4c964acb4b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/FileSchemaTestClassSpec.groovy @@ -0,0 +1,39 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.ArrayList +import java.util.List +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for FileSchemaTestClass + */ +@MicronautTest +public class FileSchemaTestClassSpec extends Specification { + private final FileSchemaTestClass model = new FileSchemaTestClass() + + /** + * Model tests for FileSchemaTestClass + */ + void "FileSchemaTestClass test"() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property 'file' + */ + void "FileSchemaTestClass property file test"() { + // TODO: test file + } + + /** + * Test the property 'files' + */ + void "FileSchemaTestClass property files test"() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/FormatTestSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/FormatTestSpec.groovy new file mode 100644 index 00000000000..042fe9c5f7a --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/FormatTestSpec.groovy @@ -0,0 +1,126 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.io.File +import java.math.BigDecimal +import java.time.LocalDate +import java.time.LocalDateTime +import java.util.UUID +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for FormatTest + */ +@MicronautTest +public class FormatTestSpec extends Specification { + private final FormatTest model = new FormatTest() + + /** + * Model tests for FormatTest + */ + void "FormatTest test"() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + void "FormatTest property integer test"() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + void "FormatTest property int32 test"() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + void "FormatTest property int64 test"() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + void "FormatTest property number test"() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + void "FormatTest property _float test"() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + void "FormatTest property _double test"() { + // TODO: test _double + } + + /** + * Test the property 'string' + */ + void "FormatTest property string test"() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + void "FormatTest property _byte test"() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + void "FormatTest property binary test"() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + void "FormatTest property date test"() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + void "FormatTest property dateTime test"() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + void "FormatTest property uuid test"() { + // TODO: test uuid + } + + /** + * Test the property 'password' + */ + void "FormatTest property password test"() { + // TODO: test password + } + + /** + * Test the property 'bigDecimal' + */ + void "FormatTest property bigDecimal test"() { + // TODO: test bigDecimal + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/HasOnlyReadOnlySpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/HasOnlyReadOnlySpec.groovy new file mode 100644 index 00000000000..dc494b74eab --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/HasOnlyReadOnlySpec.groovy @@ -0,0 +1,37 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for HasOnlyReadOnly + */ +@MicronautTest +public class HasOnlyReadOnlySpec extends Specification { + private final HasOnlyReadOnly model = new HasOnlyReadOnly() + + /** + * Model tests for HasOnlyReadOnly + */ + void "HasOnlyReadOnly test"() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + void "HasOnlyReadOnly property bar test"() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + void "HasOnlyReadOnly property foo test"() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/MapTestSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/MapTestSpec.groovy new file mode 100644 index 00000000000..80a970ab70b --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/MapTestSpec.groovy @@ -0,0 +1,54 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.HashMap +import java.util.List +import java.util.Map +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for MapTest + */ +@MicronautTest +public class MapTestSpec extends Specification { + private final MapTest model = new MapTest() + + /** + * Model tests for MapTest + */ + void "MapTest test"() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + void "MapTest property mapMapOfString test"() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + void "MapTest property mapOfEnumString test"() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + void "MapTest property directMap test"() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + void "MapTest property indirectMap test"() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClassSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClassSpec.groovy new file mode 100644 index 00000000000..6beabf63499 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClassSpec.groovy @@ -0,0 +1,50 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.time.LocalDateTime +import java.util.HashMap +import java.util.List +import java.util.Map +import java.util.UUID +import org.openapitools.model.Animal +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +@MicronautTest +public class MixedPropertiesAndAdditionalPropertiesClassSpec extends Specification { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass() + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + void "MixedPropertiesAndAdditionalPropertiesClass test"() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + void "MixedPropertiesAndAdditionalPropertiesClass property uuid test"() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + void "MixedPropertiesAndAdditionalPropertiesClass property dateTime test"() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + void "MixedPropertiesAndAdditionalPropertiesClass property map test"() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/Model200ResponseSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/Model200ResponseSpec.groovy new file mode 100644 index 00000000000..97093ff2eba --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/Model200ResponseSpec.groovy @@ -0,0 +1,37 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Model200Response + */ +@MicronautTest +public class Model200ResponseSpec extends Specification { + private final Model200Response model = new Model200Response() + + /** + * Model tests for Model200Response + */ + void "Model200Response test"() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + void "Model200Response property name test"() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + void "Model200Response property propertyClass test"() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelApiResponseSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelApiResponseSpec.groovy new file mode 100644 index 00000000000..344e6736457 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelApiResponseSpec.groovy @@ -0,0 +1,44 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ModelApiResponse + */ +@MicronautTest +public class ModelApiResponseSpec extends Specification { + private final ModelApiResponse model = new ModelApiResponse() + + /** + * Model tests for ModelApiResponse + */ + void "ModelApiResponse test"() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + void "ModelApiResponse property code test"() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + void "ModelApiResponse property type test"() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + void "ModelApiResponse property message test"() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelClientSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelClientSpec.groovy new file mode 100644 index 00000000000..15de84e16e1 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelClientSpec.groovy @@ -0,0 +1,30 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ModelClient + */ +@MicronautTest +public class ModelClientSpec extends Specification { + private final ModelClient model = new ModelClient() + + /** + * Model tests for ModelClient + */ + void "ModelClient test"() { + // TODO: test ModelClient + } + + /** + * Test the property '_client' + */ + void "ModelClient property _client test"() { + // TODO: test _client + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelReturnSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelReturnSpec.groovy new file mode 100644 index 00000000000..ec9ff8427f8 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ModelReturnSpec.groovy @@ -0,0 +1,30 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ModelReturn + */ +@MicronautTest +public class ModelReturnSpec extends Specification { + private final ModelReturn model = new ModelReturn() + + /** + * Model tests for ModelReturn + */ + void "ModelReturn test"() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + void "ModelReturn property _return test"() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/NameSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/NameSpec.groovy new file mode 100644 index 00000000000..af3bcb6f545 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/NameSpec.groovy @@ -0,0 +1,51 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Name + */ +@MicronautTest +public class NameSpec extends Specification { + private final Name model = new Name() + + /** + * Model tests for Name + */ + void "Name test"() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + void "Name property name test"() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + void "Name property snakeCase test"() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + void "Name property property test"() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + void "Name property _123number test"() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/NumberOnlySpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/NumberOnlySpec.groovy new file mode 100644 index 00000000000..19abee7e60f --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/NumberOnlySpec.groovy @@ -0,0 +1,31 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for NumberOnly + */ +@MicronautTest +public class NumberOnlySpec extends Specification { + private final NumberOnly model = new NumberOnly() + + /** + * Model tests for NumberOnly + */ + void "NumberOnly test"() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + void "NumberOnly property justNumber test"() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OrderSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OrderSpec.groovy new file mode 100644 index 00000000000..c4421f8c243 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OrderSpec.groovy @@ -0,0 +1,66 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.time.LocalDateTime +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Order + */ +@MicronautTest +public class OrderSpec extends Specification { + private final Order model = new Order() + + /** + * Model tests for Order + */ + void "Order test"() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + void "Order property id test"() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + void "Order property petId test"() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + void "Order property quantity test"() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + void "Order property shipDate test"() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + void "Order property status test"() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + void "Order property complete test"() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OuterCompositeSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OuterCompositeSpec.groovy new file mode 100644 index 00000000000..db5caf95e62 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OuterCompositeSpec.groovy @@ -0,0 +1,45 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for OuterComposite + */ +@MicronautTest +public class OuterCompositeSpec extends Specification { + private final OuterComposite model = new OuterComposite() + + /** + * Model tests for OuterComposite + */ + void "OuterComposite test"() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + void "OuterComposite property myNumber test"() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + void "OuterComposite property myString test"() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + void "OuterComposite property myBoolean test"() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OuterEnumSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OuterEnumSpec.groovy new file mode 100644 index 00000000000..abfdae04e77 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OuterEnumSpec.groovy @@ -0,0 +1,19 @@ +package org.openapitools.model + +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for OuterEnum + */ +@MicronautTest +public class OuterEnumSpec extends Specification { + /** + * Model tests for OuterEnum + */ + void "OuterEnum test"() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/PetSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/PetSpec.groovy new file mode 100644 index 00000000000..dd72edcc319 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/PetSpec.groovy @@ -0,0 +1,71 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.util.ArrayList +import java.util.LinkedHashSet +import java.util.List +import java.util.Set +import org.openapitools.model.Category +import org.openapitools.model.Tag +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Pet + */ +@MicronautTest +public class PetSpec extends Specification { + private final Pet model = new Pet() + + /** + * Model tests for Pet + */ + void "Pet test"() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + void "Pet property id test"() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + void "Pet property category test"() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + void "Pet property name test"() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + void "Pet property photoUrls test"() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + void "Pet property tags test"() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + void "Pet property status test"() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ReadOnlyFirstSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ReadOnlyFirstSpec.groovy new file mode 100644 index 00000000000..b16cba13912 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/ReadOnlyFirstSpec.groovy @@ -0,0 +1,37 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for ReadOnlyFirst + */ +@MicronautTest +public class ReadOnlyFirstSpec extends Specification { + private final ReadOnlyFirst model = new ReadOnlyFirst() + + /** + * Model tests for ReadOnlyFirst + */ + void "ReadOnlyFirst test"() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + void "ReadOnlyFirst property bar test"() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + void "ReadOnlyFirst property baz test"() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/SpecialModelNameSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/SpecialModelNameSpec.groovy new file mode 100644 index 00000000000..8466e6415e2 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/SpecialModelNameSpec.groovy @@ -0,0 +1,30 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for SpecialModelName + */ +@MicronautTest +public class SpecialModelNameSpec extends Specification { + private final SpecialModelName model = new SpecialModelName() + + /** + * Model tests for SpecialModelName + */ + void "SpecialModelName test"() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + void 'SpecialModelName property $specialPropertyName test'() { + // TODO: test $specialPropertyName + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TagSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TagSpec.groovy new file mode 100644 index 00000000000..15f2f00fcbf --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TagSpec.groovy @@ -0,0 +1,37 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for Tag + */ +@MicronautTest +public class TagSpec extends Specification { + private final Tag model = new Tag() + + /** + * Model tests for Tag + */ + void "Tag test"() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + void "Tag property id test"() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + void "Tag property name test"() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TypeHolderDefaultSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TypeHolderDefaultSpec.groovy new file mode 100644 index 00000000000..20ef71c2c61 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TypeHolderDefaultSpec.groovy @@ -0,0 +1,61 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import java.util.ArrayList +import java.util.List +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for TypeHolderDefault + */ +@MicronautTest +public class TypeHolderDefaultSpec extends Specification { + private final TypeHolderDefault model = new TypeHolderDefault() + + /** + * Model tests for TypeHolderDefault + */ + void "TypeHolderDefault test"() { + // TODO: test TypeHolderDefault + } + + /** + * Test the property 'stringItem' + */ + void "TypeHolderDefault property stringItem test"() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + void "TypeHolderDefault property numberItem test"() { + // TODO: test numberItem + } + + /** + * Test the property 'integerItem' + */ + void "TypeHolderDefault property integerItem test"() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + void "TypeHolderDefault property boolItem test"() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + void "TypeHolderDefault property arrayItem test"() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TypeHolderExampleSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TypeHolderExampleSpec.groovy new file mode 100644 index 00000000000..29577de7621 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/TypeHolderExampleSpec.groovy @@ -0,0 +1,68 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import java.util.ArrayList +import java.util.List +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for TypeHolderExample + */ +@MicronautTest +public class TypeHolderExampleSpec extends Specification { + private final TypeHolderExample model = new TypeHolderExample() + + /** + * Model tests for TypeHolderExample + */ + void "TypeHolderExample test"() { + // TODO: test TypeHolderExample + } + + /** + * Test the property 'stringItem' + */ + void "TypeHolderExample property stringItem test"() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + void "TypeHolderExample property numberItem test"() { + // TODO: test numberItem + } + + /** + * Test the property 'floatItem' + */ + void "TypeHolderExample property floatItem test"() { + // TODO: test floatItem + } + + /** + * Test the property 'integerItem' + */ + void "TypeHolderExample property integerItem test"() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + void "TypeHolderExample property boolItem test"() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + void "TypeHolderExample property arrayItem test"() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/UserSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/UserSpec.groovy new file mode 100644 index 00000000000..af7ec2738c3 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/UserSpec.groovy @@ -0,0 +1,79 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for User + */ +@MicronautTest +public class UserSpec extends Specification { + private final User model = new User() + + /** + * Model tests for User + */ + void "User test"() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + void "User property id test"() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + void "User property username test"() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + void "User property firstName test"() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + void "User property lastName test"() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + void "User property email test"() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + void "User property password test"() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + void "User property phone test"() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + void "User property userStatus test"() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/XmlItemSpec.groovy b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/XmlItemSpec.groovy new file mode 100644 index 00000000000..02d57582c68 --- /dev/null +++ b/samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/XmlItemSpec.groovy @@ -0,0 +1,229 @@ +package org.openapitools.model + +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty +import java.math.BigDecimal +import java.util.ArrayList +import java.util.List +import io.micronaut.test.extensions.spock.annotation.MicronautTest +import spock.lang.Specification +import jakarta.inject.Inject + +/** + * Model tests for XmlItem + */ +@MicronautTest +public class XmlItemSpec extends Specification { + private final XmlItem model = new XmlItem() + + /** + * Model tests for XmlItem + */ + void "XmlItem test"() { + // TODO: test XmlItem + } + + /** + * Test the property 'attributeString' + */ + void "XmlItem property attributeString test"() { + // TODO: test attributeString + } + + /** + * Test the property 'attributeNumber' + */ + void "XmlItem property attributeNumber test"() { + // TODO: test attributeNumber + } + + /** + * Test the property 'attributeInteger' + */ + void "XmlItem property attributeInteger test"() { + // TODO: test attributeInteger + } + + /** + * Test the property 'attributeBoolean' + */ + void "XmlItem property attributeBoolean test"() { + // TODO: test attributeBoolean + } + + /** + * Test the property 'wrappedArray' + */ + void "XmlItem property wrappedArray test"() { + // TODO: test wrappedArray + } + + /** + * Test the property 'nameString' + */ + void "XmlItem property nameString test"() { + // TODO: test nameString + } + + /** + * Test the property 'nameNumber' + */ + void "XmlItem property nameNumber test"() { + // TODO: test nameNumber + } + + /** + * Test the property 'nameInteger' + */ + void "XmlItem property nameInteger test"() { + // TODO: test nameInteger + } + + /** + * Test the property 'nameBoolean' + */ + void "XmlItem property nameBoolean test"() { + // TODO: test nameBoolean + } + + /** + * Test the property 'nameArray' + */ + void "XmlItem property nameArray test"() { + // TODO: test nameArray + } + + /** + * Test the property 'nameWrappedArray' + */ + void "XmlItem property nameWrappedArray test"() { + // TODO: test nameWrappedArray + } + + /** + * Test the property 'prefixString' + */ + void "XmlItem property prefixString test"() { + // TODO: test prefixString + } + + /** + * Test the property 'prefixNumber' + */ + void "XmlItem property prefixNumber test"() { + // TODO: test prefixNumber + } + + /** + * Test the property 'prefixInteger' + */ + void "XmlItem property prefixInteger test"() { + // TODO: test prefixInteger + } + + /** + * Test the property 'prefixBoolean' + */ + void "XmlItem property prefixBoolean test"() { + // TODO: test prefixBoolean + } + + /** + * Test the property 'prefixArray' + */ + void "XmlItem property prefixArray test"() { + // TODO: test prefixArray + } + + /** + * Test the property 'prefixWrappedArray' + */ + void "XmlItem property prefixWrappedArray test"() { + // TODO: test prefixWrappedArray + } + + /** + * Test the property 'namespaceString' + */ + void "XmlItem property namespaceString test"() { + // TODO: test namespaceString + } + + /** + * Test the property 'namespaceNumber' + */ + void "XmlItem property namespaceNumber test"() { + // TODO: test namespaceNumber + } + + /** + * Test the property 'namespaceInteger' + */ + void "XmlItem property namespaceInteger test"() { + // TODO: test namespaceInteger + } + + /** + * Test the property 'namespaceBoolean' + */ + void "XmlItem property namespaceBoolean test"() { + // TODO: test namespaceBoolean + } + + /** + * Test the property 'namespaceArray' + */ + void "XmlItem property namespaceArray test"() { + // TODO: test namespaceArray + } + + /** + * Test the property 'namespaceWrappedArray' + */ + void "XmlItem property namespaceWrappedArray test"() { + // TODO: test namespaceWrappedArray + } + + /** + * Test the property 'prefixNsString' + */ + void "XmlItem property prefixNsString test"() { + // TODO: test prefixNsString + } + + /** + * Test the property 'prefixNsNumber' + */ + void "XmlItem property prefixNsNumber test"() { + // TODO: test prefixNsNumber + } + + /** + * Test the property 'prefixNsInteger' + */ + void "XmlItem property prefixNsInteger test"() { + // TODO: test prefixNsInteger + } + + /** + * Test the property 'prefixNsBoolean' + */ + void "XmlItem property prefixNsBoolean test"() { + // TODO: test prefixNsBoolean + } + + /** + * Test the property 'prefixNsArray' + */ + void "XmlItem property prefixNsArray test"() { + // TODO: test prefixNsArray + } + + /** + * Test the property 'prefixNsWrappedArray' + */ + void "XmlItem property prefixNsWrappedArray test"() { + // TODO: test prefixNsWrappedArray + } + +}