diff --git a/.github/workflows/samples-java-client-jdk11.yaml b/.github/workflows/samples-java-client-jdk11.yaml index 81005ce61b65..baedba93944f 100644 --- a/.github/workflows/samples-java-client-jdk11.yaml +++ b/.github/workflows/samples-java-client-jdk11.yaml @@ -61,6 +61,8 @@ jobs: - samples/client/petstore/java/webclient-swagger2 - samples/client/petstore/java/webclient-useSingleRequestParameter - samples/client/petstore/java/vertx + - samples/client/petstore/java/vertx-no-nullable + - samples/client/petstore/java/vertx-supportVertxFuture - samples/client/petstore/java/jersey2-java8-localdatetime - samples/client/petstore/java/google-api-client - samples/client/petstore/java/rest-assured diff --git a/bin/configs/java-vertx-supportVertxFuture.yaml b/bin/configs/java-vertx-supportVertxFuture.yaml new file mode 100644 index 000000000000..475a67daef61 --- /dev/null +++ b/bin/configs/java-vertx-supportVertxFuture.yaml @@ -0,0 +1,10 @@ +generatorName: java +outputDir: samples/client/petstore/java/vertx-supportVertxFuture +library: vertx +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-vertx-supportvertxfuture + hideGenerationTimestamp: "true" + dateLibrary: java8 + supportVertxFuture: "true" diff --git a/bin/configs/protobuf-schema-config.yaml b/bin/configs/protobuf-schema-config.yaml index e1fcd9f97e85..f53cff357308 100644 --- a/bin/configs/protobuf-schema-config.yaml +++ b/bin/configs/protobuf-schema-config.yaml @@ -10,6 +10,14 @@ additionalProperties: wrapComplexType: false supportMultipleResponses: false aggregateModelsName: data + customOptionsApi: | + option java_multiple_files = true; + option java_package = "com.example.tutorial.protos.api"; + option java_outer_classname = "ExampleProtos"; + customOptionsModel: | + option java_multiple_files = false; + option java_package = "com.example.tutorial.protos.model"; + option java_outer_classname = "ExampleProtos"; useSimplifiedEnumNames: true typeMappings: object: "google.protobuf.Struct" diff --git a/bin/utils/test_file_list.yaml b/bin/utils/test_file_list.yaml index e1008b5823fd..1d0fb391de09 100644 --- a/bin/utils/test_file_list.yaml +++ b/bin/utils/test_file_list.yaml @@ -10,7 +10,7 @@ - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/ClientTest.java" sha256: 325fdd5d7e2c97790c0fb44f712ab7b2ba022d7e1a5b0056f47b07f342682b6d - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java" - sha256: e673d9928c8eb848262d0116fe0d28db832e128671a810a7c966d06d90cb9b63 + sha256: 67941355a0a27ed9ff9318b1caa103e78b81b9aff61b594b18be5cd2bb9f6591 - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/PetApiTest.java" sha256: 8b1b8f2a2ad00ccb090873a94a5f73e328b98317d2ec715f53bd7a1accb2a023 - filename: "samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/PetTest.java" @@ -55,6 +55,8 @@ sha256: 45cdaba3d2adc212cd4f0184ad475419a95e2326254c2ef84175e210c922b2f3 - filename: "samples/client/petstore/java/feign/src/test/java/org/openapitools/client/JacksonTest.java" sha256: 45cdaba3d2adc212cd4f0184ad475419a95e2326254c2ef84175e210c922b2f3 +- filename: "samples/client/petstore/java/restclient/src/test/java/org/openapitools/client/JacksonTest.java" + sha256: 45cdaba3d2adc212cd4f0184ad475419a95e2326254c2ef84175e210c922b2f3 # rust axum test files - filename: "samples/server/petstore/rust-axum/output/rust-axum-oneof/tests/oneof_with_discriminator.rs" sha256: 2d4f5a069fdcb3057bb078d5e75b3de63cd477b97725e457079df24bd2c30600 diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index 21fc99f69821..6916e9defea9 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -127,7 +127,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null |x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null |x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null -|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false +|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false |x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null |x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index 682705bb613e..e0aa8b6be938 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -87,6 +87,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |sourceFolder|source folder for generated code| |src/main/java| |supportStreaming|Support streaming endpoint (beta)| |false| |supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.| |false| +|supportVertxFuture|Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.| |false| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries| |false| |useBeanValidation|Use BeanValidation API annotations| |false| diff --git a/docs/generators/java.md b/docs/generators/java.md index 097a06411c59..4d6e9a6847ab 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -87,6 +87,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |sourceFolder|source folder for generated code| |src/main/java| |supportStreaming|Support streaming endpoint (beta)| |false| |supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.| |false| +|supportVertxFuture|Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.| |false| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries| |false| |useBeanValidation|Use BeanValidation API annotations| |false| diff --git a/docs/generators/protobuf-schema.md b/docs/generators/protobuf-schema.md index 6cf2250ab4b0..fc8616619336 100644 --- a/docs/generators/protobuf-schema.md +++ b/docs/generators/protobuf-schema.md @@ -20,6 +20,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |addJsonNameAnnotation|Append "json_name" annotation to message field when the specification name differs from the protobuf field name| |false| |aggregateModelsName|Aggregated model filename. If set, all generated models will be combined into this single file.| |null| +|customOptionsApi|Custom options for the api files.| |null| +|customOptionsModel|Custom options for the model files.| |null| |numberedFieldNumberList|Field numbers in order.| |false| |startEnumsWithUnspecified|Introduces "UNSPECIFIED" as the first element of enumerations.| |false| |supportMultipleResponses|Support multiple responses| |true| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index fe41ea1f32a6..36ac0bc26895 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -120,7 +120,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null |x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null |x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null -|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false +|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false |x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null |x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java index 2f175b564d72..64ffe79c9b5f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java @@ -10,7 +10,7 @@ import java.util.List; public enum VendorExtension { X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"), - X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters", "false"), + X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.", "false"), X_SPRING_PROVIDE_ARGS("x-spring-provide-args", ExtensionLevel.OPERATION, "Allows adding additional hidden parameters in the API specification to allow access to content such as header values or properties", "empty array"), X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""), X_SETTER_EXTRA_ANNOTATION("x-setter-extra-annotation", ExtensionLevel.FIELD, "Custom annotation that can be specified over java setter for specific field", "When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value"), diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java index 83f5ac1fb767..0c5a3838a824 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java @@ -958,8 +958,10 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co for (Map enumVars : (List>) model.getAllowableValues().get("enumVars")) { if ((Boolean) enumVars.get("isString")) { model.vendorExtensions.putIfAbsent("x-py-enum-type", "str"); - // update `name`, e.g. - enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "str")); + // Do not overwrite the variable name if already set through x-enum-varnames + if (model.vendorExtensions.get("x-enum-varnames") == null) { + enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "str")); + } } else { model.vendorExtensions.putIfAbsent("x-py-enum-type", "int"); // Do not overwrite the variable name if already set through x-enum-varnames diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java index 99be37036d74..7928a50f3ea6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java @@ -570,7 +570,11 @@ public class ElixirClientCodegen extends DefaultCodegen { */ @Override public String getTypeDeclaration(Schema p) { - if (ModelUtils.isArraySchema(p)) { + if (ModelUtils.isAnyType(p)) { + return "any()"; + } else if(ModelUtils.isFreeFormObject(p, null)) { + return "%{optional(String.t) => any()}"; + } else if (ModelUtils.isArraySchema(p)) { Schema inner = ModelUtils.getSchemaItems(p); return "[" + getTypeDeclaration(inner) + "]"; } else if (ModelUtils.isMapSchema(p)) { @@ -856,6 +860,10 @@ public class ElixirClientCodegen extends DefaultCodegen { private void buildTypespec(CodegenParameter param, StringBuilder sb) { if (param.dataType == null) { sb.append("nil"); + } else if (param.isAnyType) { + sb.append("any()"); + } else if(param.isFreeFormObject) { + sb.append("%{optional(String.t) => any()}"); } else if (param.isArray) { // list() sb.append("list("); @@ -875,6 +883,10 @@ public class ElixirClientCodegen extends DefaultCodegen { if (property == null) { LOGGER.error( "CodegenProperty cannot be null. Please report the issue to https://github.com/openapitools/openapi-generator with the spec"); + } else if (property.isAnyType) { + sb.append("any()"); + } else if(property.isFreeFormObject) { + sb.append("%{optional(String.t) => any()}"); } else if (property.isArray) { sb.append("list("); buildTypespec(property.items, sb); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 2a523a606b4e..9763f7064684 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -101,6 +101,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String WEBCLIENT_BLOCKING_OPERATIONS = "webclientBlockingOperations"; public static final String USE_ENUM_CASE_INSENSITIVE = "useEnumCaseInsensitive"; public static final String FAIL_ON_UNKNOWN_PROPERTIES = "failOnUnknownProperties"; + public static final String SUPPORT_VERTX_FUTURE = "supportVertxFuture"; public static final String SERIALIZATION_LIBRARY_GSON = "gson"; public static final String SERIALIZATION_LIBRARY_JACKSON = "jackson"; @@ -243,6 +244,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(SUPPORT_URL_QUERY, "Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.")); cliOptions.add(CliOption.newBoolean(USE_ENUM_CASE_INSENSITIVE, "Use `equalsIgnoreCase` when String for enum comparison", useEnumCaseInsensitive)); cliOptions.add(CliOption.newBoolean(FAIL_ON_UNKNOWN_PROPERTIES, "Fail Jackson de-serialization on unknown properties", this.failOnUnknownProperties)); + cliOptions.add(CliOption.newBoolean(SUPPORT_VERTX_FUTURE, "Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.")); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.17.1"); supportedLibraries.put(JERSEY3, "HTTP client: Jersey client 3.1.1. JSON processing: Jackson 2.17.1"); @@ -632,6 +634,13 @@ public class JavaClientCodegen extends AbstractJavaCodegen } else if (libRestClient) { forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); applyJakartaPackage(); + + // Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema. + // In principle, this should be enabled by default for all code generators. However due to limitations + // in other code generators, support needs to be enabled on a case-by-case basis. + // The flag below should be set for all Java libraries, but the templates need to be ported + // one by one for each library. + supportsAdditionalPropertiesWithComposedSchema = true; } else if (libVertx) { typeMapping.put("file", "AsyncFile"); importMapping.put("AsyncFile", "io.vertx.core.file.AsyncFile"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java index 686c389846e6..baeae7e39486 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpClientCodegen.java @@ -117,6 +117,7 @@ public class PhpClientCodegen extends AbstractPhpCodegen { supportingFiles.add(new SupportingFile("ApiException.mustache", toSrcPath(invokerPackage, srcBasePath), "ApiException.php")); supportingFiles.add(new SupportingFile("Configuration.mustache", toSrcPath(invokerPackage, srcBasePath), "Configuration.php")); + supportingFiles.add(new SupportingFile("FormDataProcessor.mustache", toSrcPath(invokerPackage, srcBasePath), "FormDataProcessor.php")); supportingFiles.add(new SupportingFile("ObjectSerializer.mustache", toSrcPath(invokerPackage, srcBasePath), "ObjectSerializer.php")); supportingFiles.add(new SupportingFile("ModelInterface.mustache", toSrcPath(modelPackage, srcBasePath), "ModelInterface.php")); supportingFiles.add(new SupportingFile("HeaderSelector.mustache", toSrcPath(invokerPackage, srcBasePath), "HeaderSelector.php")); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java index 64e8c94b28c2..5f84bab486d8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java @@ -121,6 +121,7 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen { supportingFiles.add(new SupportingFile("ApiException.mustache", toSrcPath(invokerPackage, srcBasePath), "ApiException.php")); supportingFiles.add(new SupportingFile("Configuration.mustache", toSrcPath(invokerPackage, srcBasePath), "Configuration.php")); + supportingFiles.add(new SupportingFile("FormDataProcessor.mustache", toSrcPath(invokerPackage, srcBasePath), "FormDataProcessor.php")); supportingFiles.add(new SupportingFile("ObjectSerializer.mustache", toSrcPath(invokerPackage, srcBasePath), "ObjectSerializer.php")); supportingFiles.add(new SupportingFile("ModelInterface.mustache", toSrcPath(modelPackage, srcBasePath), "ModelInterface.php")); supportingFiles.add(new SupportingFile("HeaderSelector.mustache", toSrcPath(invokerPackage, srcBasePath), "HeaderSelector.php")); @@ -203,9 +204,11 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen { } if (phpReturnTypeOptions.isEmpty()) { + operation.vendorExtensions.putIfAbsent("x-php-return-type-is-void", true); operation.vendorExtensions.putIfAbsent("x-php-return-type", "void"); operation.vendorExtensions.putIfAbsent("x-php-doc-return-type", "void"); } else { + operation.vendorExtensions.putIfAbsent("x-php-return-type-is-void", false); operation.vendorExtensions.putIfAbsent("x-php-return-type", String.join("|", phpReturnTypeOptions)); operation.vendorExtensions.putIfAbsent("x-php-doc-return-type", String.join("|", docReturnTypeOptions)); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java index 225d9fab5518..6dee36ccfe94 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java @@ -70,6 +70,10 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf public static final String AGGREGATE_MODELS_NAME = "aggregateModelsName"; + public static final String CUSTOM_OPTIONS_API = "customOptionsApi"; + + public static final String CUSTOM_OPTIONS_MODEL = "customOptionsModel"; + public static final String SUPPORT_MULTIPLE_RESPONSES = "supportMultipleResponses"; private final Logger LOGGER = LoggerFactory.getLogger(ProtobufSchemaCodegen.class); @@ -78,6 +82,12 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf @Setter protected String aggregateModelsName = null; + @SuppressWarnings("unused") + @Setter protected String customOptionsApi = null; + + @SuppressWarnings("unused") + @Setter protected String customOptionsModel = null; + private boolean numberedFieldNumberList = false; private boolean startEnumsWithUnspecified = false; @@ -203,6 +213,8 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf addSwitch(USE_SIMPLIFIED_ENUM_NAMES, "Use a simple name for enums", useSimplifiedEnumNames); addSwitch(SUPPORT_MULTIPLE_RESPONSES, "Support multiple responses", supportMultipleResponses); addOption(AGGREGATE_MODELS_NAME, "Aggregated model filename. If set, all generated models will be combined into this single file.", null); + addOption(CUSTOM_OPTIONS_API, "Custom options for the api files.", null); + addOption(CUSTOM_OPTIONS_MODEL, "Custom options for the model files.", null); } @Override @@ -253,6 +265,14 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf this.setAggregateModelsName((String) additionalProperties.get(AGGREGATE_MODELS_NAME)); } + if (additionalProperties.containsKey(CUSTOM_OPTIONS_API)) { + this.setCustomOptionsApi((String) additionalProperties.get(CUSTOM_OPTIONS_API)); + } + + if (additionalProperties.containsKey(CUSTOM_OPTIONS_MODEL)) { + this.setCustomOptionsModel((String) additionalProperties.get(CUSTOM_OPTIONS_MODEL)); + } + if (additionalProperties.containsKey(this.SUPPORT_MULTIPLE_RESPONSES)) { this.supportMultipleResponses = convertPropertyToBooleanAndWriteBack(SUPPORT_MULTIPLE_RESPONSES); } else { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java index fe6764014a28..5b14b738f077 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java @@ -71,6 +71,7 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen { private static final int DEFAULT_SERVER_PORT = 8080; private static final String DEFAULT_PACKAGE_NAME = "openapi_server"; private static final String DEFAULT_SOURCE_FOLDER = "src"; + private static final String DEFAULT_IMPL_FOLDER = "impl"; private static final String DEFAULT_PACKAGE_VERSION = "1.0.0"; private String implPackage; @@ -109,7 +110,7 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen { additionalProperties.put("baseSuffix", BASE_CLASS_SUFFIX); additionalProperties.put(CodegenConstants.SOURCE_FOLDER, DEFAULT_SOURCE_FOLDER); additionalProperties.put(CodegenConstants.PACKAGE_NAME, DEFAULT_PACKAGE_NAME); - additionalProperties.put(CodegenConstants.FASTAPI_IMPLEMENTATION_PACKAGE, DEFAULT_PACKAGE_NAME.concat(".impl")); + additionalProperties.put(CodegenConstants.FASTAPI_IMPLEMENTATION_PACKAGE, DEFAULT_IMPL_FOLDER); languageSpecificPrimitives.add("List"); languageSpecificPrimitives.add("Dict"); @@ -124,7 +125,7 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen { apiPackage = "apis"; modelPackage = "models"; testPackage = "tests"; - implPackage = "impl"; + implPackage = DEFAULT_IMPL_FOLDER; apiTestTemplateFiles().put("api_test.mustache", ".py"); cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "python package name (convention: snake_case).") @@ -153,10 +154,14 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen { if (additionalProperties.containsKey(CodegenConstants.FASTAPI_IMPLEMENTATION_PACKAGE)) { this.implPackage = ((String) additionalProperties.get(CodegenConstants.FASTAPI_IMPLEMENTATION_PACKAGE)); + // Prefix templating value with the package name + additionalProperties.put(CodegenConstants.FASTAPI_IMPLEMENTATION_PACKAGE, + this.packageName + "." + this.implPackage); } modelPackage = packageName + "." + modelPackage; apiPackage = packageName + "." + apiPackage; + implPackage = packageName + "." + implPackage; supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("openapi.mustache", "", "openapi.yaml")); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index c93bec52c2e7..33ae00f447ba 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -605,9 +605,18 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon additionalProperties.put("serdeWith", true); } + // Add a field for checking if a field is with optional or required in templates. + // This is useful in Mustache templates as it's not possible to do OR logic between variables. + property.vendorExtensions.put("isMandatory", !property.isNullable && property.required); + // If a property is a base64-encoded byte array, use `serde_with` for deserialization. if (property.isByteArray) { additionalProperties.put("serdeWith", true); + // If a byte array is both nullable and not required we need to include our own + // custom double option as serde_as does not work with serde_with's double_option. + if (property.isNullable && !property.required) { + additionalProperties.put("serdeAsDoubleOption", true); + } } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 5237520ce9d9..4d1f9438f057 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -996,6 +996,8 @@ public class SpringCodegen extends AbstractJavaCodegen * Add dynamic imports based on the parameters and vendor extensions of an operation. * The imports are expanded by the mustache {{import}} tag available to model and api * templates. + * + * #8315 Also handles removing 'size', 'page' and 'sort' query parameters if using 'x-spring-paginated'. */ @Override public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { @@ -1023,6 +1025,15 @@ public class SpringCodegen extends AbstractJavaCodegen if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) { codegenOperation.imports.add("ParameterObject"); } + + // #8315 Spring Data Web default query params recognized by Pageable + List defaultPageableQueryParams = new ArrayList<>( + Arrays.asList("page", "size", "sort") + ); + + // #8315 Remove matching Spring Data Web default query params if 'x-spring-paginated' with Pageable is used + codegenOperation.queryParams.removeIf(param -> defaultPageableQueryParams.contains(param.baseName)); + codegenOperation.allParams.removeIf(param -> param.isQueryParam && defaultPageableQueryParams.contains(param.baseName)); } if (codegenOperation.vendorExtensions.containsKey("x-spring-provide-args") && !provideArgsClassSet.isEmpty()) { codegenOperation.imports.addAll(provideArgsClassSet); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache index e010befdc0fb..a10c3f3a115b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -9,12 +9,6 @@ import java.util.logging.Level; import java.util.logging.Logger; {{#jackson}} -{{#feign-okhttp}} -import feign.okhttp.OkHttpClient; -{{/feign-okhttp}} -{{#feign-hc5}} -import feign.hc5.ApacheHttp5Client; -{{/feign-hc5}} import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -76,12 +70,6 @@ public class ApiClient { {{#jackson}} objectMapper = createObjectMapper(); feignBuilder = Feign.builder() - {{#feign-okhttp}} - .client(new OkHttpClient()) - {{/feign-okhttp}} - {{#feign-hc5}} - .client(new ApacheHttp5Client()) - {{/feign-hc5}} .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new ApiResponseDecoder(objectMapper)) {{#hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache index 218f5452ce26..ee7fcb2513c7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache @@ -694,6 +694,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1232,6 +1233,27 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + {{#hasHttpSignatureMethods}} + serializeToString(body, formParams, contentType, isBodyNullable), + {{/hasHttpSignatureMethods}} + {{^hasHttpSignatureMethods}} + null, + {{/hasHttpSignatureMethods}} + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1262,27 +1284,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - {{#hasHttpSignatureMethods}} - serializeToString(body, formParams, contentType, isBodyNullable), - {{/hasHttpSignatureMethods}} - {{^hasHttpSignatureMethods}} - null, - {{/hasHttpSignatureMethods}} - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1383,8 +1384,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1405,6 +1408,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1414,8 +1422,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1507,4 +1513,4 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache index 046a9f9bc8f6..6ba811059bb8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/ApiClient.mustache @@ -694,6 +694,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1232,6 +1233,27 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + {{#hasHttpSignatureMethods}} + serializeToString(body, formParams, contentType, isBodyNullable), + {{/hasHttpSignatureMethods}} + {{^hasHttpSignatureMethods}} + null, + {{/hasHttpSignatureMethods}} + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1262,27 +1284,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - {{#hasHttpSignatureMethods}} - serializeToString(body, formParams, contentType, isBodyNullable), - {{/hasHttpSignatureMethods}} - {{^hasHttpSignatureMethods}} - null, - {{/hasHttpSignatureMethods}} - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1383,8 +1384,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1405,6 +1408,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1414,8 +1422,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1507,4 +1513,4 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle.properties.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/gradle.properties.mustache deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 519b37ed2eca..cb02b627ba1d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -1166,17 +1166,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1185,17 +1176,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache index eee7773c4cc0..eeb26cb9ca57 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache @@ -23,8 +23,11 @@ import org.joda.time.format.ISODateTimeFormat; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -198,6 +201,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/additional_properties.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/additional_properties.mustache new file mode 100644 index 000000000000..8e7182792457 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/additional_properties.mustache @@ -0,0 +1,45 @@ +{{#additionalPropertiesType}} + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public {{classname}} putAdditionalProperty(String key, {{{.}}} value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public {{{.}}} getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } +{{/additionalPropertiesType}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/model.mustache new file mode 100644 index 000000000000..108748f607e3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/model.mustache @@ -0,0 +1,78 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#useReflectionEqualsHashCode}} +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +{{/useReflectionEqualsHashCode}} +{{#models}} +{{#model}} +{{#additionalPropertiesType}} +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +{{/additionalPropertiesType}} +{{/model}} +{{/models}} +import java.util.Objects; +import java.util.Arrays; +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +{{/withXml}} +{{#vendorExtensions.x-has-readonly-properties}} +import com.fasterxml.jackson.annotation.JsonCreator; +{{/vendorExtensions.x-has-readonly-properties}} +{{/jackson}} +{{#withXml}} +import {{javaxPackage}}.xml.bind.annotation.*; +import {{javaxPackage}}.xml.bind.annotation.adapters.*; +import io.github.threetenjaxb.core.*; +{{/withXml}} +{{#jsonb}} +import java.lang.reflect.Type; +import {{javaxPackage}}.json.bind.annotation.JsonbTypeDeserializer; +import {{javaxPackage}}.json.bind.annotation.JsonbTypeSerializer; +import {{javaxPackage}}.json.bind.serializer.DeserializationContext; +import {{javaxPackage}}.json.bind.serializer.JsonbDeserializer; +import {{javaxPackage}}.json.bind.serializer.JsonbSerializer; +import {{javaxPackage}}.json.bind.serializer.SerializationContext; +import {{javaxPackage}}.json.stream.JsonGenerator; +import {{javaxPackage}}.json.stream.JsonParser; +import {{javaxPackage}}.json.bind.annotation.JsonbProperty; +{{#vendorExtensions.x-has-readonly-properties}} +import {{javaxPackage}}.json.bind.annotation.JsonbCreator; +{{/vendorExtensions.x-has-readonly-properties}} +{{/jsonb}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import {{javaxPackage}}.validation.constraints.*; +import {{javaxPackage}}.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} +{{#supportUrlQuery}} +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.StringJoiner; +{{/supportUrlQuery}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#vendorExtensions.x-is-one-of-interface}}{{>oneof_interface}}{{/vendorExtensions.x-is-one-of-interface}}{{^vendorExtensions.x-is-one-of-interface}}{{>pojo}}{{/vendorExtensions.x-is-one-of-interface}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache new file mode 100644 index 000000000000..da0c3fc9f88f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache @@ -0,0 +1,620 @@ +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{#isClassnameSanitized}} +{{^hasDiscriminatorWithNonEmptyMapping}} +@JsonTypeName("{{name}}") +{{/hasDiscriminatorWithNonEmptyMapping}} +{{/isClassnameSanitized}} +{{/jackson}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/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}} +{{>modelInnerEnum}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#gson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/gson}} + {{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{/jackson}} + {{#withXml}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} + {{^isXmlAttribute}} + {{#isDateTime}} + @XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class) + {{/isDateTime}} + {{/isXmlAttribute}} + {{/withXml}} + {{#gson}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/gson}} + {{>nullable_var_annotations}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} 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}} + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isContainer}} + {{^isContainer}} + {{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/vars}} + public {{classname}}() { + {{#parent}} + {{#parcelableModel}} + super();{{/parcelableModel}} + {{/parent}} + {{#gson}} + {{#discriminator}} + {{#discriminator.isEnum}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator.isEnum}} + {{/discriminator}} + {{/gson}} + } + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} + /** + * Constructor with only readonly parameters{{#generateConstructorWithAllArgs}}{{^vendorExtensions.x-java-all-args-constructor}} and all parameters{{/vendorExtensions.x-java-all-args-constructor}}{{/generateConstructorWithAllArgs}} + */ + {{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}} + public {{classname}}( + {{#readOnlyVars}} + {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; + {{/readOnlyVars}} + } + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} +{{#vendorExtensions.x-java-all-args-constructor}} + + /** + * Constructor with all args parameters + */ + public {{classname}}({{#vendorExtensions.x-java-all-args-constructor-vars}}{{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-java-all-args-constructor-vars}}) { +{{#parent}} + super({{#parentVars}}{{name}}{{^-last}}, {{/-last}}{{/parentVars}}); +{{/parent}} + {{#vars}} + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; +{{/vars}} + } +{{/vendorExtensions.x-java-all-args-constructor}} + +{{#vars}} + {{^isReadOnly}} + public {{classname}} {{name}}({{>nullable_var_annotations}} {{{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{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/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}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; + } + this.{{name}}.add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInPascalCase}}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}}}{{^defaultValue}}new HashMap<>(){{/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}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; + } + {{/required}} + this.{{name}}.put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ +{{#deprecated}} + @Deprecated +{{/deprecated}} + {{>nullable_var_annotations}} +{{#jsonb}} + @JsonbProperty("{{baseName}}") +{{/jsonb}} +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} +{{#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}}{{> 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}} +{{> jackson_annotations}} + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}} + @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}} +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{>nullable_var_annotations}} {{{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}} +{{>libraries/restclient/additional_properties}} + {{#parent}} + {{#readWriteVars}} + {{#isOverridden}} + @Override + public {{classname}} {{name}}({{>nullable_var_annotations}} {{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}(JsonNullable.<{{{datatypeWithEnum}}}>of({{name}})); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{setter}}({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + + {{/isOverridden}} + {{/readWriteVars}} + {{/parent}} + @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}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} && + {{/-last}}{{/vars}}{{#additionalPropertiesType}} && + Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#additionalPropertiesType}}, additionalProperties{{/additionalPropertiesType}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @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({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); + {{/vars}} + {{#additionalPropertiesType}} + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + {{/additionalPropertiesType}} + 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 "); + } +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#allVars}} + // add `{{baseName}}` to the URL query string + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.datatypeWithEnum}}} _item : {{getter}}()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if ({{getter}}() != null) { + int i = 0; + for ({{{items.dataType}}} _item : {{getter}}()) { + if (_item != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if ({{getter}}() != null) { + for (int i = 0; i < {{getter}}().size(); i++) { + if ({{getter}}().get(i) != null) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix), + URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{^items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + try { + joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + {{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + {{/items.isModel}} + {{#items.isModel}} + if ({{getter}}() != null) { + for (String _key : {{getter}}().keySet()) { + if ({{getter}}().get(_key) != null) { + joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isModel}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if ({{getter}}() != null) { + joiner.add({{getter}}().toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if ({{getter}}() != null) { + try { + joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + + {{/allVars}} + return joiner.toString(); + } +{{/supportUrlQuery}} +{{#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}} +{{#generateBuilders}} + + {{>javaBuilder}} +{{/generateBuilders}} + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/api.mustache index e77329ee9617..6a069a773d21 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/api.mustache @@ -5,6 +5,10 @@ import {{invokerPackage}}.ApiClient; {{/imports}} import io.vertx.core.AsyncResult; import io.vertx.core.Handler; +{{#supportVertxFuture}} +import io.vertx.core.Future; +import io.vertx.core.Promise; +{{/supportVertxFuture}} import io.vertx.core.json.JsonObject; import java.util.*; @@ -18,11 +22,33 @@ public interface {{classname}} { {{/isDeprecated}} void {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}, {{/allParams}}Handler> handler); + {{#supportVertxFuture}} + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + default Future<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){ + Promise<{{{returnType}}}{{^returnType}}Void{{/returnType}}> promise = Promise.promise(); + {{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}promise); + return promise.future(); + } + + {{/supportVertxFuture}} {{#isDeprecated}} @Deprecated {{/isDeprecated}} void {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}, {{/allParams}}ApiClient.AuthInfo authInfo, Handler> handler); + {{#supportVertxFuture}} + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + default Future<{{{returnType}}}{{^returnType}}Void{{/returnType}}> {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}, {{/allParams}}ApiClient.AuthInfo authInfo){ + Promise<{{{returnType}}}{{^returnType}}Void{{/returnType}}> promise = Promise.promise(); + {{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}authInfo, promise); + return promise.future(); + } + + {{/supportVertxFuture}} {{/operation}} {{/operations}} } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache index 0e8fd590ce58..cd9e1908e6f8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache @@ -32,7 +32,7 @@ ext { swagger_annotations_version = "1.5.21" jackson_version = "2.17.1" jackson_databind_version = "2.17.1" - vertx_version = "3.5.2" + vertx_version = "{{#supportVertxFuture}}4.0.0{{/supportVertxFuture}}{{^supportVertxFuture}}3.5.2{{/supportVertxFuture}}" junit_version = "5.10.3" {{#openApiNullable}} jackson_databind_nullable_version = "0.2.6" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache index b9b44cd85dfc..fa116bbcf4b2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache @@ -299,7 +299,7 @@ UTF-8 - 3.5.2 + {{#supportVertxFuture}}4.0.0{{/supportVertxFuture}}{{^supportVertxFuture}}3.5.2{{/supportVertxFuture}} {{#swagger1AnnotationLibrary}} 1.6.6 {{/swagger1AnnotationLibrary}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/api.mustache index afc9931c2414..844728cff62b 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/api.mustache @@ -62,7 +62,7 @@ public class {{classname}} { @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}} }) public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) { - return delegate.{{nickname}}({{#allParams}}{{#isFile}}{{#isMultipart}}{{paramName}}InputStream, {{paramName}}Detail{{/isMultipart}}{{^isMultipart}}{{paramName}}{{/isMultipart}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}, {{/allParams}}securityContext); + return delegate.{{nickname}}({{#allParams}}{{#isFile}}{{#isMultipart}}{{paramName}}Detail{{/isMultipart}}{{^isMultipart}}{{paramName}}{{/isMultipart}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}, {{/allParams}}securityContext); } {{/operation}} } diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/formParams.mustache index a900c62ccfeb..32fa55efd4be 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{#isMultipart}}@Multipart{{/isMultipart}}{{^isMultipart}}@FormParam{{/isMultipart}}(value = "{{baseName}}"{{^required}}{{#isMultipart}}, required = false{{/isMultipart}}{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} @Multipart(value = "{{baseName}}"{{^required}}, required = false{{/required}}) InputStream {{paramName}}InputStream, @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{#isMultipart}}@Multipart{{/isMultipart}}{{^isMultipart}}@FormParam{{/isMultipart}}(value = "{{baseName}}"{{^required}}{{#isMultipart}}, required = false{{/isMultipart}}{{/required}}) {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}} @Multipart(value = "{{baseName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/serviceFormParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/serviceFormParams.mustache index df6fba4a3ddd..fdcd65010933 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/serviceFormParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/serviceFormParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}InputStream {{paramName}}InputStream, Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache index 069758033634..39dbd9c03943 100644 --- a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache @@ -603,7 +603,7 @@ namespace {{packageName}}.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache b/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache index 18c795e23906..09fb6d5dc0a2 100644 --- a/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache +++ b/modules/openapi-generator/src/main/resources/elixir/connection.ex.mustache @@ -96,7 +96,7 @@ defmodule {{moduleName}}.Connection do of the function call, will be set as a bearer token in the `authorization` header. {{/hasOAuthMethods}} - - `options`: a keyword list of OpenAPIPetstore.Connection.options. + - `options`: a keyword list of {{moduleName}}.Connection.options. ### Returns @@ -133,7 +133,7 @@ defmodule {{moduleName}}.Connection do that returns a bearer token. - `scopes_or_password`: a list of Strings represenging OAuth2 scopes, or a single string that is the password for the username provided. - - `options`: a keyword list of OpenAPIPetstore.Connection.options. + - `options`: a keyword list of {{moduleName}}.Connection.options. ### Returns @@ -155,7 +155,7 @@ defmodule {{moduleName}}.Connection do of the function call, will be set as a bearer token in the `authorization` header. - `scopes`: a list of Strings represenging OAuth2 scopes. - - `options`: a keyword list of OpenAPIPetstore.Connection.options. + - `options`: a keyword list of {{moduleName}}.Connection.options. ### Returns diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/gradle.properties.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/gradle.properties.mustache index 5b018d630a7d..941d83cb7c55 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/gradle.properties.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-volley/gradle.properties.mustache @@ -1,4 +1,12 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# android.useAndroidX=true {{#generateRoomModels}} android.enableJetifier=true {{/generateRoomModels}} +{{#gradleProperties}} +{{{.}}} +{{/gradleProperties}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache index ed62c902c3d4..18225b7f1a0c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}} \ No newline at end of file +{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = {{#isEnum}}"{{/isEnum}}{{{.}}}{{#isEnum}}"{{/isEnum}}{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/FormDataProcessor.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/FormDataProcessor.mustache new file mode 100644 index 000000000000..ad9808c4ab12 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-nextgen/FormDataProcessor.mustache @@ -0,0 +1,227 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use ArrayAccess; +use DateTime; +use GuzzleHttp\Psr7\Utils; +use Psr\Http\Message\StreamInterface; +use SplFileObject; +use {{modelPackage}}\ModelInterface; + +class FormDataProcessor +{ + /** + * Tags whether payload passed to ::prepare() contains one or more + * SplFileObject or stream values. + */ + public bool $has_file = false; + + /** + * Take value and turn it into an array suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param array $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix . $key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + $result[$currentName] = ObjectSerializer::toString($val); + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + * + * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value + */ + protected function makeFormSafe(mixed $value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || is_object($value)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (str_contains($type, '\SplFileObject')) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache index 81dd8a50387f..32a77bef4bac 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/ObjectSerializer.mustache @@ -18,7 +18,6 @@ namespace {{invokerPackage}}; -use ArrayAccess; use DateTimeInterface; use DateTime; use GuzzleHttp\Psr7\Utils; @@ -316,37 +315,6 @@ class ObjectSerializer return self::toString($value); } - /** - * Take value and turn it into an array suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|bool|array|DateTime|ArrayAccess|\SplFileObject $value the value of the form parameter - * - * @return array [key => value] of formdata - */ - public static function toFormValue( - string $key, - string|bool|array|DateTime|ArrayAccess|\SplFileObject $value, - ): array { - if ($value instanceof \SplFileObject) { - return [$key => $value->getRealPath()]; - } elseif (is_array($value) || $value instanceof ArrayAccess) { - $flattened = []; - $result = []; - - self::flattenArray(json_decode(json_encode($value), true), $flattened); - - foreach ($flattened as $k => $v) { - $result["{$key}{$k}"] = self::toString($v); - } - - return $result; - } else { - return [$key => self::toString($value)]; - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -612,58 +580,4 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - - /** - * Flattens an array of Model object and generates an array compatible - * with formdata - a single-level array where the keys use bracket - * notation to signify nested data. - * - * credit: https://github.com/FranBar1966/FlatPHP - */ - private static function flattenArray( - ArrayAccess|array $source, - array &$destination, - string $start = '', - ) { - $opt = [ - 'prefix' => '[', - 'suffix' => ']', - 'suffix-end' => true, - 'prefix-list' => '[', - 'suffix-list' => ']', - 'suffix-list-end' => true, - ]; - - if (!is_array($source)) { - $source = (array) $source; - } - - if (array_is_list($source)) { - $currentPrefix = $opt['prefix-list']; - $currentSuffix = $opt['suffix-list']; - $currentSuffixEnd = $opt['suffix-list-end']; - } else { - $currentPrefix = $opt['prefix']; - $currentSuffix = $opt['suffix']; - $currentSuffixEnd = $opt['suffix-end']; - } - - $currentName = $start; - - foreach ($source as $key => $val) { - $currentName .= $currentPrefix.$key; - - if (is_array($val) && !empty($val)) { - $currentName .= "{$currentSuffix}"; - self::flattenArray($val, $destination, $currentName); - } else { - if ($currentSuffixEnd) { - $currentName .= $currentSuffix; - } - $destination[$currentName] = self::toString($val); - } - - $currentName = $start; - } - } } diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache index dcf2019d0bfd..368faec4270a 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache @@ -31,6 +31,7 @@ use Psr\Http\Message\ResponseInterface; use {{invokerPackage}}\ApiException; use {{invokerPackage}}\Configuration; use {{invokerPackage}}\HeaderSelector; +use {{invokerPackage}}\FormDataProcessor; use {{invokerPackage}}\ObjectSerializer; /** @@ -189,8 +190,8 @@ use {{invokerPackage}}\ObjectSerializer; {{/vendorExtensions.x-group-parameters}} ): {{{vendorExtensions.x-php-return-type}}} { - {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} - return $response;{{/returnType}} + {{^vendorExtensions.x-php-return-type-is-void}}list($response) = {{/vendorExtensions.x-php-return-type-is-void}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{^vendorExtensions.x-php-return-type-is-void}} + return $response;{{/vendorExtensions.x-php-return-type-is-void}} } /** @@ -724,25 +725,19 @@ use {{invokerPackage}}\ObjectSerializer; {{/pathParams}} {{#formParams}} + {{#-first}} // form params - if (${{paramName}} !== null) { - {{#isFile}} - $multipart = true; - $formParams['{{baseName}}'] = []; - $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; - foreach ($paramFiles as $paramFile) { - $formParams['{{baseName}}'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('{{baseName}}', $paramFile)['{{baseName}}'], - 'rb' - ); - } - {{/isFile}} - {{^isFile}} - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('{{baseName}}', ${{paramName}})); - {{/isFile}} - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + {{/-first}} + '{{paramName}}' => ${{paramName}}, + {{#-last}} + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; + {{/-last}} {{/formParams}} $headers = $this->headerSelector->selectHeaders( diff --git a/modules/openapi-generator/src/main/resources/php/FormDataProcessor.mustache b/modules/openapi-generator/src/main/resources/php/FormDataProcessor.mustache new file mode 100644 index 000000000000..6985fd6c573f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php/FormDataProcessor.mustache @@ -0,0 +1,233 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use ArrayAccess; +use DateTime; +use GuzzleHttp\Psr7\Utils; +use Psr\Http\Message\StreamInterface; +use SplFileObject; +use {{modelPackage}}\ModelInterface; + +/** + * FormDataProcessor Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class FormDataProcessor +{ + /** + * Tags whether payload passed to ::prepare() contains one or more + * SplFileObject or stream values. + */ + public bool $has_file = false; + + /** + * Take value and turn it into an array suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param array $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + $result[$currentName] = ObjectSerializer::toString($val); + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index b076414630ca..9bf66a48288f 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -19,7 +19,6 @@ namespace {{invokerPackage}}; -use ArrayAccess; use GuzzleHttp\Psr7\Utils; use {{modelPackage}}\ModelInterface; @@ -315,35 +314,6 @@ class ObjectSerializer return self::toString($value); } - /** - * Take value and turn it into an array suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|bool|array|DateTime|ArrayAccess|\SplFileObject $value the value of the form parameter - * - * @return array [key => value] of formdata - */ - public static function toFormValue(string $key, $value) - { - if ($value instanceof \SplFileObject) { - return [$key => $value->getRealPath()]; - } elseif (is_array($value) || $value instanceof ArrayAccess) { - $flattened = []; - $result = []; - - self::flattenArray(json_decode(json_encode($value), true), $flattened); - - foreach ($flattened as $k => $v) { - $result["{$key}{$k}"] = self::toString($v); - } - - return $result; - } else { - return [$key => self::toString($value)]; - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -617,81 +587,4 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - - /** - * Flattens an array of Model object and generates an array compatible - * with formdata - a single-level array where the keys use bracket - * notation to signify nested data. - * - * @param \ArrayAccess|array $source - * - * credit: https://github.com/FranBar1966/FlatPHP - */ - private static function flattenArray( - $source, - array &$destination, - string $start = '' - ) { - $opt = [ - 'prefix' => '[', - 'suffix' => ']', - 'suffix-end' => true, - 'prefix-list' => '[', - 'suffix-list' => ']', - 'suffix-list-end' => true, - ]; - - if (!is_array($source)) { - $source = (array) $source; - } - - /** - * array_is_list only in PHP >= 8.1 - * - * credit: https://www.php.net/manual/en/function.array-is-list.php#127044 - */ - if (!function_exists('array_is_list')) { - function array_is_list(array $array) - { - $i = -1; - - foreach ($array as $k => $v) { - ++$i; - if ($k !== $i) { - return false; - } - } - - return true; - } - } - - if (array_is_list($source)) { - $currentPrefix = $opt['prefix-list']; - $currentSuffix = $opt['suffix-list']; - $currentSuffixEnd = $opt['suffix-list-end']; - } else { - $currentPrefix = $opt['prefix']; - $currentSuffix = $opt['suffix']; - $currentSuffixEnd = $opt['suffix-end']; - } - - $currentName = $start; - - foreach ($source as $key => $val) { - $currentName .= $currentPrefix.$key; - - if (is_array($val) && !empty($val)) { - $currentName .= "{$currentSuffix}"; - self::flattenArray($val, $destination, $currentName); - } else { - if ($currentSuffixEnd) { - $currentName .= $currentSuffix; - } - $destination[$currentName] = self::toString($val); - } - - $currentName = $start; - } - } } diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 5e014c011e4e..a564a6220e7c 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -29,6 +29,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use {{invokerPackage}}\ApiException; use {{invokerPackage}}\Configuration; +use {{invokerPackage}}\FormDataProcessor; use {{invokerPackage}}\HeaderSelector; use {{invokerPackage}}\ObjectSerializer; @@ -646,23 +647,19 @@ use {{invokerPackage}}\ObjectSerializer; {{/pathParams}} {{#formParams}} + {{#-first}} // form params - if (${{paramName}} !== null) { - {{#isFile}} - $multipart = true; - $formParams['{{baseName}}'] = []; - $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; - foreach ($paramFiles as $paramFile) { - $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('{{baseName}}', $paramFile)['{{baseName}}'], - 'rb' - ); - } - {{/isFile}} - {{^isFile}} - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('{{baseName}}', ${{paramName}})); - {{/isFile}} - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + {{/-first}} + '{{paramName}}' => ${{paramName}}, + {{#-last}} + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; + {{/-last}} {{/formParams}} {{#isMultipart}} diff --git a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache index 7cbb99a58f0f..727f0eb25c2e 100644 --- a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache @@ -34,6 +34,7 @@ use {{invokerPackage}}\ApiException; use {{invokerPackage}}\Configuration; use {{invokerPackage}}\DebugPlugin; use {{invokerPackage}}\HeaderSelector; +use {{invokerPackage}}\FormDataProcessor; use {{invokerPackage}}\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; @@ -605,23 +606,19 @@ use function sprintf; {{/pathParams}} {{#formParams}} + {{#-first}} // form params - if (${{paramName}} !== null) { - {{#isFile}} - $multipart = true; - $formParams['{{baseName}}'] = []; - $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; - foreach ($paramFiles as $paramFile) { - $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\try_fopen( - ObjectSerializer::toFormValue('{{baseName}}', $paramFile)['{{baseName}}'], - 'rb' - ); - } - {{/isFile}} - {{^isFile}} - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('{{baseName}}', ${{paramName}})); - {{/isFile}} - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + {{/-first}} + '{{paramName}}' => ${{paramName}}, + {{#-last}} + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; + {{/-last}} {{/formParams}} $headers = $this->headerSelector->selectHeaders( diff --git a/modules/openapi-generator/src/main/resources/protobuf-schema/api.mustache b/modules/openapi-generator/src/main/resources/protobuf-schema/api.mustache index 8f804af4b6c3..fd22c4d7dcbf 100644 --- a/modules/openapi-generator/src/main/resources/protobuf-schema/api.mustache +++ b/modules/openapi-generator/src/main/resources/protobuf-schema/api.mustache @@ -3,6 +3,9 @@ syntax = "proto3"; package {{#lambda.lowercase}}{{{packageName}}}.{{{apiPackage}}}.{{{classname}}};{{/lambda.lowercase}} +{{#customOptionsApi}} +{{{.}}} +{{/customOptionsApi}} import "google/protobuf/empty.proto"; {{#imports}} {{#import}} diff --git a/modules/openapi-generator/src/main/resources/protobuf-schema/model.mustache b/modules/openapi-generator/src/main/resources/protobuf-schema/model.mustache index 817bb5f1e607..c0ec053732c1 100644 --- a/modules/openapi-generator/src/main/resources/protobuf-schema/model.mustache +++ b/modules/openapi-generator/src/main/resources/protobuf-schema/model.mustache @@ -3,6 +3,9 @@ syntax = "proto3"; package {{#lambda.lowercase}}{{{packageName}}};{{/lambda.lowercase}} +{{#customOptionsModel}} +{{{.}}} +{{/customOptionsModel}} {{#imports}} {{#import}} import public "{{{.}}}.proto"; diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache index 98cc4f76f9fa..a4970abf4299 100644 --- a/modules/openapi-generator/src/main/resources/rust/model.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model.mustache @@ -129,9 +129,9 @@ pub struct {{{classname}}} { /// {{{.}}} {{/description}} {{#isByteArray}} - {{#required}}#[serde_as(as = "serde_with::base64::Base64")]{{/required}}{{^required}}#[serde_as(as = "Option")]{{/required}} + {{#vendorExtensions.isMandatory}}#[serde_as(as = "serde_with::base64::Base64")]{{/vendorExtensions.isMandatory}}{{^vendorExtensions.isMandatory}}#[serde_as(as = "{{^serdeAsDoubleOption}}Option{{/serdeAsDoubleOption}}{{#serdeAsDoubleOption}}super::DoubleOption{{/serdeAsDoubleOption}}")]{{/vendorExtensions.isMandatory}} {{/isByteArray}} - #[serde(rename = "{{{baseName}}}"{{^required}}{{#isNullable}}, default, with = "::serde_with::rust::double_option"{{/isNullable}}{{/required}}{{^required}}, skip_serializing_if = "Option::is_none"{{/required}}{{#required}}{{#isNullable}}, deserialize_with = "Option::deserialize"{{/isNullable}}{{/required}})] + #[serde(rename = "{{{baseName}}}"{{^required}}{{#isNullable}}, default{{^isByteArray}}, with = "::serde_with::rust::double_option"{{/isByteArray}}{{/isNullable}}{{/required}}{{^required}}, skip_serializing_if = "Option::is_none"{{/required}}{{#required}}{{#isNullable}}, deserialize_with = "Option::deserialize"{{/isNullable}}{{/required}})] pub {{{name}}}: {{! ### Option Start }}{{#isNullable}}Option<{{/isNullable}}{{^required}}Option<{{/required}}{{! diff --git a/modules/openapi-generator/src/main/resources/rust/model_mod.mustache b/modules/openapi-generator/src/main/resources/rust/model_mod.mustache index 06bf92f019a8..bdb080f6d1d3 100644 --- a/modules/openapi-generator/src/main/resources/rust/model_mod.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model_mod.mustache @@ -4,3 +4,42 @@ pub mod {{{classFilename}}}; pub use self::{{{classFilename}}}::{{{classname}}}; {{/model}} {{/models}} +{{#serdeAsDoubleOption}} +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} +{{/serdeAsDoubleOption}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/scala-http4s/model.mustache b/modules/openapi-generator/src/main/resources/scala-http4s/model.mustache index 118fdb0fabd0..1178f7cdbc45 100644 --- a/modules/openapi-generator/src/main/resources/scala-http4s/model.mustache +++ b/modules/openapi-generator/src/main/resources/scala-http4s/model.mustache @@ -56,7 +56,7 @@ object {{classname}} { given decoder{{classname}}: Decoder[{{classname}}] = Decoder.instance { c => for { {{#vars}} - {{name}} <- c.downField("{{baseName}}").as[{{^required}}Option[{{{dataType}}}]{{/required}}{{#required}}{{{dataType}}}{{/required}}] + {{name}} <- {{#isEnumOrRef}}{{^required}}mapEmptyStringToNull(c.downField("{{baseName}}")){{/required}}{{#required}}c.downField("{{baseName}}"){{/required}}{{/isEnumOrRef}}{{^isEnumOrRef}}c.downField("{{baseName}}"){{/isEnumOrRef}}.as[{{^required}}Option[{{{dataType}}}]{{/required}}{{#required}}{{{dataType}}}{{/required}}] {{/vars}} } yield {{classname}}( {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/scala-http4s/modelsPackage.mustache b/modules/openapi-generator/src/main/resources/scala-http4s/modelsPackage.mustache index 3c99460f4b8a..ca003c634951 100644 --- a/modules/openapi-generator/src/main/resources/scala-http4s/modelsPackage.mustache +++ b/modules/openapi-generator/src/main/resources/scala-http4s/modelsPackage.mustache @@ -1,7 +1,7 @@ {{>licenseInfo}} package {{packageName}} -import io.circe.{Decoder, Encoder, Json} +import io.circe.{Decoder, Encoder, Json, ACursor} import java.time.{Instant, LocalDate, OffsetDateTime} import java.util.UUID @@ -31,4 +31,7 @@ package object models { given encodeJson: Encoder[Json] = Encoder.encodeString.contramap[Json](_.toString) + def mapEmptyStringToNull(f: ACursor): ACursor = + f.withFocus(json => if json.toString == "\"\"" then Json.Null else json) + } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache b/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache index d3045ec1edc9..d6e7308600f6 100644 --- a/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/JSONEncodingHelper.mustache @@ -26,20 +26,4 @@ import Foundation return params } - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache b/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache index 9f5d5426dd9e..f50a704459bc 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache @@ -1,4 +1,4 @@ -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, QueryStringEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} { {{#allowableValues}} {{#enumVars}} case {{{name}}} = {{{value}}} diff --git a/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache b/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache index 206b8494cea7..eb6999268cc2 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache @@ -1,4 +1,4 @@ - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, QueryStringEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} { {{#allowableValues}} {{#enumVars}} case {{{name}}} = {{{value}}} diff --git a/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache index b36e5f682025..8a3b7f158f5c 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache @@ -1,4 +1,4 @@ -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable, QueryStringEncodable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} { {{#oneOf}} case type{{#transformArrayType}}{{.}}{{/transformArrayType}}({{.}}) {{/oneOf}} diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache index 4c8ba32f61e2..70e4601cbf87 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache @@ -1,3 +1,4 @@ +{{>licenseInfo}} import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { {{configurationClassName}} } from './configuration'; diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache index d05daa8ef2e5..c48a2b6b6f02 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache @@ -275,7 +275,8 @@ export class {{classname}} extends BaseService { {{/isResponseFile}} let localVarPath = `{{{path}}}`; - return this.httpClient.request{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}('{{httpMethod}}', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}('{{httpMethod}}', `${basePath}${localVarPath}`, { {{#httpContextInOptions}} context: localVarHttpContext, @@ -297,7 +298,7 @@ export class {{classname}} extends BaseService { {{^isResponseFile}} responseType: responseType_, {{/isResponseFile}} - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, {{#httpTransferCacheInOptions}} diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache index 6ad35011e07b..3182d6027e33 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache @@ -66,26 +66,30 @@ export class {{configurationClassName}} { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: {{configurationParametersInterfaceName}} = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: {{configurationParametersInterfaceName}} = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; {{#authMethods}} // init default {{name}} credential diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache index 98114ac5a51a..c34b4698d6a8 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache @@ -7,6 +7,8 @@ "module": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}commonjs{{/supportsES6}}", "moduleResolution": "node", "removeComments": true, + "strictNullChecks": true, + "exactOptionalPropertyTypes": true, "sourceMap": true, "outDir": "./dist", "noLib": false, diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFastapiCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFastapiCodegenTest.java index 2eb71268a12b..9a222ac9fae3 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFastapiCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFastapiCodegenTest.java @@ -30,7 +30,7 @@ public class PythonFastapiCodegenTest { List files = generator.opts(configurator.toClientOptInput()).generate(); files.forEach(File::deleteOnExit); - TestUtils.assertFileExists(Paths.get(output.getAbsolutePath(), "/src", IMPL_PKG, "__init__.py")); + TestUtils.assertFileExists(Paths.get(output.getAbsolutePath(), "/src", "/nodesc", IMPL_PKG, "__init__.py")); } @Test diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml index 8f8655b4f373..b903c4f68c21 100644 --- a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml @@ -137,6 +137,31 @@ paths: items: type: string collectionFormat: csv + - name: size + in: header + description: 'A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.' + required: false + type: string + - name: size + in: query + description: 'The number of items to return per page. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.' + required: true + type: integer + minimum: 1 + default: 20 + - name: page + in: query + description: 'The page to return, starting with page 0. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.' + required: true + type: integer + minimum: 0 + default: 0 + - name: sort + in: query + description: 'The sorting to apply to the Pageable object. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.' + required: true + type: string + default: id,asc responses: '200': description: successful operation diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-spring-pageable.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-spring-pageable.yaml index 9a1152bb06ac..fbf17da64240 100644 --- a/modules/openapi-generator/src/test/resources/2_0/petstore-with-spring-pageable.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-spring-pageable.yaml @@ -133,6 +133,31 @@ paths: items: type: string collectionFormat: csv + - name: size + in: header + description: 'A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.' + required: false + type: string + - name: size + in: query + description: 'The number of items to return per page. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.' + required: true + type: integer + minimum: 1 + default: 20 + - name: page + in: query + description: 'The page to return, starting with page 0. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.' + required: true + type: integer + minimum: 0 + default: 0 + - name: sort + in: query + description: 'The sorting to apply to the Pageable object. Test QueryParam for issue #8315 - must be removed when x-spring-paginated:true is used.' + required: true + type: string + default: id,asc responses: '200': description: successful operation diff --git a/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml index 229450a390d6..4c1654d2a2b5 100644 --- a/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1012,6 +1012,40 @@ paths: $ref: "#/components/schemas/FreeFormObject" description: request body required: true + /fake/implicitFreeFormObject: + post: + tags: + - fake + summary: test free form object with implicit additionalProperties + description: "" + operationId: testImplicitFreeFormObject + responses: + "200": + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ImplicitFreeFormObject" + description: request body + required: true + /fake/anyTypeObject: + post: + tags: + - fake + summary: test any type object + description: "" + operationId: testAnyTypeObject + responses: + "200": + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AnyTypeObject" + description: request body + required: true /fake/stringMap-reference: post: tags: @@ -1859,6 +1893,19 @@ components: type: object description: A schema consisting only of additional properties additionalProperties: true + ImplicitFreeFormObject: + type: object + description: A schema consisting only of additional properties (implicit) + AnyTypeObject: + oneOf: + - type: string + - type: number + - type: integer + - type: boolean + - type: object + - type: array + items: {} + nullable: true MapOfString: type: object description: A schema consisting only of additional properties of type string diff --git a/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml index 0b74a7aa046e..5ab53cee08b1 100644 --- a/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1444,6 +1444,51 @@ paths: description: Range of HTTP code 400-499 requestBody: $ref: '#/components/requestBodies/Pet' + "/error": + get: + summary: Will always generate an error + operationId: error + responses: &commonErrors + "400": + description: The supplied request was not valid + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + "404": + description: Requested item was not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + "422": + description: The input to the operation was not valid + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + "500": + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + "/fake/pet/{pet_id}": + delete: + operationId: fakeDeletePet + tags: + - fake + parameters: + - name: pet_id + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + "204": + description: "Returns 204 No Content on success." + <<: *commonErrors servers: - url: 'http://{server}.swagger.io:{port}/v2' description: petstore server @@ -2230,3 +2275,18 @@ components: type: integer error: type: string + + Error: + title: Error + description: "Returned when the server encounters an error, either in client input or internally" + properties: + error: + type: string + description: "A human readable error message" + errors: + type: array + items: + type: string + description: "Optional array of multiple errors encountered during processing" + required: + - error diff --git a/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml index 18161aec8bed..c24a3993f617 100644 --- a/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml @@ -342,6 +342,40 @@ paths: multipart/form-data: schema: $ref: '#/components/schemas/PetWithFile' + '/pet/{petId}/uploadImageFullFormDataNested': + post: + tags: + - pet + summary: uploads an image attached to a Pet object as formdata + description: '' + operationId: uploadImageFullFormDataNested + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + pet: + $ref: '#/components/schemas/PetWithFile' /store/inventory: get: tags: diff --git a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml index 59d623ec8965..98f1b1246048 100644 --- a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml @@ -2102,35 +2102,6 @@ components: enum: - 1.1 - -1.2 - enum_number_vendor_ext: - type: integer - format: int32 - enum: - - 42 - - 18 - - 56 - x-enum-descriptions: - - 'Description for 42' - - 'Description for 18' - - 'Description for 56' - x-enum-varnames: - - FortyTwo - - Eigtheen - - FiftySix - enum_string_vendor_ext: - type: string - enum: - - FOO - - Bar - - baz - x-enum-descriptions: - - 'Description for FOO' - - 'Description for Bar' - - 'Description for baz' - x-enum-varnames: - - FOOVar - - BarVar - - bazVar enum_string_single_member: type: string enum: @@ -2148,6 +2119,10 @@ components: $ref: '#/components/schemas/OuterEnumDefaultValue' outerEnumIntegerDefaultValue: $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' + enumNumberVendorExt: + $ref: '#/components/schemas/EnumNumberVendorExt' + enumStringVendorExt: + $ref: '#/components/schemas/EnumStringVendorExt' AdditionalPropertiesClass: type: object properties: @@ -2339,6 +2314,35 @@ components: - 1 - 2 example: 2 + EnumNumberVendorExt: + type: integer + format: int32 + enum: + - 42 + - 18 + - 56 + x-enum-descriptions: + - 'Description for 42' + - 'Description for 18' + - 'Description for 56' + x-enum-varnames: + - FortyTwo + - Eigtheen + - FiftySix + EnumStringVendorExt: + type: string + enum: + - FOO + - Bar + - baz + x-enum-descriptions: + - 'Description for FOO' + - 'Description for Bar' + - 'Description for baz' + x-enum-varnames: + - FOO_XEnumVarname + - BarVar_XEnumVarname + - bazVar_XEnumVarname OuterEnumDefaultValue: type: string enum: diff --git a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml index ced7450529e0..983c6989dcff 100644 --- a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml @@ -935,6 +935,10 @@ components: bytes: type: string format: byte + nullableBytes: # Regression test for bug report in #20500 + type: string + format: byte + nullable: true decimal: type: string format: number diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml index 0d3f66f4ab11..ba52d9622c0b 100644 --- a/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml @@ -171,6 +171,38 @@ paths: type: array items: type: string + - description: "A test HeaderParam for issue #8315 - must NOT be removed when\ + \ x-spring-paginated:true is used." + in: header + name: size + schema: + type: string + - description: "The number of items to return per page. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + in: query + name: size + required: true + schema: + default: 20 + minimum: 1 + type: integer + - description: "The page to return, starting with page 0. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + in: query + name: page + required: true + schema: + default: 0 + minimum: 0 + type: integer + - description: "The sorting to apply to the Pageable object. Test QueryParam\ + \ for issue #8315 - must be removed when x-spring-paginated:true is used." + in: query + name: sort + required: true + schema: + default: "id,asc" + type: string responses: 200: description: successful operation diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml index bd045d282629..dcf0075a21f0 100644 --- a/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml @@ -136,6 +136,38 @@ paths: type: array items: type: string + - description: "A test HeaderParam for issue #8315 - must NOT be removed when\ + \ x-spring-paginated:true is used." + in: header + name: size + schema: + type: string + - description: "The number of items to return per page. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + in: query + name: size + required: true + schema: + default: 20 + minimum: 1 + type: integer + - description: "The page to return, starting with page 0. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + in: query + name: page + required: true + schema: + default: 0 + minimum: 0 + type: integer + - description: "The sorting to apply to the Pageable object. Test QueryParam\ + \ for issue #8315 - must be removed when x-spring-paginated:true is used." + in: query + name: sort + required: true + schema: + default: "id,asc" + type: string responses: 200: description: successful operation diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs index 5c8abc6ea702..13e61760f2b9 100644 --- a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs @@ -503,7 +503,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/echo_api/java/native/gradle.properties b/samples/client/echo_api/java/native/gradle.properties index e69de29bb2d1..a3408578278a 100644 --- a/samples/client/echo_api/java/native/gradle.properties +++ b/samples/client/echo_api/java/native/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java index 477111bcd94a..d3a2450adb70 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java @@ -1006,17 +1006,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1025,17 +1016,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/JSON.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/JSON.java index f993e935c7aa..2ba91e749c71 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -164,6 +167,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index e97d0c7c8cb9..ef966c242162 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -936,17 +936,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -955,17 +946,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index 247f3cf0c99c..770195b00c99 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -168,6 +171,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Bird.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Bird.java index 5f5430d8a633..439aa6b8c8d5 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Bird.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Bird.java @@ -93,6 +93,7 @@ public class Bird { this.color = color; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Category.java index edf14f76134f..bc44872f04a2 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Category.java @@ -93,6 +93,7 @@ public class Category { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DataQuery.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DataQuery.java index 4b10be53fd7f..f6a1e9ce3ba7 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DataQuery.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DataQuery.java @@ -129,6 +129,7 @@ public class DataQuery extends Query { this.date = date; } + @Override public DataQuery id(@jakarta.annotation.Nullable Long id) { this.setId(id); diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java index a815fe5be0d9..1a2a1e8ddd6e 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -406,6 +406,7 @@ public class DefaultValue { this.stringNullable = JsonNullable.of(stringNullable); } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java index 0e7d4b48e789..c89ef2223daa 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java @@ -126,6 +126,7 @@ public class NumberPropertiesOnly { this._double = _double; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Pet.java index 800af3fd0a0a..235b4904e2bf 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Pet.java @@ -271,6 +271,7 @@ public class Pet { this.status = status; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Query.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Query.java index 0e5c8a6f9cae..5041bb71d011 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Query.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Query.java @@ -141,6 +141,7 @@ public class Query { this.outcomes = outcomes; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Tag.java index 72cd3c4517cb..3f3e4904375a 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/Tag.java @@ -93,6 +93,7 @@ public class Tag { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java index a1a457a85a8b..6bf753cae1ed 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -64,6 +64,7 @@ public class TestFormObjectMultipartRequestMarker { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java index b4490fb324e7..2565e90b931e 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java @@ -154,6 +154,7 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java index b41d959691bc..632c0bfbadbe 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java @@ -75,6 +75,7 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { this.values = values; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/FILES b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/FILES index c51141c743e7..d849d4cffa36 100644 --- a/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/FILES +++ b/samples/client/echo_api/php-nextgen-streaming/.openapi-generator/FILES @@ -32,6 +32,7 @@ src/Api/PathApi.php src/Api/QueryApi.php src/ApiException.php src/Configuration.php +src/FormDataProcessor.php src/HeaderSelector.php src/Model/Bird.php src/Model/Category.php diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php index eac402dd75dd..3bbb12c0fde8 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php index bdf56a65bb26..934a6a5aff54 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -899,19 +900,14 @@ class BodyApi // form params - if ($files !== null) { - $multipart = true; - $formParams['files'] = []; - $paramFiles = is_array($files) ? $files : [$files]; - foreach ($paramFiles as $paramFile) { - $formParams['files'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('files', $paramFile)['files'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'files' => $files, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], @@ -1179,19 +1175,14 @@ class BodyApi // form params - if ($my_file !== null) { - $multipart = true; - $formParams['my-file'] = []; - $paramFiles = is_array($my_file) ? $my_file : [$my_file]; - foreach ($paramFiles as $paramFile) { - $formParams['my-file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('my-file', $paramFile)['my-file'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'my_file' => $my_file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php index 23be7e56f066..8b78e059fa78 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -366,17 +367,16 @@ class FormApi // form params - if ($integer_form !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('integer_form', $integer_form)); - } - // form params - if ($boolean_form !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('boolean_form', $boolean_form)); - } - // form params - if ($string_form !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('string_form', $string_form)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'integer_form' => $integer_form, + 'boolean_form' => $boolean_form, + 'string_form' => $string_form, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], @@ -650,9 +650,14 @@ class FormApi // form params - if ($marker !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('marker', $marker)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'marker' => $marker, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], @@ -975,29 +980,19 @@ class FormApi // form params - if ($form1 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form1', $form1)); - } - // form params - if ($form2 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form2', $form2)); - } - // form params - if ($form3 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form3', $form3)); - } - // form params - if ($form4 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form4', $form4)); - } - // form params - if ($id !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('id', $id)); - } - // form params - if ($name !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('name', $name)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'form1' => $form1, + 'form2' => $form2, + 'form3' => $form3, + 'form4' => $form4, + 'id' => $id, + 'name' => $name, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php index 7590397a6d90..bda9d2c58c20 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php index d40c949e05e3..b74bfc1c40d5 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php index 34b6a4d324c8..2b9f868f18ca 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen-streaming/src/FormDataProcessor.php b/samples/client/echo_api/php-nextgen-streaming/src/FormDataProcessor.php new file mode 100644 index 000000000000..b7a31b3f2a01 --- /dev/null +++ b/samples/client/echo_api/php-nextgen-streaming/src/FormDataProcessor.php @@ -0,0 +1,237 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix . $key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + $result[$currentName] = ObjectSerializer::toString($val); + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + * + * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value + */ + protected function makeFormSafe(mixed $value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || is_object($value)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (str_contains($type, '\SplFileObject')) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php b/samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php index ac7cf8884fd6..135df37659ed 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/ObjectSerializer.php @@ -28,7 +28,6 @@ namespace OpenAPI\Client; -use ArrayAccess; use DateTimeInterface; use DateTime; use GuzzleHttp\Psr7\Utils; @@ -326,37 +325,6 @@ class ObjectSerializer return self::toString($value); } - /** - * Take value and turn it into an array suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|bool|array|DateTime|ArrayAccess|\SplFileObject $value the value of the form parameter - * - * @return array [key => value] of formdata - */ - public static function toFormValue( - string $key, - string|bool|array|DateTime|ArrayAccess|\SplFileObject $value, - ): array { - if ($value instanceof \SplFileObject) { - return [$key => $value->getRealPath()]; - } elseif (is_array($value) || $value instanceof ArrayAccess) { - $flattened = []; - $result = []; - - self::flattenArray(json_decode(json_encode($value), true), $flattened); - - foreach ($flattened as $k => $v) { - $result["{$key}{$k}"] = self::toString($v); - } - - return $result; - } else { - return [$key => self::toString($value)]; - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -622,58 +590,4 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - - /** - * Flattens an array of Model object and generates an array compatible - * with formdata - a single-level array where the keys use bracket - * notation to signify nested data. - * - * credit: https://github.com/FranBar1966/FlatPHP - */ - private static function flattenArray( - ArrayAccess|array $source, - array &$destination, - string $start = '', - ) { - $opt = [ - 'prefix' => '[', - 'suffix' => ']', - 'suffix-end' => true, - 'prefix-list' => '[', - 'suffix-list' => ']', - 'suffix-list-end' => true, - ]; - - if (!is_array($source)) { - $source = (array) $source; - } - - if (array_is_list($source)) { - $currentPrefix = $opt['prefix-list']; - $currentSuffix = $opt['suffix-list']; - $currentSuffixEnd = $opt['suffix-list-end']; - } else { - $currentPrefix = $opt['prefix']; - $currentSuffix = $opt['suffix']; - $currentSuffixEnd = $opt['suffix-end']; - } - - $currentName = $start; - - foreach ($source as $key => $val) { - $currentName .= $currentPrefix.$key; - - if (is_array($val) && !empty($val)) { - $currentName .= "{$currentSuffix}"; - self::flattenArray($val, $destination, $currentName); - } else { - if ($currentSuffixEnd) { - $currentName .= $currentSuffix; - } - $destination[$currentName] = self::toString($val); - } - - $currentName = $start; - } - } } diff --git a/samples/client/echo_api/php-nextgen/.openapi-generator/FILES b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES index c51141c743e7..d849d4cffa36 100644 --- a/samples/client/echo_api/php-nextgen/.openapi-generator/FILES +++ b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES @@ -32,6 +32,7 @@ src/Api/PathApi.php src/Api/QueryApi.php src/ApiException.php src/Configuration.php +src/FormDataProcessor.php src/HeaderSelector.php src/Model/Bird.php src/Model/Category.php diff --git a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php index eac402dd75dd..3bbb12c0fde8 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php index 3d63c8a2d4b7..831c78b37c59 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -899,19 +900,14 @@ class BodyApi // form params - if ($files !== null) { - $multipart = true; - $formParams['files'] = []; - $paramFiles = is_array($files) ? $files : [$files]; - foreach ($paramFiles as $paramFile) { - $formParams['files'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('files', $paramFile)['files'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'files' => $files, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], @@ -1179,19 +1175,14 @@ class BodyApi // form params - if ($my_file !== null) { - $multipart = true; - $formParams['my-file'] = []; - $paramFiles = is_array($my_file) ? $my_file : [$my_file]; - foreach ($paramFiles as $paramFile) { - $formParams['my-file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('my-file', $paramFile)['my-file'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'my_file' => $my_file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], diff --git a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php index 23be7e56f066..8b78e059fa78 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -366,17 +367,16 @@ class FormApi // form params - if ($integer_form !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('integer_form', $integer_form)); - } - // form params - if ($boolean_form !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('boolean_form', $boolean_form)); - } - // form params - if ($string_form !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('string_form', $string_form)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'integer_form' => $integer_form, + 'boolean_form' => $boolean_form, + 'string_form' => $string_form, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], @@ -650,9 +650,14 @@ class FormApi // form params - if ($marker !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('marker', $marker)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'marker' => $marker, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], @@ -975,29 +980,19 @@ class FormApi // form params - if ($form1 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form1', $form1)); - } - // form params - if ($form2 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form2', $form2)); - } - // form params - if ($form3 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form3', $form3)); - } - // form params - if ($form4 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('form4', $form4)); - } - // form params - if ($id !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('id', $id)); - } - // form params - if ($name !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('name', $name)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'form1' => $form1, + 'form2' => $form2, + 'form3' => $form3, + 'form4' => $form4, + 'id' => $id, + 'name' => $name, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['text/plain', ], diff --git a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php index 7590397a6d90..bda9d2c58c20 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php index d40c949e05e3..b74bfc1c40d5 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php index 34b6a4d324c8..2b9f868f18ca 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php @@ -41,6 +41,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/echo_api/php-nextgen/src/FormDataProcessor.php b/samples/client/echo_api/php-nextgen/src/FormDataProcessor.php new file mode 100644 index 000000000000..b7a31b3f2a01 --- /dev/null +++ b/samples/client/echo_api/php-nextgen/src/FormDataProcessor.php @@ -0,0 +1,237 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix . $key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + $result[$currentName] = ObjectSerializer::toString($val); + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + * + * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value + */ + protected function makeFormSafe(mixed $value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || is_object($value)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (str_contains($type, '\SplFileObject')) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php index ac7cf8884fd6..135df37659ed 100644 --- a/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php +++ b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php @@ -28,7 +28,6 @@ namespace OpenAPI\Client; -use ArrayAccess; use DateTimeInterface; use DateTime; use GuzzleHttp\Psr7\Utils; @@ -326,37 +325,6 @@ class ObjectSerializer return self::toString($value); } - /** - * Take value and turn it into an array suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|bool|array|DateTime|ArrayAccess|\SplFileObject $value the value of the form parameter - * - * @return array [key => value] of formdata - */ - public static function toFormValue( - string $key, - string|bool|array|DateTime|ArrayAccess|\SplFileObject $value, - ): array { - if ($value instanceof \SplFileObject) { - return [$key => $value->getRealPath()]; - } elseif (is_array($value) || $value instanceof ArrayAccess) { - $flattened = []; - $result = []; - - self::flattenArray(json_decode(json_encode($value), true), $flattened); - - foreach ($flattened as $k => $v) { - $result["{$key}{$k}"] = self::toString($v); - } - - return $result; - } else { - return [$key => self::toString($value)]; - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -622,58 +590,4 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - - /** - * Flattens an array of Model object and generates an array compatible - * with formdata - a single-level array where the keys use bracket - * notation to signify nested data. - * - * credit: https://github.com/FranBar1966/FlatPHP - */ - private static function flattenArray( - ArrayAccess|array $source, - array &$destination, - string $start = '', - ) { - $opt = [ - 'prefix' => '[', - 'suffix' => ']', - 'suffix-end' => true, - 'prefix-list' => '[', - 'suffix-list' => ']', - 'suffix-list-end' => true, - ]; - - if (!is_array($source)) { - $source = (array) $source; - } - - if (array_is_list($source)) { - $currentPrefix = $opt['prefix-list']; - $currentSuffix = $opt['suffix-list']; - $currentSuffixEnd = $opt['suffix-list-end']; - } else { - $currentPrefix = $opt['prefix']; - $currentSuffix = $opt['suffix']; - $currentSuffixEnd = $opt['suffix-end']; - } - - $currentName = $start; - - foreach ($source as $key => $val) { - $currentName .= $currentPrefix.$key; - - if (is_array($val) && !empty($val)) { - $currentName .= "{$currentSuffix}"; - self::flattenArray($val, $destination, $currentName); - } else { - if ($currentSuffixEnd) { - $currentName .= $currentSuffix; - } - $destination[$currentName] = self::toString($val); - } - - $currentName = $start; - } - } } diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs index ffddac249d05..9a4b99cd8121 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs @@ -497,7 +497,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java index b03ef6c63622..6dc50e81b2f6 100644 --- a/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java @@ -473,6 +473,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1011,6 +1012,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1041,22 +1058,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1139,8 +1140,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1161,6 +1164,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1170,8 +1178,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1263,4 +1269,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java index b03ef6c63622..6dc50e81b2f6 100644 --- a/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java @@ -473,6 +473,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1011,6 +1012,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1041,22 +1058,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1139,8 +1140,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1161,6 +1164,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1170,8 +1178,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1263,4 +1269,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java index 92f05cee501f..713058f4241e 100644 --- a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java @@ -910,17 +910,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -929,17 +920,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/JSON.java index e4d4b002326d..578186471f75 100644 --- a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -160,6 +163,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java index a367d6b890c7..70ad8d5e2759 100644 --- a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java @@ -910,17 +910,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -929,17 +920,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/JSON.java index c6b151d0ccc0..4587781f631b 100644 --- a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -159,6 +162,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java index abe4e775969d..964594c5668a 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java @@ -910,17 +910,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -929,17 +920,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/JSON.java index 999628dc1f76..70dfd4eb613f 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -160,6 +163,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts index 61c5d507e8a3..f93aee53b880 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * Schemas with different types of composition for testing models generation + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api/pet.service.ts b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api/pet.service.ts index 356cdf76d981..411a6b97b012 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api/pet.service.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api/pet.service.ts @@ -70,11 +70,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/mapped`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts index 788d6f1a9ee9..2a128451c081 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; } /** diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts b/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts index 61c5d507e8a3..f93aee53b880 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * Schemas with different types of composition for testing models generation + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/api/pet.service.ts b/samples/client/others/typescript-angular/builds/composed-schemas/api/pet.service.ts index 356cdf76d981..411a6b97b012 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas/api/pet.service.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas/api/pet.service.ts @@ -70,11 +70,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/mapped`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts b/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts index 788d6f1a9ee9..2a128451c081 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; } /** diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 02aefa69e18d..601dfdb2f3e7 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -602,7 +602,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 08960c8389ea..ed3aecacd924 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -597,7 +597,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs index d4177aa1d048..1176107c56fa 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs @@ -528,7 +528,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index e104bdcf2770..e254dd2413ab 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index e104bdcf2770..e254dd2413ab 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index 76aaeace6702..ccbe76060856 100644 --- a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs index edbaddee9a0d..d7146853e0f9 100644 --- a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -502,7 +502,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 76aaeace6702..ccbe76060856 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs index 488b3d832e4e..5a7f7e948236 100644 --- a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs @@ -502,7 +502,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs index 35b89b430a80..c89eee968eca 100644 --- a/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net8/useVirtualForHooks/src/Org.OpenAPITools/Client/Configuration.cs @@ -533,7 +533,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index 76aaeace6702..ccbe76060856 100644 --- a/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net9/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -633,7 +633,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs index 18e94ac0845e..3ea2a481c169 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs @@ -628,7 +628,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 18e94ac0845e..3ea2a481c169 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -628,7 +628,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 02aefa69e18d..601dfdb2f3e7 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -602,7 +602,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 08960c8389ea..ed3aecacd924 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -597,7 +597,7 @@ namespace Org.OpenAPITools.Client if (inputVariables.ContainsKey(variable.Key)) { - if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) { url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); } diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex index 59ca8b472da5..7067b04b079a 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex @@ -304,6 +304,37 @@ defmodule OpenapiPetstore.Api.Fake do ]) end + @doc """ + test any type object + + + ### Parameters + + - `connection` (OpenapiPetstore.Connection): Connection to server + - `body` (any()): request body + - `opts` (keyword): Optional parameters + + ### Returns + + - `{:ok, nil}` on success + - `{:error, Tesla.Env.t}` on failure + """ + @spec test_any_type_object(Tesla.Env.client, any(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} + def test_any_type_object(connection, body, _opts \\ []) do + request = + %{} + |> method(:post) + |> url("/fake/anyTypeObject") + |> add_param(:body, :body, body) + |> Enum.into([]) + + connection + |> Connection.request(request) + |> evaluate_response([ + {200, false} + ]) + end + @doc """ For this test, the body has to be a binary file. @@ -585,6 +616,37 @@ defmodule OpenapiPetstore.Api.Fake do ]) end + @doc """ + test free form object with implicit additionalProperties + + + ### Parameters + + - `connection` (OpenapiPetstore.Connection): Connection to server + - `body` (%{optional(String.t) => any()}): request body + - `opts` (keyword): Optional parameters + + ### Returns + + - `{:ok, nil}` on success + - `{:error, Tesla.Env.t}` on failure + """ + @spec test_implicit_free_form_object(Tesla.Env.client, %{optional(String.t) => any()}, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} + def test_implicit_free_form_object(connection, body, _opts \\ []) do + request = + %{} + |> method(:post) + |> url("/fake/implicitFreeFormObject") + |> add_param(:body, :body, body) + |> Enum.into([]) + + connection + |> Connection.request(request) + |> evaluate_response([ + {200, false} + ]) + end + @doc """ test inline additionalProperties diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex b/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex index ec43955eaf29..61f3fc2cd561 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/connection.ex @@ -84,7 +84,7 @@ defmodule OpenapiPetstore.Connection do - `token`: a String or a function of arity one. This value, or the result of the function call, will be set as a bearer token in the `authorization` header. - - `options`: a keyword list of OpenAPIPetstore.Connection.options. + - `options`: a keyword list of OpenapiPetstore.Connection.options. ### Returns @@ -112,7 +112,7 @@ defmodule OpenapiPetstore.Connection do that returns a bearer token. - `scopes_or_password`: a list of Strings represenging OAuth2 scopes, or a single string that is the password for the username provided. - - `options`: a keyword list of OpenAPIPetstore.Connection.options. + - `options`: a keyword list of OpenapiPetstore.Connection.options. ### Returns diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex index 8fab347fad94..28891b8013dd 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/nullable_class.ex @@ -29,12 +29,12 @@ defmodule OpenapiPetstore.Model.NullableClass do :string_prop => String.t | nil, :date_prop => Date.t | nil, :datetime_prop => DateTime.t | nil, - :array_nullable_prop => [map()] | nil, - :array_and_items_nullable_prop => [map()] | nil, - :array_items_nullable => [map()] | nil, - :object_nullable_prop => %{optional(String.t) => map()} | nil, - :object_and_items_nullable_prop => %{optional(String.t) => map()} | nil, - :object_items_nullable => %{optional(String.t) => map()} | nil + :array_nullable_prop => [%{optional(String.t) => any()}] | nil, + :array_and_items_nullable_prop => [%{optional(String.t) => any()}] | nil, + :array_items_nullable => [%{optional(String.t) => any()}] | nil, + :object_nullable_prop => %{optional(String.t) => any()} | nil, + :object_and_items_nullable_prop => %{optional(String.t) => any()} | nil, + :object_items_nullable => %{optional(String.t) => any()} | nil } alias OpenapiPetstore.Deserializer diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiClient.java index 15c1779d2276..cd9607c766da 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiClient.java @@ -19,7 +19,6 @@ import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; -import feign.hc5.ApacheHttp5Client; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -60,7 +59,6 @@ public class ApiClient { apiAuthorizations = new LinkedHashMap(); objectMapper = createObjectMapper(); feignBuilder = Feign.builder() - .client(new ApacheHttp5Client()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new ApiResponseDecoder(objectMapper)) .errorDecoder(new ApiErrorDecoder()) diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index c2937e93f0bc..4379c5b237a6 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -19,7 +19,6 @@ import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; -import feign.okhttp.OkHttpClient; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -59,7 +58,6 @@ public class ApiClient { apiAuthorizations = new LinkedHashMap(); objectMapper = createObjectMapper(); feignBuilder = Feign.builder() - .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new ApiResponseDecoder(objectMapper)) .errorDecoder(new ApiErrorDecoder()) diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java index 8353d63b90ce..cd9607c766da 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java @@ -19,7 +19,6 @@ import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; -import feign.okhttp.OkHttpClient; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -60,7 +59,6 @@ public class ApiClient { apiAuthorizations = new LinkedHashMap(); objectMapper = createObjectMapper(); feignBuilder = Feign.builder() - .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new ApiResponseDecoder(objectMapper)) .errorDecoder(new ApiErrorDecoder()) diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java index 3129a103c859..9b7f98bc488b 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java @@ -614,6 +614,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1152,6 +1153,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1182,22 +1199,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1296,8 +1297,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1318,6 +1321,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1327,8 +1335,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1420,4 +1426,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 3129a103c859..9b7f98bc488b 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -614,6 +614,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1152,6 +1153,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1182,22 +1199,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1296,8 +1297,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1318,6 +1321,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1327,8 +1335,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1420,4 +1426,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java index 5e6d65d63443..bde8c1f82823 100644 --- a/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey3-oneOf/src/main/java/org/openapitools/client/ApiClient.java @@ -473,6 +473,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1011,6 +1012,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1041,22 +1058,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1139,8 +1140,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1161,6 +1164,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1170,8 +1178,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1263,4 +1269,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java index efb7cda085e5..742027aa8bc8 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java @@ -696,6 +696,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1234,6 +1235,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + serializeToString(body, formParams, contentType, isBodyNullable), + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1264,22 +1281,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - serializeToString(body, formParams, contentType, isBodyNullable), - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1378,8 +1379,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1400,6 +1403,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1409,8 +1417,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1502,4 +1508,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/java/native-async/gradle.properties b/samples/client/petstore/java/native-async/gradle.properties index e69de29bb2d1..a3408578278a 100644 --- a/samples/client/petstore/java/native-async/gradle.properties +++ b/samples/client/petstore/java/native-async/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/native-jakarta/gradle.properties b/samples/client/petstore/java/native-jakarta/gradle.properties index e69de29bb2d1..a3408578278a 100644 --- a/samples/client/petstore/java/native-jakarta/gradle.properties +++ b/samples/client/petstore/java/native-jakarta/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/native/gradle.properties b/samples/client/petstore/java/native/gradle.properties index e69de29bb2d1..a3408578278a 100644 --- a/samples/client/petstore/java/native/gradle.properties +++ b/samples/client/petstore/java/native/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java index 477111bcd94a..d3a2450adb70 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java @@ -1006,17 +1006,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1025,17 +1016,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java index 43bd5d866792..a07ae7226562 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -158,6 +161,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java index 477111bcd94a..d3a2450adb70 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java @@ -1006,17 +1006,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1025,17 +1016,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java index 70968d44d7c1..4b5391a85918 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -211,6 +214,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java index d1e0c490c500..72acada3e0b2 100644 --- a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java @@ -1026,17 +1026,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1045,17 +1036,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/JSON.java index f993e935c7aa..2ba91e749c71 100644 --- a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -164,6 +167,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java index 675020d6dfdc..a0773b311e66 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java @@ -1011,17 +1011,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1030,17 +1021,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/JSON.java index 6d80edba2a7b..19fee2967447 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -239,6 +242,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java index 477111bcd94a..d3a2450adb70 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java @@ -1006,17 +1006,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1025,17 +1016,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/JSON.java index f993e935c7aa..2ba91e749c71 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -164,6 +167,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java index f9878faaf404..c60a00845859 100644 --- a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java @@ -1009,17 +1009,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1028,17 +1019,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/JSON.java index cc08e8c32f43..23cee891c1a0 100644 --- a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -166,6 +169,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java index b771e1be743f..1f9bfe3556f0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -1012,17 +1012,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1031,17 +1022,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java index 6d80edba2a7b..19fee2967447 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -239,6 +242,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java index 477111bcd94a..d3a2450adb70 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -1006,17 +1006,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1025,17 +1016,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/JSON.java index f993e935c7aa..2ba91e749c71 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -164,6 +167,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java index 477111bcd94a..d3a2450adb70 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java @@ -1006,17 +1006,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1025,17 +1016,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/JSON.java index f993e935c7aa..2ba91e749c71 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -164,6 +167,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index 1dd62fe798d9..c2b80fabbc03 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -1080,17 +1080,8 @@ public class ApiClient { return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -1099,17 +1090,25 @@ public class ApiClient { // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index 63cbe4695d17..0a0d4e1c4b71 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -27,8 +27,11 @@ import io.gsonfire.TypeSelector; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; @@ -402,6 +405,28 @@ public class JSON { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java index 765e7b71c77a..4552c01cca74 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java @@ -7,7 +7,9 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; +import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.text.DateFormat; @@ -274,13 +276,13 @@ public class JSONTest { assertEquals(t2.getName(), "tag test 1"); assertEquals(t2.getId(), null); - // with all required fields + // with all required fields String json3 = "{\"id\": 5847, \"name\":\"pet test 1\", \"photoUrls\": [\"https://a.com\", \"https://b.com\"]}"; Pet t3 = gson.fromJson(json3, Pet.class); assertEquals(t3.getName(), "pet test 1"); assertEquals(t3.getId(), Long.valueOf(5847)); - // with all required fields and tags (optional) + // with all required fields and tags (optional) String json4 = "{\"id\": 5847, \"name\":\"pet test 1\", \"photoUrls\": [\"https://a.com\", \"https://b.com\"],\"tags\":[{\"id\":\"tag 123\"}]}"; Pet t4 = gson.fromJson(json3, Pet.class); assertEquals(t4.getName(), "pet test 1"); @@ -671,4 +673,12 @@ public class JSONTest { assertTrue(exception.getMessage().contains("java.io.IOException: The JSON string is invalid for")); } } + + @Test + public void testDeserializeInputStream() throws Exception { + final String str = "\"2016-09-09\""; + final InputStream inputStream = new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8)); + final LocalDate date = LocalDate.of(2016, 9, 9); + assertEquals(date, json.deserialize(inputStream, LocalDate.class)); + } } diff --git a/samples/client/petstore/java/restclient-nullable-arrays/src/main/java/org/openapitools/client/model/ByteArrayObject.java b/samples/client/petstore/java/restclient-nullable-arrays/src/main/java/org/openapitools/client/model/ByteArrayObject.java index 182819500e4e..3433e3ce53e3 100644 --- a/samples/client/petstore/java/restclient-nullable-arrays/src/main/java/org/openapitools/client/model/ByteArrayObject.java +++ b/samples/client/petstore/java/restclient-nullable-arrays/src/main/java/org/openapitools/client/model/ByteArrayObject.java @@ -204,6 +204,7 @@ public class ByteArrayObject { this.intField = intField; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index b76f213803d4..254b1b44132e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -114,6 +114,7 @@ public class AdditionalPropertiesClass { this.mapOfMapProperty = mapOfMapProperty; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java index 899144ebff6a..e9ba36e09230 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java @@ -97,6 +97,7 @@ public class AllOfWithSingleRef { this.singleRefType = singleRefType; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Animal.java index 6961bea23a1e..a4d7f9e34d6e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Animal.java @@ -109,6 +109,7 @@ public class Animal { this.color = color; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 28c17b82e3c9..4aec892ed52a 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -77,6 +77,7 @@ public class ArrayOfArrayOfNumberOnly { this.arrayArrayNumber = arrayArrayNumber; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index d2317cddaa6e..d99ba656cb75 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -77,6 +77,7 @@ public class ArrayOfNumberOnly { this.arrayNumber = arrayNumber; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayTest.java index d59d74aff6a6..af9432aa6cf2 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -155,6 +155,7 @@ public class ArrayTest { this.arrayArrayOfModel = arrayArrayOfModel; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Capitalization.java index 06736234c84c..2c6ee20e8730 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Capitalization.java @@ -220,6 +220,7 @@ public class Capitalization { this.ATT_NAME = ATT_NAME; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Cat.java index 7f64775e9310..902c63264b8e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Cat.java @@ -76,6 +76,7 @@ public class Cat extends Animal { this.declawed = declawed; } + @Override public Cat className(@jakarta.annotation.Nonnull String className) { this.setClassName(className); diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Category.java index 3bf9e6ba18b2..1f2de25dc537 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Category.java @@ -96,6 +96,7 @@ public class Category { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ChildWithNullable.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ChildWithNullable.java index a200e9e71207..336cccfb0e24 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ChildWithNullable.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ChildWithNullable.java @@ -77,6 +77,7 @@ public class ChildWithNullable extends ParentWithNullable { this.otherProperty = otherProperty; } + @Override public ChildWithNullable type(@jakarta.annotation.Nullable TypeEnum type) { this.setType(type); diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ClassModel.java index 6594b8a81407..09ae9f364f2f 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ClassModel.java @@ -66,6 +66,7 @@ public class ClassModel { this.propertyClass = propertyClass; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Client.java index 08b47be84d82..4582db2b1af4 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Client.java @@ -65,6 +65,7 @@ public class Client { this.client = client; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/DeprecatedObject.java index ab553f556a59..587b0c29b521 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -67,6 +67,7 @@ public class DeprecatedObject { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Dog.java index d723acf0dfd3..1b7bb99c34ae 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Dog.java @@ -76,6 +76,7 @@ public class Dog extends Animal { this.breed = breed; } + @Override public Dog className(@jakarta.annotation.Nonnull String className) { this.setClassName(className); diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumArrays.java index 8d3e0ad4761d..9fed7b22275e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -177,6 +177,7 @@ public class EnumArrays { this.arrayEnum = arrayEnum; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java index 0b4febd30a42..9e5101274f88 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -443,6 +443,7 @@ public class EnumTest { this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java index 216131a443b3..2a61b3197851 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -108,6 +108,7 @@ public class FakeBigDecimalMap200Response { this.someMap = someMap; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index a2a533b8ca8e..6adfd0df7e3d 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -108,6 +108,7 @@ public class FileSchemaTestClass { this.files = files; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Foo.java index a87cc8312cd8..c3b3941d1dd8 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Foo.java @@ -65,6 +65,7 @@ public class Foo { this.bar = bar; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 7f366c2b6b92..55f418cd3a34 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -67,6 +67,7 @@ public class FooGetDefaultResponse { this.string = string; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FormatTest.java index 9fa53df387e2..b46128a53256 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/FormatTest.java @@ -546,6 +546,7 @@ public class FormatTest { this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 059ed484d17a..2a260cc71232 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -87,6 +87,7 @@ public class HasOnlyReadOnly { + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java index 25eb05c4adcc..3c87a8b4dd4d 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -78,6 +78,7 @@ public class HealthCheckResult { this.nullableMessage = JsonNullable.of(nullableMessage); } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MapTest.java index 02bdbf0e9179..8b80f184ccd8 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MapTest.java @@ -227,6 +227,7 @@ public class MapTest { this.indirectMap = indirectMap; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 658629f95904..5c16a88e22d9 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -140,6 +140,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { this.map = map; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Model200Response.java index 201305fe0cc8..cbfcebe93aaa 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Model200Response.java @@ -98,6 +98,7 @@ public class Model200Response { this.propertyClass = propertyClass; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java index de3da16b0bc5..9e19816c5b49 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -128,6 +128,7 @@ public class ModelApiResponse { this.message = message; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelFile.java index e896bb11b5fc..05d53391c98e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelFile.java @@ -67,6 +67,7 @@ public class ModelFile { this.sourceURI = sourceURI; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelList.java index afd9fd555e8a..c095cbcfc61f 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelList.java @@ -66,6 +66,7 @@ public class ModelList { this._123list = _123list; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelReturn.java index efab0f552d90..b06ff5c132fa 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -67,6 +67,7 @@ public class ModelReturn { this._return = _return; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Name.java index c8deac2d684b..6e52e8ffe8f3 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Name.java @@ -149,6 +149,7 @@ public class Name { + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java index b728b80401d2..48dd942d3875 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java @@ -13,6 +13,10 @@ package org.openapitools.client.model; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; @@ -54,7 +58,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") -public class NullableClass extends HashMap { +public class NullableClass { public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; @jakarta.annotation.Nullable private JsonNullable integerProp = JsonNullable.undefined(); @@ -104,7 +108,6 @@ public class NullableClass extends HashMap { private Map objectItemsNullable; public NullableClass() { - } public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerProp) { @@ -563,6 +566,50 @@ public class NullableClass extends HashMap { this.objectItemsNullable = objectItemsNullable; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public NullableClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -584,7 +631,7 @@ public class NullableClass extends HashMap { equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) && equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && - super.equals(o); + Objects.equals(this.additionalProperties, nullableClass.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -593,7 +640,7 @@ public class NullableClass extends HashMap { @Override public int hashCode() { - return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode()); + return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -607,7 +654,6 @@ public class NullableClass extends HashMap { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class NullableClass {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); @@ -620,6 +666,7 @@ public class NullableClass extends HashMap { sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NumberOnly.java index db64d2c453aa..dedff9898050 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -66,6 +66,7 @@ public class NumberOnly { this.justNumber = justNumber; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index c51ffd9aa205..53e44a01e808 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -177,6 +177,7 @@ public class ObjectWithDeprecatedFields { this.bars = bars; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Order.java index 70c28eab2d63..e5a72d5fbb5a 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Order.java @@ -258,6 +258,7 @@ public class Order { this.complete = complete; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterComposite.java index bb38603d6199..0ed4bfa03dc2 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -128,6 +128,7 @@ public class OuterComposite { this.myBoolean = myBoolean; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java index 5fe9a3405882..e9a36d8bcb18 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java @@ -66,6 +66,7 @@ public class OuterObjectWithEnumProperty { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 90608d1d29e1..eee749e2daa4 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -153,6 +153,7 @@ public class ParentWithNullable { this.nullableProperty = JsonNullable.of(nullableProperty); } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Pet.java index c51cfdbd0e9d..cd10615d92e2 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Pet.java @@ -282,6 +282,7 @@ public class Pet { this.status = status; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index b6726d56cc03..a9076bfb4d7e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -95,6 +95,7 @@ public class ReadOnlyFirst { this.baz = baz; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/SpecialModelName.java index facdb1dc752b..e5bf0397c168 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -66,6 +66,7 @@ public class SpecialModelName { this.$specialPropertyName = $specialPropertyName; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Tag.java index 56883c60ebd4..2e6ef805648a 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/Tag.java @@ -96,6 +96,7 @@ public class Tag { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index e6f40c01ceb9..e5b196c4771e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -13,6 +13,10 @@ package org.openapitools.client.model; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; @@ -21,8 +25,6 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.v3.oas.annotations.media.Schema; -import java.util.HashMap; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -34,13 +36,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName; }) @JsonTypeName("testInlineFreeformAdditionalProperties_request") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") -public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap { +public class TestInlineFreeformAdditionalPropertiesRequest { public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty"; @jakarta.annotation.Nullable private String someProperty; public TestInlineFreeformAdditionalPropertiesRequest() { - } public TestInlineFreeformAdditionalPropertiesRequest someProperty(@jakarta.annotation.Nullable String someProperty) { @@ -69,6 +70,50 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public TestInlineFreeformAdditionalPropertiesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -79,20 +124,20 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMapof(nullableMessage); } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MapTest.java index 1c1faf293b63..37b4b8ab0534 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MapTest.java @@ -222,6 +222,7 @@ public class MapTest { this.indirectMap = indirectMap; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 8d2192b55888..44989079af56 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -136,6 +136,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { this.map = map; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Model200Response.java index 8b2f988e73ad..0d7e33e689d8 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Model200Response.java @@ -94,6 +94,7 @@ public class Model200Response { this.propertyClass = propertyClass; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ce7319bf809e..906c779a9463 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -124,6 +124,7 @@ public class ModelApiResponse { this.message = message; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelFile.java index 942c8ffced2b..121184edefe7 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelFile.java @@ -64,6 +64,7 @@ public class ModelFile { this.sourceURI = sourceURI; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelList.java index 8d69575c669c..9edd6c3af92c 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelList.java @@ -64,6 +64,7 @@ public class ModelList { this._123list = _123list; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelReturn.java index c23b56609afd..3d34003aa76f 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -64,6 +64,7 @@ public class ModelReturn { this._return = _return; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Name.java index f43a96ccb6b4..0a5893c68eb6 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Name.java @@ -143,6 +143,7 @@ public class Name { + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java index b9b4dff62870..cd7720c77a2a 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java @@ -13,6 +13,10 @@ package org.openapitools.client.model; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; @@ -53,7 +57,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") -public class NullableClass extends HashMap { +public class NullableClass { public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; @jakarta.annotation.Nullable private JsonNullable integerProp = JsonNullable.undefined(); @@ -103,7 +107,6 @@ public class NullableClass extends HashMap { private Map objectItemsNullable = new HashMap<>(); public NullableClass() { - } public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerProp) { @@ -550,6 +553,50 @@ public class NullableClass extends HashMap { this.objectItemsNullable = objectItemsNullable; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public NullableClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -571,7 +618,7 @@ public class NullableClass extends HashMap { equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) && equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && - super.equals(o); + Objects.equals(this.additionalProperties, nullableClass.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -580,7 +627,7 @@ public class NullableClass extends HashMap { @Override public int hashCode() { - return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode()); + return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -594,7 +641,6 @@ public class NullableClass extends HashMap { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class NullableClass {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); @@ -607,6 +653,7 @@ public class NullableClass extends HashMap { sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NumberOnly.java index d08ace18e881..2a5a8ce402cd 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -64,6 +64,7 @@ public class NumberOnly { this.justNumber = justNumber; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index a86ef6439426..e57217ff8558 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -172,6 +172,7 @@ public class ObjectWithDeprecatedFields { this.bars = bars; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java index b2447ba61b13..a56e4ae44164 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Order.java @@ -251,6 +251,7 @@ public class Order { this.complete = complete; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterComposite.java index 2a671305cc95..b7c13c4419c3 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -124,6 +124,7 @@ public class OuterComposite { this.myBoolean = myBoolean; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java index 3344e37f2645..b8a916d18bc9 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java @@ -64,6 +64,7 @@ public class OuterObjectWithEnumProperty { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 5c13648a7c28..b73a8442f484 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -150,6 +150,7 @@ public class ParentWithNullable { this.nullableProperty = JsonNullable.of(nullableProperty); } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java index 9d7c0474c81d..72970e8e30e8 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Pet.java @@ -275,6 +275,7 @@ public class Pet { this.status = status; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 853c6cf7dc52..c0c19abefdc2 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -92,6 +92,7 @@ public class ReadOnlyFirst { this.baz = baz; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/SpecialModelName.java index 1c2d80cdc2a9..165ddaf59557 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -64,6 +64,7 @@ public class SpecialModelName { this.$specialPropertyName = $specialPropertyName; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java index 829ffea7bbf9..8cd92ee44667 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/Tag.java @@ -93,6 +93,7 @@ public class Tag { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index 9ceeaef529fd..ac4219746a5b 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -13,6 +13,10 @@ package org.openapitools.client.model; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; @@ -20,8 +24,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import java.util.HashMap; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -33,13 +35,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName; }) @JsonTypeName("testInlineFreeformAdditionalProperties_request") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") -public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap { +public class TestInlineFreeformAdditionalPropertiesRequest { public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty"; @jakarta.annotation.Nullable private String someProperty; public TestInlineFreeformAdditionalPropertiesRequest() { - } public TestInlineFreeformAdditionalPropertiesRequest someProperty(@jakarta.annotation.Nullable String someProperty) { @@ -67,6 +68,50 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public TestInlineFreeformAdditionalPropertiesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -77,20 +122,20 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMapof(nullableMessage); } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MapTest.java index ec11b3125994..f37625f42c12 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MapTest.java @@ -222,6 +222,7 @@ public class MapTest { this.indirectMap = indirectMap; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 190f20d0f81a..419c506badec 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -136,6 +136,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { this.map = map; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Model200Response.java index 8b2f988e73ad..0d7e33e689d8 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Model200Response.java @@ -94,6 +94,7 @@ public class Model200Response { this.propertyClass = propertyClass; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ce7319bf809e..906c779a9463 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -124,6 +124,7 @@ public class ModelApiResponse { this.message = message; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelFile.java index 942c8ffced2b..121184edefe7 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelFile.java @@ -64,6 +64,7 @@ public class ModelFile { this.sourceURI = sourceURI; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelList.java index 8d69575c669c..9edd6c3af92c 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelList.java @@ -64,6 +64,7 @@ public class ModelList { this._123list = _123list; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelReturn.java index c23b56609afd..3d34003aa76f 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -64,6 +64,7 @@ public class ModelReturn { this._return = _return; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Name.java index f43a96ccb6b4..0a5893c68eb6 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Name.java @@ -143,6 +143,7 @@ public class Name { + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java index d72693492a7f..7c55f5199ed5 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java @@ -13,6 +13,10 @@ package org.openapitools.client.model; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; @@ -53,7 +57,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") -public class NullableClass extends HashMap { +public class NullableClass { public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; @jakarta.annotation.Nullable private JsonNullable integerProp = JsonNullable.undefined(); @@ -103,7 +107,6 @@ public class NullableClass extends HashMap { private Map objectItemsNullable; public NullableClass() { - } public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerProp) { @@ -550,6 +553,50 @@ public class NullableClass extends HashMap { this.objectItemsNullable = objectItemsNullable; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public NullableClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -571,7 +618,7 @@ public class NullableClass extends HashMap { equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) && equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && - super.equals(o); + Objects.equals(this.additionalProperties, nullableClass.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -580,7 +627,7 @@ public class NullableClass extends HashMap { @Override public int hashCode() { - return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode()); + return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -594,7 +641,6 @@ public class NullableClass extends HashMap { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class NullableClass {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); @@ -607,6 +653,7 @@ public class NullableClass extends HashMap { sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NumberOnly.java index d08ace18e881..2a5a8ce402cd 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -64,6 +64,7 @@ public class NumberOnly { this.justNumber = justNumber; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 35014d0ccc6a..fcaa62fedc68 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -172,6 +172,7 @@ public class ObjectWithDeprecatedFields { this.bars = bars; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Order.java index b2447ba61b13..a56e4ae44164 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Order.java @@ -251,6 +251,7 @@ public class Order { this.complete = complete; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterComposite.java index 2a671305cc95..b7c13c4419c3 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -124,6 +124,7 @@ public class OuterComposite { this.myBoolean = myBoolean; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java index 3344e37f2645..b8a916d18bc9 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java @@ -64,6 +64,7 @@ public class OuterObjectWithEnumProperty { this.value = value; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 5c13648a7c28..b73a8442f484 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -150,6 +150,7 @@ public class ParentWithNullable { this.nullableProperty = JsonNullable.of(nullableProperty); } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Pet.java index 77ae32aae946..616e1a1a0804 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Pet.java @@ -275,6 +275,7 @@ public class Pet { this.status = status; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 853c6cf7dc52..c0c19abefdc2 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -92,6 +92,7 @@ public class ReadOnlyFirst { this.baz = baz; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/SpecialModelName.java index 1c2d80cdc2a9..165ddaf59557 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -64,6 +64,7 @@ public class SpecialModelName { this.$specialPropertyName = $specialPropertyName; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Tag.java index 829ffea7bbf9..8cd92ee44667 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/Tag.java @@ -93,6 +93,7 @@ public class Tag { this.name = name; } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index 9ceeaef529fd..ac4219746a5b 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -13,6 +13,10 @@ package org.openapitools.client.model; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import java.util.Objects; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; @@ -20,8 +24,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import java.util.HashMap; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -33,13 +35,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName; }) @JsonTypeName("testInlineFreeformAdditionalProperties_request") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") -public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap { +public class TestInlineFreeformAdditionalPropertiesRequest { public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty"; @jakarta.annotation.Nullable private String someProperty; public TestInlineFreeformAdditionalPropertiesRequest() { - } public TestInlineFreeformAdditionalPropertiesRequest someProperty(@jakarta.annotation.Nullable String someProperty) { @@ -67,6 +68,50 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * @param key the name of the property + * @param value the value of the property + * @return self reference + */ + @JsonAnySetter + public TestInlineFreeformAdditionalPropertiesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) properties. + * @return the additional (undeclared) properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * @param key the name of the property + * @return the additional (undeclared) property with the specified name + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -77,20 +122,20 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap + org.openapitools + petstore-vertx-supportvertxfuture + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-vertx-supportvertxfuture' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-vertx-supportvertxfuture' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-vertx-supportvertxfuture:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/petstore-vertx-supportvertxfuture-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class AnotherFakeApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | +*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +*FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | +*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testInlineFreeformAdditionalProperties**](docs/FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testNullable**](docs/FakeApi.md#testNullable) | **POST** /fake/nullable | test nullable parent property +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeApi* | [**testStringMapReference**](docs/FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfWithSingleRef](docs/AllOfWithSingleRef.md) + - [Animal](docs/Animal.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ChildWithNullable](docs/ChildWithNullable.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NullableClass](docs/NullableClass.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md) + - [ParentWithNullable](docs/ParentWithNullable.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SingleRefType](docs/SingleRefType.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + + +- **Type**: HTTP basic authentication + + +### bearer_test + + +- **Type**: HTTP Bearer Token authentication (JWT) + + +### http_signature_test + + +- **Type**: HTTP signature authentication + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml b/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml new file mode 100644 index 000000000000..1eddf878948c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/api/openapi.yaml @@ -0,0 +1,2363 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_varaible +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/_foo_get_default_response' + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + put: + description: "" + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + description: Successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-webclient-blocking: true + x-content-type: application/json + x-accepts: + - application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + - description: test server with variables + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + description: target server + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + uniqueItems: true + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + uniqueItems: true + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + description: Successful operation + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-webclient-blocking: false + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + - explode: true + in: query + name: enum_query_model_array + required: false + schema: + items: + $ref: '#/components/schemas/EnumClass' + type: array + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEnumParameters_request' + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEndpointParameters_request' + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/property/enum-int: + post: + description: Test serialization of enum (int) properties with examples + operationId: fakePropertyEnumIntegerSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterObjectWithEnumProperty' + description: Input enum (int) as post body + required: true + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterObjectWithEnumProperty' + description: Output enum (int) + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: + - '*/*' + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testJsonFormData_request' + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapOfString' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/testInlineFreeformAdditionalProperties_request' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/nullable: + post: + description: "" + operationId: testNullable + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChildWithNullable' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test nullable parent property + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request must reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-binary: + put: + description: "For this test, the body has to be a binary file." + operationId: testBodyWithBinary + requestBody: + content: + image/png: + schema: + format: binary + nullable: true + type: string + description: image to upload + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: image/png + x-accepts: + - application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: pipeDelimited + - explode: false + in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: language + required: false + schema: + additionalProperties: + format: string + type: string + type: object + style: form + - allowEmptyValue: true + explode: true + in: query + name: allowEmpty + required: true + schema: + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFileWithRequiredFile_request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + x-accepts: + - application/json + /fake/http-signature-test: + get: + operationId: fake-http-signature-test + parameters: + - description: query parameter + explode: true + in: query + name: query_1 + required: false + schema: + type: string + style: form + - description: header parameter + explode: false + in: header + name: header_1 + required: false + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + description: The instance started successfully + security: + - http_signature_test: [] + summary: test http signature authentication + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + xml: + name: photoUrl + type: array + uniqueItems: true + xml: + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + outerEnumInteger: + $ref: '#/components/schemas/OuterEnumInteger' + outerEnumDefaultValue: + $ref: '#/components/schemas/OuterEnumDefaultValue' + outerEnumIntegerDefaultValue: + $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + maxItems: 3 + minItems: 0 + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + example: 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_string: my_string + my_number: 0.8008281904610115 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + ParentWithNullable: + discriminator: + propertyName: type + properties: + type: + enum: + - ChildWithNullable + type: string + nullableProperty: + nullable: true + type: string + type: object + ChildWithNullable: + allOf: + - $ref: '#/components/schemas/ParentWithNullable' + - properties: + otherProperty: + type: string + type: object + example: + otherProperty: otherProperty + nullableProperty: nullableProperty + type: ChildWithNullable + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object + OuterObjectWithEnumProperty: + example: + value: 2 + properties: + value: + $ref: '#/components/schemas/OuterEnumInteger' + required: + - value + type: object + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: '#/components/schemas/DeprecatedObject' + bars: + deprecated: true + items: + $ref: '#/components/schemas/Bar' + type: array + type: object + AllOfWithSingleRef: + properties: + username: + type: string + SingleRefType: + allOf: + - $ref: '#/components/schemas/SingleRefType' + type: object + SingleRefType: + enum: + - admin + - user + title: SingleRefType + type: string + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/build.gradle b/samples/client/petstore/java/vertx-supportVertxFuture/build.gradle new file mode 100644 index 000000000000..727922775400 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/build.gradle @@ -0,0 +1,54 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-vertx-supportvertxfuture' + from components.java + } + } +} + +task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + swagger_annotations_version = "1.5.21" + jackson_version = "2.17.1" + jackson_databind_version = "2.17.1" + vertx_version = "4.0.0" + junit_version = "5.10.3" + jackson_databind_nullable_version = "0.2.6" + jakarta_annotation_version = "1.3.5" +} + +dependencies { + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "io.vertx:vertx-web-client:$vertx_version" + implementation "io.vertx:vertx-rx-java:$vertx_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" + testImplementation "io.vertx:vertx-unit:$vertx_version" +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/build.sbt b/samples/client/petstore/java/vertx-supportVertxFuture/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..fe69a56eebf4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/AdditionalPropertiesClass.md @@ -0,0 +1,14 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapProperty** | **Map<String, String>** | | [optional] | +|**mapOfMapProperty** | **Map<String, Map<String, String>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/AllOfWithSingleRef.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4146d56a372b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/AllOfWithSingleRef.md @@ -0,0 +1,14 @@ + + +# AllOfWithSingleRef + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**username** | **String** | | [optional] | +|**singleRefType** | **SingleRefType** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Animal.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/AnotherFakeApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..73c966d2d549 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/AnotherFakeApi.md @@ -0,0 +1,75 @@ +# 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 | + + + +## call123testSpecialTags + +> Client call123testSpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0188db3eb131 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..a5753530aada --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayTest.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayTest.md new file mode 100644 index 000000000000..36077c9df300 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ArrayTest.md @@ -0,0 +1,15 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Capitalization.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Capitalization.md new file mode 100644 index 000000000000..82a812711de2 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Capitalization.md @@ -0,0 +1,18 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Cat.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Category.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Category.md new file mode 100644 index 000000000000..ab6d1ec334dc --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ChildWithNullable.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ChildWithNullable.md new file mode 100644 index 000000000000..73c0dd6d4737 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ChildWithNullable.md @@ -0,0 +1,13 @@ + + +# ChildWithNullable + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**otherProperty** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ClassModel.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ClassModel.md new file mode 100644 index 000000000000..af46dea1f6c8 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ClassModel.md @@ -0,0 +1,14 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Client.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Client.md new file mode 100644 index 000000000000..ef07b4ab8b9d --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Client.md @@ -0,0 +1,13 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/DefaultApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/DefaultApi.md new file mode 100644 index 000000000000..2c56e1f90e54 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/DefaultApi.md @@ -0,0 +1,69 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | | + + + +## fooGet + +> FooGetDefaultResponse fooGet() + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FooGetDefaultResponse result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/DeprecatedObject.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/DeprecatedObject.md new file mode 100644 index 000000000000..48de1d624425 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/DeprecatedObject.md @@ -0,0 +1,13 @@ + + +# DeprecatedObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Dog.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/EnumArrays.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/EnumArrays.md new file mode 100644 index 000000000000..b2222d5beb25 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/EnumArrays.md @@ -0,0 +1,32 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## 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/vertx-supportVertxFuture/docs/EnumClass.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/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/vertx-supportVertxFuture/docs/EnumTest.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/EnumTest.md new file mode 100644 index 000000000000..380a2aef0bc3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/EnumTest.md @@ -0,0 +1,58 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | +|**outerEnumInteger** | **OuterEnumInteger** | | [optional] | +|**outerEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] | +|**outerEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] | + + + +## 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/vertx-supportVertxFuture/docs/FakeApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeApi.md new file mode 100644 index 000000000000..22cff7dd2e8a --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeApi.md @@ -0,0 +1,1541 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | +| [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | +| [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | +| [**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 | | +| [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**testBodyWithBinary**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | | +| [**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 | +| [**testInlineFreeformAdditionalProperties**](FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testNullable**](FakeApi.md#testNullable) | **POST** /fake/nullable | test nullable parent property | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | +| [**testStringMapReference**](FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map | + + + +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## fakeHealthGet + +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + HealthCheckResult result = apiInstance.fakeHealthGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeHealthGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +## fakeHttpSignatureTest + +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + + FakeApi apiInstance = new FakeApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + String query1 = "query1_example"; // String | query parameter + String header1 = "header1_example"; // String | header parameter + try { + apiInstance.fakeHttpSignatureTest(pet, query1, header1); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeHttpSignatureTest"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | +| **query1** | **String**| query parameter | [optional] | +| **header1** | **String**| header parameter | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +## fakeOuterBooleanSerialize + +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +## fakeOuterCompositeSerialize + +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +## fakeOuterNumberSerialize + +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +## fakeOuterStringSerialize + +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +## fakePropertyEnumIntegerSerialize + +> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + + + +Test serialization of enum (int) properties with examples + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + OuterObjectWithEnumProperty outerObjectWithEnumProperty = new OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body + try { + OuterObjectWithEnumProperty result = apiInstance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakePropertyEnumIntegerSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output enum (int) | - | + + +## testAdditionalPropertiesReference + +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Map requestBody = null; // Map | request body + try { + apiInstance.testAdditionalPropertiesReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testBodyWithBinary + +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + AsyncFile body = new AsyncFile(); // AsyncFile | image to upload + try { + apiInstance.testBodyWithBinary(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithBinary"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **AsyncFile**| image to upload | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: image/png +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testBodyWithFileSchema + +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testBodyWithQueryParams + +> testBodyWithQueryParams(query, user) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User user = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, user); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **user** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testClientModel + +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testEndpointParameters + +> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + AsyncFile binary = new AsyncFile(); // AsyncFile | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **AsyncFile**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## testEnumParameters + +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumQueryModelArray = Arrays.asList(-efg); // List | + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumQueryModelArray** | [**List<EnumClass>**](EnumClass.md)| | [optional] | +| **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +## testGroupParameters + +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + + +## testInlineAdditionalProperties + +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testInlineFreeformAdditionalProperties + +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + try { + apiInstance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineFreeformAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testJsonFormData + +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testNullable + +> testNullable(childWithNullable) + +test nullable parent property + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + ChildWithNullable childWithNullable = new ChildWithNullable(); // ChildWithNullable | request body + try { + apiInstance.testNullable(childWithNullable); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testNullable"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testQueryParameterCollectionFormat + +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) + + + +To test the collection format in query parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + String allowEmpty = "allowEmpty_example"; // String | + Map language = new HashMap(); // Map | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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)| | | +| **allowEmpty** | **String**| | | +| **language** | [**Map<String, String>**](String.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testStringMapReference + +> testStringMapReference(requestBody) + +test referenced string map + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testStringMapReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testStringMapReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 000000000000..475be1d2d738 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..e4ff70ed909b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FakeClassnameTags123Api.md @@ -0,0 +1,82 @@ +# 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 | + + + +## testClassname + +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/FileSchemaTestClass.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..85d1a0636694 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FileSchemaTestClass.md @@ -0,0 +1,14 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Foo.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Foo.md new file mode 100644 index 000000000000..6b3f0556528a --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Foo.md @@ -0,0 +1,13 @@ + + +# Foo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FooGetDefaultResponse.md new file mode 100644 index 000000000000..ff3d7a3a56c3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/FormatTest.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FormatTest.md new file mode 100644 index 000000000000..42278d0f3953 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/FormatTest.md @@ -0,0 +1,28 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**decimal** | **BigDecimal** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **AsyncFile** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**password** | **String** | | | +|**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] | +|**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..29da5205dbba --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/HasOnlyReadOnly.md @@ -0,0 +1,14 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/HealthCheckResult.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/HealthCheckResult.md new file mode 100644 index 000000000000..4885e6f1cada --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/HealthCheckResult.md @@ -0,0 +1,14 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nullableMessage** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/MapTest.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/MapTest.md new file mode 100644 index 000000000000..54380188e1d6 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/MapTest.md @@ -0,0 +1,25 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..a5ddf0faa6a9 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,15 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Model200Response.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Model200Response.md new file mode 100644 index 000000000000..109411580c62 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Model200Response.md @@ -0,0 +1,15 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelApiResponse.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelApiResponse.md new file mode 100644 index 000000000000..e374c2dd2dec --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelFile.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelFile.md new file mode 100644 index 000000000000..adcde984f527 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelFile.md @@ -0,0 +1,14 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelList.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelList.md new file mode 100644 index 000000000000..f93ab7dde8d4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelList.md @@ -0,0 +1,13 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelReturn.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelReturn.md new file mode 100644 index 000000000000..0bd356861eb7 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ModelReturn.md @@ -0,0 +1,14 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Name.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Name.md new file mode 100644 index 000000000000..c901d9435309 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Name.md @@ -0,0 +1,17 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/NullableClass.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/NullableClass.md new file mode 100644 index 000000000000..fa98c5c6d984 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/NullableClass.md @@ -0,0 +1,24 @@ + + +# NullableClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | [optional] | +|**numberProp** | **BigDecimal** | | [optional] | +|**booleanProp** | **Boolean** | | [optional] | +|**stringProp** | **String** | | [optional] | +|**dateProp** | **LocalDate** | | [optional] | +|**datetimeProp** | **OffsetDateTime** | | [optional] | +|**arrayNullableProp** | **List<Object>** | | [optional] | +|**arrayAndItemsNullableProp** | **List<Object>** | | [optional] | +|**arrayItemsNullable** | **List<Object>** | | [optional] | +|**objectNullableProp** | **Map<String, Object>** | | [optional] | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] | +|**objectItemsNullable** | **Map<String, Object>** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/NumberOnly.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/NumberOnly.md new file mode 100644 index 000000000000..b8ed1a4cfae1 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/NumberOnly.md @@ -0,0 +1,13 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..f1cf571f4c09 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,16 @@ + + +# ObjectWithDeprecatedFields + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **String** | | [optional] | +|**id** | **BigDecimal** | | [optional] | +|**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] | +|**bars** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Order.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Order.md new file mode 100644 index 000000000000..27af32855c5c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterComposite.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterComposite.md new file mode 100644 index 000000000000..98b56e0763ff --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterComposite.md @@ -0,0 +1,15 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnum.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnum.md new file mode 100644 index 000000000000..1f9b723eb8e7 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/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/vertx-supportVertxFuture/docs/OuterEnumDefaultValue.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumInteger.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterObjectWithEnumProperty.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..0fafaaa27154 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/OuterObjectWithEnumProperty.md @@ -0,0 +1,13 @@ + + +# OuterObjectWithEnumProperty + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | **OuterEnumInteger** | | | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ParentWithNullable.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ParentWithNullable.md new file mode 100644 index 000000000000..e4d322985632 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ParentWithNullable.md @@ -0,0 +1,22 @@ + + +# ParentWithNullable + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**nullableProperty** | **String** | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| CHILD_WITH_NULLABLE | "ChildWithNullable" | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Pet.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Pet.md new file mode 100644 index 000000000000..54af77a9f5a7 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **Set<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md new file mode 100644 index 000000000000..115d5ff89d81 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/PetApi.md @@ -0,0 +1,678 @@ +# 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) | + + + +## addPet + +> addPet(pet) + +Add a new pet to the store + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +## findPetsByTags + +> Set<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Set tags = Arrays.asList(); // Set | Tags to filter by + try { + Set result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**Set<String>**](String.md)| Tags to filter by | | + +### Return type + +[**Set<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +## updatePet + +> updatePet(pet) + +Update an existing pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | +| **405** | Invalid input | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + AsyncFile _file = new AsyncFile(); // AsyncFile | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **AsyncFile**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## uploadFileWithRequiredFile + +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + AsyncFile requiredFile = new AsyncFile(); // AsyncFile | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **AsyncFile**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/ReadOnlyFirst.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ad6af7ee155f --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/ReadOnlyFirst.md @@ -0,0 +1,14 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/SingleRefType.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/SingleRefType.md new file mode 100644 index 000000000000..cc269bb871fd --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/SingleRefType.md @@ -0,0 +1,13 @@ + + +# SingleRefType + +## Enum + + +* `ADMIN` (value: `"admin"`) + +* `USER` (value: `"user"`) + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/SpecialModelName.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/SpecialModelName.md new file mode 100644 index 000000000000..4b6a06e36224 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/SpecialModelName.md @@ -0,0 +1,13 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/StoreApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/StoreApi.md new file mode 100644 index 000000000000..ce91137cc6f4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/StoreApi.md @@ -0,0 +1,282 @@ +# 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 | + + + +## deleteOrder + +> 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 + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## getInventory + +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +## placeOrder + +> Order placeOrder(order) + +Place an order for a pet + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/Tag.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..dc066e6c7dac --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,13 @@ + + +# TestInlineFreeformAdditionalPropertiesRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someProperty** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/User.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/User.md new file mode 100644 index 000000000000..08813e4b10b4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/User.md @@ -0,0 +1,20 @@ + + +# User + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/docs/UserApi.md b/samples/client/petstore/java/vertx-supportVertxFuture/docs/UserApi.md new file mode 100644 index 000000000000..305fd6e66dfb --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/docs/UserApi.md @@ -0,0 +1,543 @@ +# 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 | + + + +## createUser + +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> logoutUser() + +Logs out current logged in user session + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/git_push.sh b/samples/client/petstore/java/vertx-supportVertxFuture/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + 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/samples/client/petstore/java/vertx-supportVertxFuture/gradle.properties b/samples/client/petstore/java/vertx-supportVertxFuture/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/vertx-supportVertxFuture/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/client/petstore/java/vertx-supportVertxFuture/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/vertx-supportVertxFuture/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..b82aa23a4f05 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/gradlew b/samples/client/petstore/java/vertx-supportVertxFuture/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/gradlew.bat b/samples/client/petstore/java/vertx-supportVertxFuture/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +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% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/pom.xml b/samples/client/petstore/java/vertx-supportVertxFuture/pom.xml new file mode 100644 index 000000000000..377b73d7a0bb --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/pom.xml @@ -0,0 +1,279 @@ + + 4.0.0 + org.openapitools + petstore-vertx-supportvertxfuture + jar + petstore-vertx-supportvertxfuture + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.2 + + none + 1.8 + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + + io.vertx + vertx-rx-java + ${vertx-version} + + + io.vertx + vertx-web-client + ${vertx-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + + org.junit.jupiter + junit-jupiter-api + ${junit-version} + test + + + io.vertx + vertx-unit + ${vertx-version} + test + + + + + UTF-8 + 4.0.0 + 2.17.1 + 2.17.1 + 0.2.6 + 1.3.5 + 5.10.3 + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/settings.gradle b/samples/client/petstore/java/vertx-supportVertxFuture/settings.gradle new file mode 100644 index 000000000000..26efaf9b6c73 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-vertx-supportvertxfuture" \ No newline at end of file diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/AndroidManifest.xml b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..612c5e9b6971 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,751 @@ +/* + * 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.client; + +import org.openapitools.client.auth.Authentication; +import org.openapitools.client.auth.HttpBasicAuth; +import org.openapitools.client.auth.HttpBearerAuth; +import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.jackson.nullable.JsonNullableModule; +import io.vertx.core.*; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.file.AsyncFile; +import io.vertx.core.file.FileSystem; +import io.vertx.core.file.OpenOptions; +import io.vertx.core.http.HttpHeaders; +import io.vertx.core.http.HttpMethod; +import io.vertx.core.json.DecodeException; +import io.vertx.core.json.Json; +import io.vertx.core.json.JsonObject; +import io.vertx.ext.web.client.HttpRequest; +import io.vertx.ext.web.client.HttpResponse; +import io.vertx.ext.web.client.WebClient; +import io.vertx.ext.web.client.WebClientOptions; + +import java.time.OffsetDateTime; +import java.text.DateFormat; +import java.util.*; +import java.util.function.Consumer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static java.util.stream.Collectors.toMap; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ApiClient extends JavaTimeFormatter { + + private static final Pattern CONTENT_DISPOSITION_PATTERN = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + private static final OpenOptions FILE_DOWNLOAD_OPTIONS = new OpenOptions().setCreate(true).setTruncateExisting(true); + + private final Vertx vertx; + private final JsonObject config; + private final String identifier; + + private MultiMap defaultHeaders = MultiMap.caseInsensitiveMultiMap(); + private MultiMap defaultCookies = MultiMap.caseInsensitiveMultiMap(); + private Map authentications; + private String basePath = "http://petstore.swagger.io:80/v2"; + private DateFormat dateFormat; + private ObjectMapper objectMapper; + private String downloadsDir = ""; + private int timeout = -1; + + public ApiClient(Vertx vertx, JsonObject config) { + Objects.requireNonNull(vertx, "Vertx must not be null"); + Objects.requireNonNull(config, "Config must not be null"); + + this.vertx = vertx; + + // Use RFC3339 format for date and datetime. + // See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 + this.dateFormat = new RFC3339DateFormat(); + + // Use UTC as the default time zone. + this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + + // Build object mapper + this.objectMapper = new ObjectMapper(); + this.objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + this.objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + this.objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + this.objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + this.objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + this.objectMapper.registerModule(new JavaTimeModule()); + this.objectMapper.setDateFormat(dateFormat); + JsonNullableModule jnm = new JsonNullableModule(); + this.objectMapper.registerModule(jnm); + + // Setup authentications (key: authentication name, value: authentication). + this.authentications = new HashMap<>(); + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + this.authentications = Collections.unmodifiableMap(authentications); + + // Configurations + this.basePath = config.getString("basePath", this.basePath); + this.downloadsDir = config.getString("downloadsDir", this.downloadsDir); + this.config = config; + this.identifier = UUID.randomUUID().toString(); + this.timeout = config.getInteger("timeout", -1); + } + + public Vertx getVertx() { + return vertx; + } + + public ObjectMapper getObjectMapper() { + return objectMapper; + } + + public ApiClient setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + return this; + } + + public synchronized WebClient getWebClient() { + String webClientIdentifier = "web-client-" + identifier; + WebClient webClient = this.vertx.getOrCreateContext().get(webClientIdentifier); + if (webClient == null) { + webClient = buildWebClient(vertx, config); + this.vertx.getOrCreateContext().put(webClientIdentifier, webClient); + } + return webClient; + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + public String getDownloadsDir() { + return downloadsDir; + } + + public ApiClient setDownloadsDir(String downloadsDir) { + this.downloadsDir = downloadsDir; + return this; + } + + public MultiMap getDefaultHeaders() { + return defaultHeaders; + } + + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaders.add(key, value); + return this; + } + + public MultiMap getDefaultCookies() { + return defaultHeaders; + } + + public ApiClient addDefaultCookie(String key, String value) { + defaultCookies.add(key, value); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication object + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public ApiClient setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return this; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public ApiClient setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public ApiClient setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public ApiClient setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public ApiClient setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Format the given Date object into string. + * + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof OffsetDateTime) { + return formatOffsetDateTime((OffsetDateTime) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List parameterToPairs(String collectionFormat, String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()) { + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + return params; + } + + String delimiter = ","; + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder(); + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * + * @param mime MIME + * @return True if the MIME type is JSON + */ + private boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + protected String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + protected String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + public void sendBody(HttpRequest request, + Handler>> responseHandler, + Object body) { + if (body instanceof byte[]) { + Buffer buffer = Buffer.buffer((byte[]) body); + request.sendBuffer(buffer, responseHandler); + } else if (body instanceof AsyncFile) { + AsyncFile file = (AsyncFile) body; + request.sendStream(file, responseHandler); + } else { + try { + request.sendBuffer(Buffer.buffer(this.objectMapper.writeValueAsBytes(body)), responseHandler); + } catch (JsonProcessingException jsonProcessingException) { + responseHandler.handle(Future.failedFuture(jsonProcessingException)); + } + } + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param Type + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accepts The request's Accept headers + * @param contentTypes The request's Content-Type headers + * @param authNames The authentications to apply + * @param authInfo The call specific auth override + * @param returnType The return type into which to deserialize the response + * @param resultHandler The asynchronous response handler + */ + public void invokeAPI(String path, String method, List queryParams, Object body, MultiMap headerParams, + MultiMap cookieParams, Map formParams, String[] accepts, String[] contentTypes, String[] authNames, AuthInfo authInfo, + TypeReference returnType, Handler> resultHandler) { + + updateParamsForAuth(authNames, authInfo, queryParams, headerParams, cookieParams); + + if (accepts != null && accepts.length > 0) { + headerParams.add(HttpHeaders.ACCEPT, selectHeaderAccept(accepts)); + } + + if (contentTypes != null) { + headerParams.add(HttpHeaders.CONTENT_TYPE, selectHeaderContentType(contentTypes)); + } + + HttpMethod httpMethod = HttpMethod.valueOf(method); + HttpRequest request = getWebClient().requestAbs(httpMethod, basePath + path); + request.timeout(this.timeout); + + if (httpMethod == HttpMethod.PATCH) { + request.putHeader("X-HTTP-Method-Override", "PATCH"); + } + + queryParams.forEach(entry -> { + if (entry.getValue() != null) { + request.addQueryParam(entry.getName(), entry.getValue()); + } + }); + + headerParams.forEach(entry -> { + if (entry.getValue() != null) { + request.putHeader(entry.getKey(), entry.getValue()); + } + }); + + defaultHeaders.forEach(entry -> { + if (entry.getValue() != null) { + request.putHeader(entry.getKey(), entry.getValue()); + } + }); + + final MultiMap cookies = MultiMap.caseInsensitiveMultiMap().addAll(cookieParams).addAll(defaultCookies); + request.putHeader("Cookie", buildCookieHeader(cookies)); + + Handler>> responseHandler = buildResponseHandler(returnType, resultHandler); + if (body != null) { + sendBody(request, responseHandler, body); + } else if (formParams != null && !formParams.isEmpty()) { + Map formMap = formParams.entrySet().stream().collect(toMap(Map.Entry::getKey, entry -> parameterToString(entry.getValue()))); + MultiMap form = MultiMap.caseInsensitiveMultiMap().addAll(formMap); + request.sendForm(form, responseHandler); + } else { + request.send(responseHandler); + } + } + + private String buildCookieHeader(MultiMap cookies) { + final StringBuilder cookieValue = new StringBuilder(); + String delimiter = ""; + for (final Map.Entry entry : cookies.entries()) { + if (entry.getValue() != null) { + cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), entry.getValue())); + delimiter = "; "; + } + } + return cookieValue.toString(); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + protected String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Create a filename from the given headers. + * When the headers have no "Content-Disposition" information, a random UUID name is generated. + * + * @param headers The HTTP response headers + * @return The filename + */ + protected String generateFilename(MultiMap headers) { + String filename = UUID.randomUUID().toString(); + String contentDisposition = headers.get("Content-Disposition"); + if (contentDisposition != null && !contentDisposition.isEmpty()) { + Matcher matcher = CONTENT_DISPOSITION_PATTERN.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + return filename; + } + + /** + * File Download handling. + * + * @param response The HTTP response + * @param handler The response handler + */ + protected void handleFileDownload(HttpResponse response, Handler> handler) { + FileSystem fs = getVertx().fileSystem(); + + String filename = generateFilename(response.headers()); + Consumer fileHandler = directory -> { + fs.open(directory + filename, FILE_DOWNLOAD_OPTIONS, asyncFileResult -> { + if (asyncFileResult.succeeded()) { + AsyncFile asyncFile = asyncFileResult.result(); + asyncFile.write(response.bodyAsBuffer()); + //noinspection unchecked + handler.handle(Future.succeededFuture((T) asyncFile)); + } else { + handler.handle(ApiException.fail(asyncFileResult.cause())); + } + }); + }; + + String dir = getDownloadsDir(); + if (dir != null && !dir.isEmpty()) { + fs.mkdirs(dir, mkdirResult -> { + String sanitizedFolder = dir.endsWith("/") ? dir : dir + "/"; + fileHandler.accept(sanitizedFolder); + }); + } else { + fileHandler.accept(""); + } + } + + /** + * Build a response handler for the HttpResponse. + * + * @param returnType The return type + * @param handler The response handler + * @return The HTTP response handler + */ + protected Handler>> buildResponseHandler(TypeReference returnType, + Handler> handler) { + return response -> { + AsyncResult result; + if (response.succeeded()) { + HttpResponse httpResponse = response.result(); + if (httpResponse.statusCode() / 100 == 2) { + if (httpResponse.statusCode() == 204 || returnType == null) { + result = Future.succeededFuture(null); + } else { + T resultContent = null; + if ("byte[]".equals(returnType.getType().toString())) { + resultContent = (T) httpResponse.body().getBytes(); + result = Future.succeededFuture(resultContent); + } else if (AsyncFile.class.equals(returnType.getType())) { + handleFileDownload(httpResponse, handler); + return; + } else { + try { + resultContent = this.objectMapper.readValue(httpResponse.bodyAsString(), returnType); + result = Future.succeededFuture(resultContent); + } catch (Exception e) { + result = ApiException.fail(new DecodeException("Failed to decode:" + e.getMessage(), e)); + } + } + } + } else { + result = ApiException.fail(httpResponse.statusMessage(), httpResponse.statusCode(), httpResponse.headers(), httpResponse.bodyAsString()); + } + } else if (response.cause() instanceof ApiException) { + result = Future.failedFuture(response.cause()); + } else { + result = ApiException.fail(500, response.cause() != null ? response.cause().getMessage() : null); + } + handler.handle(result); + }; + } + + /** + * Build the WebClient used to make HTTP requests. + * + * @param vertx Vertx + * @return WebClient + */ + protected WebClient buildWebClient(Vertx vertx, JsonObject config) { + + if (!config.containsKey("userAgent")) { + config.put("userAgent", "OpenAPI-Generator/1.0.0/java"); + } + + return WebClient.create(vertx, new WebClientOptions(config)); + } + + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + */ + protected void updateParamsForAuth(String[] authNames, AuthInfo authInfo, List queryParams, MultiMap headerParams, MultiMap cookieParams) { + for (String authName : authNames) { + Authentication auth; + if (authInfo != null && authInfo.authentications.containsKey(authName)) { + auth = authInfo.authentications.get(authName); + } else { + auth = authentications.get(authName); + } + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + public static class AuthInfo { + + private final Map authentications = new LinkedHashMap<>(); + + public void addPetstoreAuthAuthentication(String accessToken) { + OAuth auth = new OAuth(); + auth.setAccessToken(accessToken); + authentications.put("petstore_auth", auth); + } + + public void addApiKeyAuthentication(String apikey, String apiKeyPrefix) { + ApiKeyAuth auth = new ApiKeyAuth("header","api_key"); + auth.setApiKey(apikey); + auth.setApiKeyPrefix(apiKeyPrefix); + authentications.put("api_key", auth); + } + + public void addApiKeyQueryAuthentication(String apikey, String apiKeyPrefix) { + ApiKeyAuth auth = new ApiKeyAuth("query","api_key_query"); + auth.setApiKey(apikey); + auth.setApiKeyPrefix(apiKeyPrefix); + authentications.put("api_key_query", auth); + } + + public void addHttpBasicTestAuthentication(String username, String password) { + HttpBasicAuth auth = new HttpBasicAuth(); + auth.setUsername(username); + auth.setPassword(password); + authentications.put("http_basic_test", auth); + } + + public void addBearerTestAuthentication(String bearerToken) { + HttpBearerAuth auth = new + HttpBearerAuth("bearer"); + auth.setBearerToken(bearerToken); + authentications.put("bearer_test", auth); + } + + public static AuthInfo forPetstoreAuthAuthentication(String accessToken) { + AuthInfo authInfo = new AuthInfo(); + authInfo.addPetstoreAuthAuthentication(accessToken); + return authInfo; + } + + public static AuthInfo forApiKeyAuthentication(String apikey, String apiKeyPrefix) { + AuthInfo authInfo = new AuthInfo(); + authInfo.addApiKeyAuthentication(apikey, apiKeyPrefix); + return authInfo; + } + + public static AuthInfo forApiKeyQueryAuthentication(String apikey, String apiKeyPrefix) { + AuthInfo authInfo = new AuthInfo(); + authInfo.addApiKeyQueryAuthentication(apikey, apiKeyPrefix); + return authInfo; + } + + public static AuthInfo forHttpBasicTest(String username, String password) { + AuthInfo authInfo = new AuthInfo(); + authInfo.addHttpBasicTestAuthentication(username, password); + return authInfo; + } + + public static AuthInfo forBearerTestAuthentication(String bearerToken) { + AuthInfo authInfo = new AuthInfo(); + authInfo.addBearerTestAuthentication(bearerToken); + return authInfo; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..5067c7b23a56 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,123 @@ +/* + * 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.client; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Future; +import io.vertx.core.MultiMap; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private MultiMap responseHeaders = null; + private String responseBody = null; + + + public static AsyncResult fail(int failureCode, String message) { + return Future.failedFuture(new ApiException(failureCode, message)); + } + + public static AsyncResult fail(Throwable throwable) { + return Future.failedFuture(new ApiException(throwable)); + } + + public static AsyncResult fail(String message) { + return Future.failedFuture(new ApiException(message)); + } + + public static AsyncResult fail(String message, Throwable throwable, int code, MultiMap responseHeaders) { + return Future.failedFuture(new ApiException(message, throwable, code, responseHeaders, null)); + } + + public static AsyncResult fail(String message, Throwable throwable, int code, MultiMap responseHeaders, String responseBody) { + return Future.failedFuture(new ApiException(message, throwable, code, responseHeaders, responseBody)); + } + + public static AsyncResult fail(String message, int code, MultiMap responseHeaders, String responseBody) { + return Future.failedFuture(new ApiException(message, (Throwable) null, code, responseHeaders, responseBody)); + } + + public static AsyncResult fail(int code, MultiMap responseHeaders, String responseBody) { + return Future.failedFuture(new ApiException((String) null, (Throwable) null, code, responseHeaders, responseBody)); + } + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, MultiMap responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, MultiMap responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, MultiMap responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, MultiMap responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, MultiMap responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public MultiMap getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..acda3a4a33f5 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,56 @@ +/* + * 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.client; + +import io.vertx.core.Vertx; +import io.vertx.core.json.JsonObject; + +import java.util.Objects; + +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static ApiClient defaultApiClient = null; + + /** + * Setup the default API client. + * Will be used by API instances when a client is not provided. + * + * @return Default API client + */ + public synchronized static ApiClient setupDefaultApiClient(Vertx vertx, JsonObject config) { + defaultApiClient = new ApiClient(vertx, config); + return defaultApiClient; + } + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public synchronized static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public synchronized static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/JavaTimeFormatter.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/JavaTimeFormatter.java new file mode 100644 index 000000000000..ea9b52839826 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/JavaTimeFormatter.java @@ -0,0 +1,64 @@ +/* + * 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.client; + +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +/** + * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. + * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class JavaTimeFormatter { + + private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + + /** + * Get the date format used to parse/format {@code OffsetDateTime} parameters. + * @return DateTimeFormatter + */ + public DateTimeFormatter getOffsetDateTimeFormatter() { + return offsetDateTimeFormatter; + } + + /** + * Set the date format used to parse/format {@code OffsetDateTime} parameters. + * @param offsetDateTimeFormatter {@code DateTimeFormatter} + */ + public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) { + this.offsetDateTimeFormatter = offsetDateTimeFormatter; + } + + /** + * Parse the given string into {@code OffsetDateTime} object. + * @param str String + * @return {@code OffsetDateTime} + */ + public OffsetDateTime parseOffsetDateTime(String str) { + try { + return OffsetDateTime.parse(str, offsetDateTimeFormatter); + } catch (DateTimeParseException e) { + throw new RuntimeException(e); + } + } + /** + * Format the given {@code OffsetDateTime} object into string. + * @param offsetDateTime {@code OffsetDateTime} + * @return {@code OffsetDateTime} in string format + */ + public String formatOffsetDateTime(OffsetDateTime offsetDateTime) { + return offsetDateTimeFormatter.format(offsetDateTime); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..df2a3fcd043e --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,57 @@ +/* + * 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.client; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..a3785edd835b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,58 @@ +/* + * 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.client; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..aa7f12749fee --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.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.client; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..6032bb0a3e47 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -0,0 +1,31 @@ +/* + * 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.client; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..67186e5c66e2 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * 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.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..70321d1e6915 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a28de13eeda1 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * 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.client; + +import java.util.Collection; +import java.util.Iterator; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..208d535d28df --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,31 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Client; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Future; +import io.vertx.core.Promise; +import io.vertx.core.json.JsonObject; + +import java.util.*; + +public interface AnotherFakeApi { + + void call123testSpecialTags(@javax.annotation.Nonnull Client client, Handler> handler); + + default Future call123testSpecialTags(@javax.annotation.Nonnull Client client){ + Promise promise = Promise.promise(); + call123testSpecialTags(client, promise); + return promise.future(); + } + + void call123testSpecialTags(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future call123testSpecialTags(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + call123testSpecialTags(client, authInfo, promise); + return promise.future(); + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/AnotherFakeApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/AnotherFakeApiImpl.java new file mode 100644 index 000000000000..8949109c1af9 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/AnotherFakeApiImpl.java @@ -0,0 +1,99 @@ +package org.openapitools.client.api; + +import org.openapitools.client.model.Client; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.json.JsonObject; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.*; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class AnotherFakeApiImpl implements AnotherFakeApi { + + private ApiClient apiClient; + + public AnotherFakeApiImpl() { + this(null); + } + + public AnotherFakeApiImpl(ApiClient apiClient) { + this.apiClient = apiClient != null ? apiClient : Configuration.getDefaultApiClient(); + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param resultHandler Asynchronous result handler + */ + public void call123testSpecialTags(Client client, Handler> resultHandler) { + call123testSpecialTags(client, null, resultHandler); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void call123testSpecialTags(Client client, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'client' when calling call123testSpecialTags")); + return; + } + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + + private String encodeParameter(String parameter) { + try { + return URLEncoder.encode(parameter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return parameter; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..6ef0f886fb02 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,31 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.FooGetDefaultResponse; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Future; +import io.vertx.core.Promise; +import io.vertx.core.json.JsonObject; + +import java.util.*; + +public interface DefaultApi { + + void fooGet(Handler> handler); + + default Future fooGet(){ + Promise promise = Promise.promise(); + fooGet(promise); + return promise.future(); + } + + void fooGet(ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fooGet(ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fooGet(authInfo, promise); + return promise.future(); + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/DefaultApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/DefaultApiImpl.java new file mode 100644 index 000000000000..3a70d7c33e33 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/DefaultApiImpl.java @@ -0,0 +1,91 @@ +package org.openapitools.client.api; + +import org.openapitools.client.model.FooGetDefaultResponse; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.json.JsonObject; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.*; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class DefaultApiImpl implements DefaultApi { + + private ApiClient apiClient; + + public DefaultApiImpl() { + this(null); + } + + public DefaultApiImpl(ApiClient apiClient) { + this.apiClient = apiClient != null ? apiClient : Configuration.getDefaultApiClient(); + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + * @param resultHandler Asynchronous result handler + */ + public void fooGet(Handler> resultHandler) { + fooGet(null, resultHandler); + } + + /** + * + * + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fooGet(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + + private String encodeParameter(String parameter) { + try { + return URLEncoder.encode(parameter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return parameter; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..b5f109d785f9 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,381 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import io.vertx.core.file.AsyncFile; +import java.math.BigDecimal; +import org.openapitools.client.model.ChildWithNullable; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterObjectWithEnumProperty; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Future; +import io.vertx.core.Promise; +import io.vertx.core.json.JsonObject; + +import java.util.*; + +public interface FakeApi { + + void fakeBigDecimalMap(Handler> handler); + + default Future fakeBigDecimalMap(){ + Promise promise = Promise.promise(); + fakeBigDecimalMap(promise); + return promise.future(); + } + + void fakeBigDecimalMap(ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakeBigDecimalMap(ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakeBigDecimalMap(authInfo, promise); + return promise.future(); + } + + void fakeHealthGet(Handler> handler); + + default Future fakeHealthGet(){ + Promise promise = Promise.promise(); + fakeHealthGet(promise); + return promise.future(); + } + + void fakeHealthGet(ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakeHealthGet(ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakeHealthGet(authInfo, promise); + return promise.future(); + } + + void fakeHttpSignatureTest(@javax.annotation.Nonnull Pet pet, @javax.annotation.Nullable String query1, @javax.annotation.Nullable String header1, Handler> handler); + + default Future fakeHttpSignatureTest(@javax.annotation.Nonnull Pet pet, @javax.annotation.Nullable String query1, @javax.annotation.Nullable String header1){ + Promise promise = Promise.promise(); + fakeHttpSignatureTest(pet, query1, header1, promise); + return promise.future(); + } + + void fakeHttpSignatureTest(@javax.annotation.Nonnull Pet pet, @javax.annotation.Nullable String query1, @javax.annotation.Nullable String header1, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakeHttpSignatureTest(@javax.annotation.Nonnull Pet pet, @javax.annotation.Nullable String query1, @javax.annotation.Nullable String header1, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakeHttpSignatureTest(pet, query1, header1, authInfo, promise); + return promise.future(); + } + + void fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body, Handler> handler); + + default Future fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body){ + Promise promise = Promise.promise(); + fakeOuterBooleanSerialize(body, promise); + return promise.future(); + } + + void fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakeOuterBooleanSerialize(body, authInfo, promise); + return promise.future(); + } + + void fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite, Handler> handler); + + default Future fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite){ + Promise promise = Promise.promise(); + fakeOuterCompositeSerialize(outerComposite, promise); + return promise.future(); + } + + void fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakeOuterCompositeSerialize(outerComposite, authInfo, promise); + return promise.future(); + } + + void fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body, Handler> handler); + + default Future fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body){ + Promise promise = Promise.promise(); + fakeOuterNumberSerialize(body, promise); + return promise.future(); + } + + void fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakeOuterNumberSerialize(body, authInfo, promise); + return promise.future(); + } + + void fakeOuterStringSerialize(@javax.annotation.Nullable String body, Handler> handler); + + default Future fakeOuterStringSerialize(@javax.annotation.Nullable String body){ + Promise promise = Promise.promise(); + fakeOuterStringSerialize(body, promise); + return promise.future(); + } + + void fakeOuterStringSerialize(@javax.annotation.Nullable String body, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakeOuterStringSerialize(@javax.annotation.Nullable String body, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakeOuterStringSerialize(body, authInfo, promise); + return promise.future(); + } + + void fakePropertyEnumIntegerSerialize(@javax.annotation.Nonnull OuterObjectWithEnumProperty outerObjectWithEnumProperty, Handler> handler); + + default Future fakePropertyEnumIntegerSerialize(@javax.annotation.Nonnull OuterObjectWithEnumProperty outerObjectWithEnumProperty){ + Promise promise = Promise.promise(); + fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, promise); + return promise.future(); + } + + void fakePropertyEnumIntegerSerialize(@javax.annotation.Nonnull OuterObjectWithEnumProperty outerObjectWithEnumProperty, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future fakePropertyEnumIntegerSerialize(@javax.annotation.Nonnull OuterObjectWithEnumProperty outerObjectWithEnumProperty, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, authInfo, promise); + return promise.future(); + } + + void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody, Handler> handler); + + default Future testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody){ + Promise promise = Promise.promise(); + testAdditionalPropertiesReference(requestBody, promise); + return promise.future(); + } + + void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testAdditionalPropertiesReference(requestBody, authInfo, promise); + return promise.future(); + } + + void testBodyWithBinary(@javax.annotation.Nullable AsyncFile body, Handler> handler); + + default Future testBodyWithBinary(@javax.annotation.Nullable AsyncFile body){ + Promise promise = Promise.promise(); + testBodyWithBinary(body, promise); + return promise.future(); + } + + void testBodyWithBinary(@javax.annotation.Nullable AsyncFile body, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testBodyWithBinary(@javax.annotation.Nullable AsyncFile body, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testBodyWithBinary(body, authInfo, promise); + return promise.future(); + } + + void testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, Handler> handler); + + default Future testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass){ + Promise promise = Promise.promise(); + testBodyWithFileSchema(fileSchemaTestClass, promise); + return promise.future(); + } + + void testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testBodyWithFileSchema(fileSchemaTestClass, authInfo, promise); + return promise.future(); + } + + void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, Handler> handler); + + default Future testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user){ + Promise promise = Promise.promise(); + testBodyWithQueryParams(query, user, promise); + return promise.future(); + } + + void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testBodyWithQueryParams(query, user, authInfo, promise); + return promise.future(); + } + + void testClientModel(@javax.annotation.Nonnull Client client, Handler> handler); + + default Future testClientModel(@javax.annotation.Nonnull Client client){ + Promise promise = Promise.promise(); + testClientModel(client, promise); + return promise.future(); + } + + void testClientModel(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testClientModel(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testClientModel(client, authInfo, promise); + return promise.future(); + } + + void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable AsyncFile binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Handler> handler); + + default Future testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable AsyncFile binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback){ + Promise promise = Promise.promise(); + testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, promise); + return promise.future(); + } + + void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable AsyncFile binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable AsyncFile binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, authInfo, promise); + return promise.future(); + } + + void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumQueryModelArray, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, Handler> handler); + + default Future testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumQueryModelArray, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString){ + Promise promise = Promise.promise(); + testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, promise); + return promise.future(); + } + + void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumQueryModelArray, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumQueryModelArray, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, authInfo, promise); + return promise.future(); + } + + void testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, Handler> handler); + + default Future testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group){ + Promise promise = Promise.promise(); + testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, promise); + return promise.future(); + } + + void testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, authInfo, promise); + return promise.future(); + } + + void testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody, Handler> handler); + + default Future testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody){ + Promise promise = Promise.promise(); + testInlineAdditionalProperties(requestBody, promise); + return promise.future(); + } + + void testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testInlineAdditionalProperties(requestBody, authInfo, promise); + return promise.future(); + } + + void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Handler> handler); + + default Future testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest){ + Promise promise = Promise.promise(); + testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, promise); + return promise.future(); + } + + void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, authInfo, promise); + return promise.future(); + } + + void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, Handler> handler); + + default Future testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2){ + Promise promise = Promise.promise(); + testJsonFormData(param, param2, promise); + return promise.future(); + } + + void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testJsonFormData(param, param2, authInfo, promise); + return promise.future(); + } + + void testNullable(@javax.annotation.Nonnull ChildWithNullable childWithNullable, Handler> handler); + + default Future testNullable(@javax.annotation.Nonnull ChildWithNullable childWithNullable){ + Promise promise = Promise.promise(); + testNullable(childWithNullable, promise); + return promise.future(); + } + + void testNullable(@javax.annotation.Nonnull ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testNullable(@javax.annotation.Nonnull ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testNullable(childWithNullable, authInfo, promise); + return promise.future(); + } + + void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, @javax.annotation.Nonnull String allowEmpty, @javax.annotation.Nullable Map language, Handler> handler); + + default Future testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, @javax.annotation.Nonnull String allowEmpty, @javax.annotation.Nullable Map language){ + Promise promise = Promise.promise(); + testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, promise); + return promise.future(); + } + + void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, @javax.annotation.Nonnull String allowEmpty, @javax.annotation.Nullable Map language, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, @javax.annotation.Nonnull String allowEmpty, @javax.annotation.Nullable Map language, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, authInfo, promise); + return promise.future(); + } + + void testStringMapReference(@javax.annotation.Nonnull Map requestBody, Handler> handler); + + default Future testStringMapReference(@javax.annotation.Nonnull Map requestBody){ + Promise promise = Promise.promise(); + testStringMapReference(requestBody, promise); + return promise.future(); + } + + void testStringMapReference(@javax.annotation.Nonnull Map requestBody, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testStringMapReference(@javax.annotation.Nonnull Map requestBody, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testStringMapReference(requestBody, authInfo, promise); + return promise.future(); + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeApiImpl.java new file mode 100644 index 000000000000..0fe72bda1586 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeApiImpl.java @@ -0,0 +1,1265 @@ +package org.openapitools.client.api; + +import io.vertx.core.file.AsyncFile; +import java.math.BigDecimal; +import org.openapitools.client.model.ChildWithNullable; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterObjectWithEnumProperty; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.json.JsonObject; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.*; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FakeApiImpl implements FakeApi { + + private ApiClient apiClient; + + public FakeApiImpl() { + this(null); + } + + public FakeApiImpl(ApiClient apiClient) { + this.apiClient = apiClient != null ? apiClient : Configuration.getDefaultApiClient(); + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param resultHandler Asynchronous result handler + */ + public void fakeBigDecimalMap(Handler> resultHandler) { + fakeBigDecimalMap(null, resultHandler); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakeBigDecimalMap(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // create path and map variables + String localVarPath = "/fake/BigDecimalMap"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "*/*" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * Health check endpoint + * + * @param resultHandler Asynchronous result handler + */ + public void fakeHealthGet(Handler> resultHandler) { + fakeHealthGet(null, resultHandler); + } + + /** + * Health check endpoint + * + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakeHealthGet(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeHttpSignatureTest(Pet pet, String query1, String header1, Handler> resultHandler) { + fakeHttpSignatureTest(pet, query1, header1, null, resultHandler); + } + + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakeHttpSignatureTest(Pet pet, String query1, String header1, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'pet' when calling fakeHttpSignatureTest")); + return; + } + + // create path and map variables + String localVarPath = "/fake/http-signature-test"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query_1", query1)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + if (header1 != null) + localVarHeaderParams.add("header_1", apiClient.parameterToString(header1)); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json", "application/xml" }; + String[] localVarAuthNames = new String[] { "http_signature_test" }; + + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterBooleanSerialize(Boolean body, Handler> resultHandler) { + fakeOuterBooleanSerialize(body, null, resultHandler); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterBooleanSerialize(Boolean body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "*/*" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterCompositeSerialize(OuterComposite outerComposite, Handler> resultHandler) { + fakeOuterCompositeSerialize(outerComposite, null, resultHandler); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterCompositeSerialize(OuterComposite outerComposite, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = outerComposite; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "*/*" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterNumberSerialize(BigDecimal body, Handler> resultHandler) { + fakeOuterNumberSerialize(body, null, resultHandler); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterNumberSerialize(BigDecimal body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "*/*" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterStringSerialize(String body, Handler> resultHandler) { + fakeOuterStringSerialize(body, null, resultHandler); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterStringSerialize(String body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "*/*" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body (required) + * @param resultHandler Asynchronous result handler + */ + public void fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, Handler> resultHandler) { + fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, null, resultHandler); + } + + /** + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = outerObjectWithEnumProperty; + + // verify the required parameter 'outerObjectWithEnumProperty' is set + if (outerObjectWithEnumProperty == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'outerObjectWithEnumProperty' when calling fakePropertyEnumIntegerSerialize")); + return; + } + + // create path and map variables + String localVarPath = "/fake/property/enum-int"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "*/*" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testAdditionalPropertiesReference(Map requestBody, Handler> resultHandler) { + testAdditionalPropertiesReference(requestBody, null, resultHandler); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testAdditionalPropertiesReference(Map requestBody, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference")); + return; + } + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * + * For this test, the body has to be a binary file. + * @param body image to upload (required) + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithBinary(AsyncFile body, Handler> resultHandler) { + testBodyWithBinary(body, null, resultHandler); + } + + /** + * + * For this test, the body has to be a binary file. + * @param body image to upload (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithBinary(AsyncFile body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'body' when calling testBodyWithBinary")); + return; + } + + // create path and map variables + String localVarPath = "/fake/body-with-binary"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "image/png" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, Handler> resultHandler) { + testBodyWithFileSchema(fileSchemaTestClass, null, resultHandler); + } + + /** + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = fileSchemaTestClass; + + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema")); + return; + } + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * + * + * @param query (required) + * @param user (required) + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithQueryParams(String query, User user, Handler> resultHandler) { + testBodyWithQueryParams(query, user, null, resultHandler); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithQueryParams(String query, User user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = user; + + // verify the required parameter 'query' is set + if (query == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams")); + return; + } + + // verify the required parameter 'user' is set + if (user == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams")); + return; + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param resultHandler Asynchronous result handler + */ + public void testClientModel(Client client, Handler> resultHandler) { + testClientModel(client, null, resultHandler); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testClientModel(Client client, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'client' when calling testClientModel")); + return; + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, Handler> resultHandler) { + testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'number' when calling testEndpointParameters")); + return; + } + + // verify the required parameter '_double' is set + if (_double == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter '_double' when calling testEndpointParameters")); + return; + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters")); + return; + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter '_byte' when calling testEndpointParameters")); + return; + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + if (integer != null) localVarFormParams.put("integer", integer); +if (int32 != null) localVarFormParams.put("int32", int32); +if (int64 != null) localVarFormParams.put("int64", int64); +if (number != null) localVarFormParams.put("number", number); +if (_float != null) localVarFormParams.put("float", _float); +if (_double != null) localVarFormParams.put("double", _double); +if (string != null) localVarFormParams.put("string", string); +if (patternWithoutDelimiter != null) localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); +if (_byte != null) localVarFormParams.put("byte", _byte); +if (binary != null) localVarFormParams.put("binary", binary); +if (date != null) localVarFormParams.put("date", date); +if (dateTime != null) localVarFormParams.put("dateTime", dateTime); +if (password != null) localVarFormParams.put("password", password); +if (paramCallback != null) localVarFormParams.put("callback", paramCallback); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/x-www-form-urlencoded" }; + String[] localVarAuthNames = new String[] { "http_basic_test" }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * 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 enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param resultHandler Asynchronous result handler + */ + public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString, Handler> resultHandler) { + testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, null, resultHandler); + } + + /** + * 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 enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "enum_query_model_array", enumQueryModelArray)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + if (enumHeaderStringArray != null) + localVarHeaderParams.add("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); +if (enumHeaderString != null) + localVarHeaderParams.add("enum_header_string", apiClient.parameterToString(enumHeaderString)); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + if (enumFormStringArray != null) localVarFormParams.put("enum_form_string_array", enumFormStringArray); +if (enumFormString != null) localVarFormParams.put("enum_form_string", enumFormString); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/x-www-form-urlencoded" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, Handler> resultHandler) { + testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters")); + return; + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters")); + return; + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters")); + return; + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + if (requiredBooleanGroup != null) + localVarHeaderParams.add("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); +if (booleanGroup != null) + localVarHeaderParams.add("boolean_group", apiClient.parameterToString(booleanGroup)); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "bearer_test" }; + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testInlineAdditionalProperties(Map requestBody, Handler> resultHandler) { + testInlineAdditionalProperties(requestBody, null, resultHandler); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testInlineAdditionalProperties(Map requestBody, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties")); + return; + } + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Handler> resultHandler) { + testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, null, resultHandler); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = testInlineFreeformAdditionalPropertiesRequest; + + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties")); + return; + } + + // create path and map variables + String localVarPath = "/fake/inline-freeform-additionalProperties"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param resultHandler Asynchronous result handler + */ + public void testJsonFormData(String param, String param2, Handler> resultHandler) { + testJsonFormData(param, param2, null, resultHandler); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testJsonFormData(String param, String param2, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'param' is set + if (param == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'param' when calling testJsonFormData")); + return; + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'param2' when calling testJsonFormData")); + return; + } + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + if (param != null) localVarFormParams.put("param", param); +if (param2 != null) localVarFormParams.put("param2", param2); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/x-www-form-urlencoded" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * test nullable parent property + * + * @param childWithNullable request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testNullable(ChildWithNullable childWithNullable, Handler> resultHandler) { + testNullable(childWithNullable, null, resultHandler); + } + + /** + * test nullable parent property + * + * @param childWithNullable request body (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testNullable(ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = childWithNullable; + + // verify the required parameter 'childWithNullable' is set + if (childWithNullable == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'childWithNullable' when calling testNullable")); + return; + } + + // create path and map variables + String localVarPath = "/fake/nullable"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + * @param resultHandler Asynchronous result handler + */ + public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, Map language, Handler> resultHandler) { + testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, null, resultHandler); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, Map language, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'pipe' is set + if (pipe == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat")); + return; + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat")); + return; + } + + // verify the required parameter 'http' is set + if (http == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat")); + return; + } + + // verify the required parameter 'url' is set + if (url == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat")); + return; + } + + // verify the required parameter 'context' is set + if (context == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat")); + return; + } + + // verify the required parameter 'allowEmpty' is set + if (allowEmpty == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'allowEmpty' when calling testQueryParameterCollectionFormat")); + return; + } + + // create path and map variables + String localVarPath = "/fake/test-query-parameters"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("pipes", "pipe", pipe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ioutil", ioutil)); + localVarQueryParams.addAll(apiClient.parameterToPairs("ssv", "http", http)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "context", context)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "language", language)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "allowEmpty", allowEmpty)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testStringMapReference(Map requestBody, Handler> resultHandler) { + testStringMapReference(requestBody, null, resultHandler); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testStringMapReference(Map requestBody, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'requestBody' when calling testStringMapReference")); + return; + } + + // create path and map variables + String localVarPath = "/fake/stringMap-reference"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + + private String encodeParameter(String parameter) { + try { + return URLEncoder.encode(parameter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return parameter; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..bdfa51af4188 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,31 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Client; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Future; +import io.vertx.core.Promise; +import io.vertx.core.json.JsonObject; + +import java.util.*; + +public interface FakeClassnameTags123Api { + + void testClassname(@javax.annotation.Nonnull Client client, Handler> handler); + + default Future testClassname(@javax.annotation.Nonnull Client client){ + Promise promise = Promise.promise(); + testClassname(client, promise); + return promise.future(); + } + + void testClassname(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future testClassname(@javax.annotation.Nonnull Client client, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + testClassname(client, authInfo, promise); + return promise.future(); + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeClassnameTags123ApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeClassnameTags123ApiImpl.java new file mode 100644 index 000000000000..230ecf7ab21b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/FakeClassnameTags123ApiImpl.java @@ -0,0 +1,99 @@ +package org.openapitools.client.api; + +import org.openapitools.client.model.Client; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.json.JsonObject; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.*; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FakeClassnameTags123ApiImpl implements FakeClassnameTags123Api { + + private ApiClient apiClient; + + public FakeClassnameTags123ApiImpl() { + this(null); + } + + public FakeClassnameTags123ApiImpl(ApiClient apiClient) { + this.apiClient = apiClient != null ? apiClient : Configuration.getDefaultApiClient(); + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param resultHandler Asynchronous result handler + */ + public void testClassname(Client client, Handler> resultHandler) { + testClassname(client, null, resultHandler); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void testClassname(Client client, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'client' when calling testClassname")); + return; + } + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { "api_key_query" }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + + private String encodeParameter(String parameter) { + try { + return URLEncoder.encode(parameter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return parameter; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..9b3a7f9df4cb --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,166 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import io.vertx.core.file.AsyncFile; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Future; +import io.vertx.core.Promise; +import io.vertx.core.json.JsonObject; + +import java.util.*; + +public interface PetApi { + + void addPet(@javax.annotation.Nonnull Pet pet, Handler> handler); + + default Future addPet(@javax.annotation.Nonnull Pet pet){ + Promise promise = Promise.promise(); + addPet(pet, promise); + return promise.future(); + } + + void addPet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future addPet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + addPet(pet, authInfo, promise); + return promise.future(); + } + + void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Handler> handler); + + default Future deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey){ + Promise promise = Promise.promise(); + deletePet(petId, apiKey, promise); + return promise.future(); + } + + void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + deletePet(petId, apiKey, authInfo, promise); + return promise.future(); + } + + void findPetsByStatus(@javax.annotation.Nonnull List status, Handler>> handler); + + default Future> findPetsByStatus(@javax.annotation.Nonnull List status){ + Promise> promise = Promise.promise(); + findPetsByStatus(status, promise); + return promise.future(); + } + + void findPetsByStatus(@javax.annotation.Nonnull List status, ApiClient.AuthInfo authInfo, Handler>> handler); + + default Future> findPetsByStatus(@javax.annotation.Nonnull List status, ApiClient.AuthInfo authInfo){ + Promise> promise = Promise.promise(); + findPetsByStatus(status, authInfo, promise); + return promise.future(); + } + + @Deprecated + void findPetsByTags(@javax.annotation.Nonnull Set tags, Handler>> handler); + + @Deprecated + default Future> findPetsByTags(@javax.annotation.Nonnull Set tags){ + Promise> promise = Promise.promise(); + findPetsByTags(tags, promise); + return promise.future(); + } + + @Deprecated + void findPetsByTags(@javax.annotation.Nonnull Set tags, ApiClient.AuthInfo authInfo, Handler>> handler); + + @Deprecated + default Future> findPetsByTags(@javax.annotation.Nonnull Set tags, ApiClient.AuthInfo authInfo){ + Promise> promise = Promise.promise(); + findPetsByTags(tags, authInfo, promise); + return promise.future(); + } + + void getPetById(@javax.annotation.Nonnull Long petId, Handler> handler); + + default Future getPetById(@javax.annotation.Nonnull Long petId){ + Promise promise = Promise.promise(); + getPetById(petId, promise); + return promise.future(); + } + + void getPetById(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future getPetById(@javax.annotation.Nonnull Long petId, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + getPetById(petId, authInfo, promise); + return promise.future(); + } + + void updatePet(@javax.annotation.Nonnull Pet pet, Handler> handler); + + default Future updatePet(@javax.annotation.Nonnull Pet pet){ + Promise promise = Promise.promise(); + updatePet(pet, promise); + return promise.future(); + } + + void updatePet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future updatePet(@javax.annotation.Nonnull Pet pet, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + updatePet(pet, authInfo, promise); + return promise.future(); + } + + void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Handler> handler); + + default Future updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status){ + Promise promise = Promise.promise(); + updatePetWithForm(petId, name, status, promise); + return promise.future(); + } + + void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + updatePetWithForm(petId, name, status, authInfo, promise); + return promise.future(); + } + + void uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file, Handler> handler); + + default Future uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file){ + Promise promise = Promise.promise(); + uploadFile(petId, additionalMetadata, _file, promise); + return promise.future(); + } + + void uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable AsyncFile _file, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + uploadFile(petId, additionalMetadata, _file, authInfo, promise); + return promise.future(); + } + + void uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata, Handler> handler); + + default Future uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata){ + Promise promise = Promise.promise(); + uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, promise); + return promise.future(); + } + + void uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull AsyncFile requiredFile, @javax.annotation.Nullable String additionalMetadata, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, authInfo, promise); + return promise.future(); + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java new file mode 100644 index 000000000000..1000090a2e20 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -0,0 +1,516 @@ +package org.openapitools.client.api; + +import io.vertx.core.file.AsyncFile; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.json.JsonObject; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.*; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class PetApiImpl implements PetApi { + + private ApiClient apiClient; + + public PetApiImpl() { + this(null); + } + + public PetApiImpl(ApiClient apiClient) { + this.apiClient = apiClient != null ? apiClient : Configuration.getDefaultApiClient(); + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param resultHandler Asynchronous result handler + */ + public void addPet(Pet pet, Handler> resultHandler) { + addPet(pet, null, resultHandler); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void addPet(Pet pet, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'pet' when calling addPet")); + return; + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json", "application/xml" }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param resultHandler Asynchronous result handler + */ + public void deletePet(Long petId, String apiKey, Handler> resultHandler) { + deletePet(petId, apiKey, null, resultHandler); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void deletePet(Long petId, String apiKey, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling deletePet")); + return; + } + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + if (apiKey != null) + localVarHeaderParams.add("api_key", apiClient.parameterToString(apiKey)); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void findPetsByStatus(List status, Handler>> resultHandler) { + findPetsByStatus(status, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void findPetsByStatus(List status, ApiClient.AuthInfo authInfo, Handler>> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'status' is set + if (status == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'status' when calling findPetsByStatus")); + return; + } + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/xml", "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + TypeReference> localVarReturnType = new TypeReference>() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void findPetsByTags(Set tags, Handler>> resultHandler) { + findPetsByTags(tags, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void findPetsByTags(Set tags, ApiClient.AuthInfo authInfo, Handler>> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'tags' is set + if (tags == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'tags' when calling findPetsByTags")); + return; + } + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/xml", "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + TypeReference> localVarReturnType = new TypeReference>() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param resultHandler Asynchronous result handler + */ + public void getPetById(Long petId, Handler> resultHandler) { + getPetById(petId, null, resultHandler); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void getPetById(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling getPetById")); + return; + } + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/xml", "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "api_key" }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param resultHandler Asynchronous result handler + */ + public void updatePet(Pet pet, Handler> resultHandler) { + updatePet(pet, null, resultHandler); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void updatePet(Pet pet, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'pet' when calling updatePet")); + return; + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json", "application/xml" }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void updatePetWithForm(Long petId, String name, String status, Handler> resultHandler) { + updatePetWithForm(petId, name, status, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void updatePetWithForm(Long petId, String name, String status, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling updatePetWithForm")); + return; + } + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + if (name != null) localVarFormParams.put("name", name); +if (status != null) localVarFormParams.put("status", status); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/x-www-form-urlencoded" }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void uploadFile(Long petId, String additionalMetadata, AsyncFile _file, Handler> resultHandler) { + uploadFile(petId, additionalMetadata, _file, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void uploadFile(Long petId, String additionalMetadata, AsyncFile _file, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling uploadFile")); + return; + } + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata); +if (_file != null) localVarFormParams.put("file", _file); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { "multipart/form-data" }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void uploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata, Handler> resultHandler) { + uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void uploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile")); + return; + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile")); + return; + } + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile".replaceAll("\\{" + "petId" + "\\}", encodeParameter(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata); +if (requiredFile != null) localVarFormParams.put("requiredFile", requiredFile); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { "multipart/form-data" }; + String[] localVarAuthNames = new String[] { "petstore_auth" }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + + private String encodeParameter(String parameter) { + try { + return URLEncoder.encode(parameter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return parameter; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..72a1738b41ee --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,79 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Order; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Future; +import io.vertx.core.Promise; +import io.vertx.core.json.JsonObject; + +import java.util.*; + +public interface StoreApi { + + void deleteOrder(@javax.annotation.Nonnull String orderId, Handler> handler); + + default Future deleteOrder(@javax.annotation.Nonnull String orderId){ + Promise promise = Promise.promise(); + deleteOrder(orderId, promise); + return promise.future(); + } + + void deleteOrder(@javax.annotation.Nonnull String orderId, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future deleteOrder(@javax.annotation.Nonnull String orderId, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + deleteOrder(orderId, authInfo, promise); + return promise.future(); + } + + void getInventory(Handler>> handler); + + default Future> getInventory(){ + Promise> promise = Promise.promise(); + getInventory(promise); + return promise.future(); + } + + void getInventory(ApiClient.AuthInfo authInfo, Handler>> handler); + + default Future> getInventory(ApiClient.AuthInfo authInfo){ + Promise> promise = Promise.promise(); + getInventory(authInfo, promise); + return promise.future(); + } + + void getOrderById(@javax.annotation.Nonnull Long orderId, Handler> handler); + + default Future getOrderById(@javax.annotation.Nonnull Long orderId){ + Promise promise = Promise.promise(); + getOrderById(orderId, promise); + return promise.future(); + } + + void getOrderById(@javax.annotation.Nonnull Long orderId, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future getOrderById(@javax.annotation.Nonnull Long orderId, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + getOrderById(orderId, authInfo, promise); + return promise.future(); + } + + void placeOrder(@javax.annotation.Nonnull Order order, Handler> handler); + + default Future placeOrder(@javax.annotation.Nonnull Order order){ + Promise promise = Promise.promise(); + placeOrder(order, promise); + return promise.future(); + } + + void placeOrder(@javax.annotation.Nonnull Order order, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future placeOrder(@javax.annotation.Nonnull Order order, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + placeOrder(order, authInfo, promise); + return promise.future(); + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/StoreApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/StoreApiImpl.java new file mode 100644 index 000000000000..e108dca7ff52 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/StoreApiImpl.java @@ -0,0 +1,235 @@ +package org.openapitools.client.api; + +import org.openapitools.client.model.Order; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.json.JsonObject; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.*; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class StoreApiImpl implements StoreApi { + + private ApiClient apiClient; + + public StoreApiImpl() { + this(null); + } + + public StoreApiImpl(ApiClient apiClient) { + this.apiClient = apiClient != null ? apiClient : Configuration.getDefaultApiClient(); + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void deleteOrder(String orderId, Handler> resultHandler) { + deleteOrder(orderId, null, resultHandler); + } + + /** + * 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) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void deleteOrder(String orderId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'orderId' when calling deleteOrder")); + return; + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}".replaceAll("\\{" + "order_id" + "\\}", encodeParameter(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param resultHandler Asynchronous result handler + */ + public void getInventory(Handler>> resultHandler) { + getInventory(null, resultHandler); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void getInventory(ApiClient.AuthInfo authInfo, Handler>> resultHandler) { + Object localVarBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { "api_key" }; + TypeReference> localVarReturnType = new TypeReference>() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param resultHandler Asynchronous result handler + */ + public void getOrderById(Long orderId, Handler> resultHandler) { + getOrderById(orderId, null, resultHandler); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void getOrderById(Long orderId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'orderId' when calling getOrderById")); + return; + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}".replaceAll("\\{" + "order_id" + "\\}", encodeParameter(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/xml", "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param resultHandler Asynchronous result handler + */ + public void placeOrder(Order order, Handler> resultHandler) { + placeOrder(order, null, resultHandler); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void placeOrder(Order order, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = order; + + // verify the required parameter 'order' is set + if (order == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'order' when calling placeOrder")); + return; + } + + // create path and map variables + String localVarPath = "/store/order"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/xml", "application/json" }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + + private String encodeParameter(String parameter) { + try { + return URLEncoder.encode(parameter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return parameter; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..d7e18f00dfb5 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,144 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Future; +import io.vertx.core.Promise; +import io.vertx.core.json.JsonObject; + +import java.util.*; + +public interface UserApi { + + void createUser(@javax.annotation.Nonnull User user, Handler> handler); + + default Future createUser(@javax.annotation.Nonnull User user){ + Promise promise = Promise.promise(); + createUser(user, promise); + return promise.future(); + } + + void createUser(@javax.annotation.Nonnull User user, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future createUser(@javax.annotation.Nonnull User user, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + createUser(user, authInfo, promise); + return promise.future(); + } + + void createUsersWithArrayInput(@javax.annotation.Nonnull List user, Handler> handler); + + default Future createUsersWithArrayInput(@javax.annotation.Nonnull List user){ + Promise promise = Promise.promise(); + createUsersWithArrayInput(user, promise); + return promise.future(); + } + + void createUsersWithArrayInput(@javax.annotation.Nonnull List user, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future createUsersWithArrayInput(@javax.annotation.Nonnull List user, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + createUsersWithArrayInput(user, authInfo, promise); + return promise.future(); + } + + void createUsersWithListInput(@javax.annotation.Nonnull List user, Handler> handler); + + default Future createUsersWithListInput(@javax.annotation.Nonnull List user){ + Promise promise = Promise.promise(); + createUsersWithListInput(user, promise); + return promise.future(); + } + + void createUsersWithListInput(@javax.annotation.Nonnull List user, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future createUsersWithListInput(@javax.annotation.Nonnull List user, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + createUsersWithListInput(user, authInfo, promise); + return promise.future(); + } + + void deleteUser(@javax.annotation.Nonnull String username, Handler> handler); + + default Future deleteUser(@javax.annotation.Nonnull String username){ + Promise promise = Promise.promise(); + deleteUser(username, promise); + return promise.future(); + } + + void deleteUser(@javax.annotation.Nonnull String username, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future deleteUser(@javax.annotation.Nonnull String username, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + deleteUser(username, authInfo, promise); + return promise.future(); + } + + void getUserByName(@javax.annotation.Nonnull String username, Handler> handler); + + default Future getUserByName(@javax.annotation.Nonnull String username){ + Promise promise = Promise.promise(); + getUserByName(username, promise); + return promise.future(); + } + + void getUserByName(@javax.annotation.Nonnull String username, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future getUserByName(@javax.annotation.Nonnull String username, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + getUserByName(username, authInfo, promise); + return promise.future(); + } + + void loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Handler> handler); + + default Future loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password){ + Promise promise = Promise.promise(); + loginUser(username, password, promise); + return promise.future(); + } + + void loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + loginUser(username, password, authInfo, promise); + return promise.future(); + } + + void logoutUser(Handler> handler); + + default Future logoutUser(){ + Promise promise = Promise.promise(); + logoutUser(promise); + return promise.future(); + } + + void logoutUser(ApiClient.AuthInfo authInfo, Handler> handler); + + default Future logoutUser(ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + logoutUser(authInfo, promise); + return promise.future(); + } + + void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Handler> handler); + + default Future updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user){ + Promise promise = Promise.promise(); + updateUser(username, user, promise); + return promise.future(); + } + + void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, ApiClient.AuthInfo authInfo, Handler> handler); + + default Future updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, ApiClient.AuthInfo authInfo){ + Promise promise = Promise.promise(); + updateUser(username, user, authInfo, promise); + return promise.future(); + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/UserApiImpl.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/UserApiImpl.java new file mode 100644 index 000000000000..da3e96c9739f --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/UserApiImpl.java @@ -0,0 +1,446 @@ +package org.openapitools.client.api; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.json.JsonObject; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.*; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class UserApiImpl implements UserApi { + + private ApiClient apiClient; + + public UserApiImpl() { + this(null); + } + + public UserApiImpl(ApiClient apiClient) { + this.apiClient = apiClient != null ? apiClient : Configuration.getDefaultApiClient(); + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param resultHandler Asynchronous result handler + */ + public void createUser(User user, Handler> resultHandler) { + createUser(user, null, resultHandler); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void createUser(User user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'user' when calling createUser")); + return; + } + + // create path and map variables + String localVarPath = "/user"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithArrayInput(List user, Handler> resultHandler) { + createUsersWithArrayInput(user, null, resultHandler); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithArrayInput(List user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput")); + return; + } + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithListInput(List user, Handler> resultHandler) { + createUsersWithListInput(user, null, resultHandler); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithListInput(List user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'user' when calling createUsersWithListInput")); + return; + } + + // create path and map variables + String localVarPath = "/user/createWithList"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param resultHandler Asynchronous result handler + */ + public void deleteUser(String username, Handler> resultHandler) { + deleteUser(username, null, resultHandler); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void deleteUser(String username, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'username' when calling deleteUser")); + return; + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{" + "username" + "\\}", encodeParameter(username.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param resultHandler Asynchronous result handler + */ + public void getUserByName(String username, Handler> resultHandler) { + getUserByName(username, null, resultHandler); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void getUserByName(String username, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'username' when calling getUserByName")); + return; + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{" + "username" + "\\}", encodeParameter(username.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/xml", "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param resultHandler Asynchronous result handler + */ + public void loginUser(String username, String password, Handler> resultHandler) { + loginUser(username, password, null, resultHandler); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void loginUser(String username, String password, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'username' when calling loginUser")); + return; + } + + // verify the required parameter 'password' is set + if (password == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'password' when calling loginUser")); + return; + } + + // create path and map variables + String localVarPath = "/user/login"; + + // query params + List localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { "application/xml", "application/json" }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + TypeReference localVarReturnType = new TypeReference() {}; + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, localVarReturnType, resultHandler); + } + /** + * Logs out current logged in user session + * + * @param resultHandler Asynchronous result handler + */ + public void logoutUser(Handler> resultHandler) { + logoutUser(null, resultHandler); + } + + /** + * Logs out current logged in user session + * + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void logoutUser(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param resultHandler Asynchronous result handler + */ + public void updateUser(String username, User user, Handler> resultHandler) { + updateUser(username, user, null, resultHandler); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param authInfo per call authentication override. + * @param resultHandler Asynchronous result handler + */ + public void updateUser(String username, User user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + Object localVarBody = user; + + // verify the required parameter 'username' is set + if (username == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'username' when calling updateUser")); + return; + } + + // verify the required parameter 'user' is set + if (user == null) { + resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'user' when calling updateUser")); + return; + } + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{" + "username" + "\\}", encodeParameter(username.toString())); + + // query params + List localVarQueryParams = new ArrayList<>(); + + // header params + MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); + + // cookie params + MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); + + // form params + // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) + Map localVarFormParams = new HashMap<>(); + + String[] localVarAccepts = { }; + String[] localVarContentTypes = { "application/json" }; + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, authInfo, null, resultHandler); + } + + private String encodeParameter(String parameter) { + try { + return URLEncoder.encode(parameter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + return parameter; + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/AnotherFakeApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/AnotherFakeApi.java new file mode 100644 index 000000000000..7b93d72fad1e --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/AnotherFakeApi.java @@ -0,0 +1,74 @@ +package org.openapitools.client.api.rxjava; + +import org.openapitools.client.model.Client; +import org.openapitools.client.ApiClient; + +import java.util.*; + +import rx.Single; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class AnotherFakeApi { + + private final org.openapitools.client.api.AnotherFakeApi delegate; + + public AnotherFakeApi(org.openapitools.client.api.AnotherFakeApi delegate) { + this.delegate = delegate; + } + + public org.openapitools.client.api.AnotherFakeApi getDelegate() { + return delegate; + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param resultHandler Asynchronous result handler + */ + public void call123testSpecialTags(Client client, Handler> resultHandler) { + delegate.call123testSpecialTags(client, resultHandler); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void call123testSpecialTags(Client client, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.call123testSpecialTags(client, authInfo, resultHandler); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCall123testSpecialTags(Client client) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.call123testSpecialTags(client, fut) + )); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCall123testSpecialTags(Client client, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.call123testSpecialTags(client, authInfo, fut) + )); + } + + public static AnotherFakeApi newInstance(org.openapitools.client.api.AnotherFakeApi arg) { + return arg != null ? new AnotherFakeApi(arg) : null; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/DefaultApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/DefaultApi.java new file mode 100644 index 000000000000..88362e5de887 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/DefaultApi.java @@ -0,0 +1,70 @@ +package org.openapitools.client.api.rxjava; + +import org.openapitools.client.model.FooGetDefaultResponse; +import org.openapitools.client.ApiClient; + +import java.util.*; + +import rx.Single; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class DefaultApi { + + private final org.openapitools.client.api.DefaultApi delegate; + + public DefaultApi(org.openapitools.client.api.DefaultApi delegate) { + this.delegate = delegate; + } + + public org.openapitools.client.api.DefaultApi getDelegate() { + return delegate; + } + + /** + * + * + * @param resultHandler Asynchronous result handler + */ + public void fooGet(Handler> resultHandler) { + delegate.fooGet(resultHandler); + } + + /** + * + * + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fooGet(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fooGet(authInfo, resultHandler); + } + + /** + * + * + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFooGet() { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fooGet(fut) + )); + } + + /** + * + * + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFooGet(ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fooGet(authInfo, fut) + )); + } + + public static DefaultApi newInstance(org.openapitools.client.api.DefaultApi arg) { + return arg != null ? new DefaultApi(arg) : null; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java new file mode 100644 index 000000000000..db1d88a6047b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java @@ -0,0 +1,1169 @@ +package org.openapitools.client.api.rxjava; + +import io.vertx.core.file.AsyncFile; +import java.math.BigDecimal; +import org.openapitools.client.model.ChildWithNullable; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterObjectWithEnumProperty; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; +import org.openapitools.client.ApiClient; + +import java.util.*; + +import rx.Single; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FakeApi { + + private final org.openapitools.client.api.FakeApi delegate; + + public FakeApi(org.openapitools.client.api.FakeApi delegate) { + this.delegate = delegate; + } + + public org.openapitools.client.api.FakeApi getDelegate() { + return delegate; + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param resultHandler Asynchronous result handler + */ + public void fakeBigDecimalMap(Handler> resultHandler) { + delegate.fakeBigDecimalMap(resultHandler); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakeBigDecimalMap(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakeBigDecimalMap(authInfo, resultHandler); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeBigDecimalMap() { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeBigDecimalMap(fut) + )); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeBigDecimalMap(ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeBigDecimalMap(authInfo, fut) + )); + } + /** + * Health check endpoint + * + * @param resultHandler Asynchronous result handler + */ + public void fakeHealthGet(Handler> resultHandler) { + delegate.fakeHealthGet(resultHandler); + } + + /** + * Health check endpoint + * + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakeHealthGet(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakeHealthGet(authInfo, resultHandler); + } + + /** + * Health check endpoint + * + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeHealthGet() { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeHealthGet(fut) + )); + } + + /** + * Health check endpoint + * + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeHealthGet(ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeHealthGet(authInfo, fut) + )); + } + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeHttpSignatureTest(Pet pet, String query1, String header1, Handler> resultHandler) { + delegate.fakeHttpSignatureTest(pet, query1, header1, resultHandler); + } + + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakeHttpSignatureTest(Pet pet, String query1, String header1, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakeHttpSignatureTest(pet, query1, header1, authInfo, resultHandler); + } + + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeHttpSignatureTest(Pet pet, String query1, String header1) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeHttpSignatureTest(pet, query1, header1, fut) + )); + } + + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeHttpSignatureTest(Pet pet, String query1, String header1, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeHttpSignatureTest(pet, query1, header1, authInfo, fut) + )); + } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterBooleanSerialize(Boolean body, Handler> resultHandler) { + delegate.fakeOuterBooleanSerialize(body, resultHandler); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterBooleanSerialize(Boolean body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakeOuterBooleanSerialize(body, authInfo, resultHandler); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterBooleanSerialize(Boolean body) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterBooleanSerialize(body, fut) + )); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterBooleanSerialize(Boolean body, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterBooleanSerialize(body, authInfo, fut) + )); + } + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterCompositeSerialize(OuterComposite outerComposite, Handler> resultHandler) { + delegate.fakeOuterCompositeSerialize(outerComposite, resultHandler); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterCompositeSerialize(OuterComposite outerComposite, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakeOuterCompositeSerialize(outerComposite, authInfo, resultHandler); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterCompositeSerialize(OuterComposite outerComposite) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterCompositeSerialize(outerComposite, fut) + )); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterCompositeSerialize(OuterComposite outerComposite, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterCompositeSerialize(outerComposite, authInfo, fut) + )); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterNumberSerialize(BigDecimal body, Handler> resultHandler) { + delegate.fakeOuterNumberSerialize(body, resultHandler); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterNumberSerialize(BigDecimal body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakeOuterNumberSerialize(body, authInfo, resultHandler); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterNumberSerialize(BigDecimal body) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterNumberSerialize(body, fut) + )); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterNumberSerialize(BigDecimal body, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterNumberSerialize(body, authInfo, fut) + )); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterStringSerialize(String body, Handler> resultHandler) { + delegate.fakeOuterStringSerialize(body, resultHandler); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakeOuterStringSerialize(String body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakeOuterStringSerialize(body, authInfo, resultHandler); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterStringSerialize(String body) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterStringSerialize(body, fut) + )); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakeOuterStringSerialize(String body, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakeOuterStringSerialize(body, authInfo, fut) + )); + } + /** + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body (required) + * @param resultHandler Asynchronous result handler + */ + public void fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, Handler> resultHandler) { + delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, resultHandler); + } + + /** + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, authInfo, resultHandler); + } + + /** + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, fut) + )); + } + + /** + * + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxFakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, authInfo, fut) + )); + } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testAdditionalPropertiesReference(Map requestBody, Handler> resultHandler) { + delegate.testAdditionalPropertiesReference(requestBody, resultHandler); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testAdditionalPropertiesReference(Map requestBody, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testAdditionalPropertiesReference(requestBody, authInfo, resultHandler); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestAdditionalPropertiesReference(Map requestBody) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testAdditionalPropertiesReference(requestBody, fut) + )); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestAdditionalPropertiesReference(Map requestBody, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testAdditionalPropertiesReference(requestBody, authInfo, fut) + )); + } + /** + * + * For this test, the body has to be a binary file. + * @param body image to upload (required) + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithBinary(AsyncFile body, Handler> resultHandler) { + delegate.testBodyWithBinary(body, resultHandler); + } + + /** + * + * For this test, the body has to be a binary file. + * @param body image to upload (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithBinary(AsyncFile body, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testBodyWithBinary(body, authInfo, resultHandler); + } + + /** + * + * For this test, the body has to be a binary file. + * @param body image to upload (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestBodyWithBinary(AsyncFile body) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testBodyWithBinary(body, fut) + )); + } + + /** + * + * For this test, the body has to be a binary file. + * @param body image to upload (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestBodyWithBinary(AsyncFile body, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testBodyWithBinary(body, authInfo, fut) + )); + } + /** + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, Handler> resultHandler) { + delegate.testBodyWithFileSchema(fileSchemaTestClass, resultHandler); + } + + /** + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testBodyWithFileSchema(fileSchemaTestClass, authInfo, resultHandler); + } + + /** + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testBodyWithFileSchema(fileSchemaTestClass, fut) + )); + } + + /** + * + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testBodyWithFileSchema(fileSchemaTestClass, authInfo, fut) + )); + } + /** + * + * + * @param query (required) + * @param user (required) + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithQueryParams(String query, User user, Handler> resultHandler) { + delegate.testBodyWithQueryParams(query, user, resultHandler); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testBodyWithQueryParams(String query, User user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testBodyWithQueryParams(query, user, authInfo, resultHandler); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestBodyWithQueryParams(String query, User user) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testBodyWithQueryParams(query, user, fut) + )); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestBodyWithQueryParams(String query, User user, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testBodyWithQueryParams(query, user, authInfo, fut) + )); + } + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param resultHandler Asynchronous result handler + */ + public void testClientModel(Client client, Handler> resultHandler) { + delegate.testClientModel(client, resultHandler); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testClientModel(Client client, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testClientModel(client, authInfo, resultHandler); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestClientModel(Client client) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testClientModel(client, fut) + )); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestClientModel(Client client, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testClientModel(client, authInfo, fut) + )); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, Handler> resultHandler) { + delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, authInfo, resultHandler); + } + + /** + * 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) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, authInfo, fut) + )); + } + /** + * 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 enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param resultHandler Asynchronous result handler + */ + public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString, Handler> resultHandler) { + delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, resultHandler); + } + + /** + * 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 enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, authInfo, resultHandler); + } + + /** + * 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 enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, fut) + )); + } + + /** + * 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 enumQueryModelArray (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, authInfo, fut) + )); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, Handler> resultHandler) { + delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, authInfo, resultHandler); + } + + /** + * 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) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, authInfo, fut) + )); + } + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testInlineAdditionalProperties(Map requestBody, Handler> resultHandler) { + delegate.testInlineAdditionalProperties(requestBody, resultHandler); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testInlineAdditionalProperties(Map requestBody, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testInlineAdditionalProperties(requestBody, authInfo, resultHandler); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestInlineAdditionalProperties(Map requestBody) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testInlineAdditionalProperties(requestBody, fut) + )); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestInlineAdditionalProperties(Map requestBody, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testInlineAdditionalProperties(requestBody, authInfo, fut) + )); + } + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, Handler> resultHandler) { + delegate.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, resultHandler); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, authInfo, resultHandler); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, fut) + )); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, authInfo, fut) + )); + } + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param resultHandler Asynchronous result handler + */ + public void testJsonFormData(String param, String param2, Handler> resultHandler) { + delegate.testJsonFormData(param, param2, resultHandler); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testJsonFormData(String param, String param2, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testJsonFormData(param, param2, authInfo, resultHandler); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestJsonFormData(String param, String param2) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testJsonFormData(param, param2, fut) + )); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestJsonFormData(String param, String param2, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testJsonFormData(param, param2, authInfo, fut) + )); + } + /** + * test nullable parent property + * + * @param childWithNullable request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testNullable(ChildWithNullable childWithNullable, Handler> resultHandler) { + delegate.testNullable(childWithNullable, resultHandler); + } + + /** + * test nullable parent property + * + * @param childWithNullable request body (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testNullable(ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testNullable(childWithNullable, authInfo, resultHandler); + } + + /** + * test nullable parent property + * + * @param childWithNullable request body (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestNullable(ChildWithNullable childWithNullable) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testNullable(childWithNullable, fut) + )); + } + + /** + * test nullable parent property + * + * @param childWithNullable request body (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestNullable(ChildWithNullable childWithNullable, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testNullable(childWithNullable, authInfo, fut) + )); + } + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + * @param resultHandler Asynchronous result handler + */ + public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, Map language, Handler> resultHandler) { + delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, resultHandler); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, Map language, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, authInfo, resultHandler); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, Map language) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, fut) + )); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, Map language, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, authInfo, fut) + )); + } + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param resultHandler Asynchronous result handler + */ + public void testStringMapReference(Map requestBody, Handler> resultHandler) { + delegate.testStringMapReference(requestBody, resultHandler); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testStringMapReference(Map requestBody, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testStringMapReference(requestBody, authInfo, resultHandler); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestStringMapReference(Map requestBody) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testStringMapReference(requestBody, fut) + )); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestStringMapReference(Map requestBody, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testStringMapReference(requestBody, authInfo, fut) + )); + } + + public static FakeApi newInstance(org.openapitools.client.api.FakeApi arg) { + return arg != null ? new FakeApi(arg) : null; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/FakeClassnameTags123Api.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..81db79108868 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/FakeClassnameTags123Api.java @@ -0,0 +1,74 @@ +package org.openapitools.client.api.rxjava; + +import org.openapitools.client.model.Client; +import org.openapitools.client.ApiClient; + +import java.util.*; + +import rx.Single; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FakeClassnameTags123Api { + + private final org.openapitools.client.api.FakeClassnameTags123Api delegate; + + public FakeClassnameTags123Api(org.openapitools.client.api.FakeClassnameTags123Api delegate) { + this.delegate = delegate; + } + + public org.openapitools.client.api.FakeClassnameTags123Api getDelegate() { + return delegate; + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param resultHandler Asynchronous result handler + */ + public void testClassname(Client client, Handler> resultHandler) { + delegate.testClassname(client, resultHandler); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void testClassname(Client client, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.testClassname(client, authInfo, resultHandler); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestClassname(Client client) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testClassname(client, fut) + )); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxTestClassname(Client client, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.testClassname(client, authInfo, fut) + )); + } + + public static FakeClassnameTags123Api newInstance(org.openapitools.client.api.FakeClassnameTags123Api arg) { + return arg != null ? new FakeClassnameTags123Api(arg) : null; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java new file mode 100644 index 000000000000..3e1f8beead57 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/PetApi.java @@ -0,0 +1,465 @@ +package org.openapitools.client.api.rxjava; + +import io.vertx.core.file.AsyncFile; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; +import org.openapitools.client.ApiClient; + +import java.util.*; + +import rx.Single; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class PetApi { + + private final org.openapitools.client.api.PetApi delegate; + + public PetApi(org.openapitools.client.api.PetApi delegate) { + this.delegate = delegate; + } + + public org.openapitools.client.api.PetApi getDelegate() { + return delegate; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param resultHandler Asynchronous result handler + */ + public void addPet(Pet pet, Handler> resultHandler) { + delegate.addPet(pet, resultHandler); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void addPet(Pet pet, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.addPet(pet, authInfo, resultHandler); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxAddPet(Pet pet) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.addPet(pet, fut) + )); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxAddPet(Pet pet, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.addPet(pet, authInfo, fut) + )); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param resultHandler Asynchronous result handler + */ + public void deletePet(Long petId, String apiKey, Handler> resultHandler) { + delegate.deletePet(petId, apiKey, resultHandler); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void deletePet(Long petId, String apiKey, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.deletePet(petId, apiKey, authInfo, resultHandler); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDeletePet(Long petId, String apiKey) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.deletePet(petId, apiKey, fut) + )); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDeletePet(Long petId, String apiKey, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.deletePet(petId, apiKey, authInfo, fut) + )); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void findPetsByStatus(List status, Handler>> resultHandler) { + delegate.findPetsByStatus(status, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void findPetsByStatus(List status, ApiClient.AuthInfo authInfo, Handler>> resultHandler) { + delegate.findPetsByStatus(status, authInfo, resultHandler); + } + + /** + * 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 Asynchronous result handler (RxJava Single) + */ + public Single> rxFindPetsByStatus(List status) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.findPetsByStatus(status, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single> rxFindPetsByStatus(List status, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.findPetsByStatus(status, authInfo, fut) + )); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void findPetsByTags(Set tags, Handler>> resultHandler) { + delegate.findPetsByTags(tags, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void findPetsByTags(Set tags, ApiClient.AuthInfo authInfo, Handler>> resultHandler) { + delegate.findPetsByTags(tags, authInfo, resultHandler); + } + + /** + * 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 Asynchronous result handler (RxJava Single) + */ + public Single> rxFindPetsByTags(Set tags) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.findPetsByTags(tags, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single> rxFindPetsByTags(Set tags, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.findPetsByTags(tags, authInfo, fut) + )); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param resultHandler Asynchronous result handler + */ + public void getPetById(Long petId, Handler> resultHandler) { + delegate.getPetById(petId, resultHandler); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void getPetById(Long petId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.getPetById(petId, authInfo, resultHandler); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxGetPetById(Long petId) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getPetById(petId, fut) + )); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxGetPetById(Long petId, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getPetById(petId, authInfo, fut) + )); + } + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param resultHandler Asynchronous result handler + */ + public void updatePet(Pet pet, Handler> resultHandler) { + delegate.updatePet(pet, resultHandler); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void updatePet(Pet pet, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.updatePet(pet, authInfo, resultHandler); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUpdatePet(Pet pet) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.updatePet(pet, fut) + )); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUpdatePet(Pet pet, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.updatePet(pet, authInfo, fut) + )); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void updatePetWithForm(Long petId, String name, String status, Handler> resultHandler) { + delegate.updatePetWithForm(petId, name, status, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void updatePetWithForm(Long petId, String name, String status, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.updatePetWithForm(petId, name, status, authInfo, resultHandler); + } + + /** + * 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) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUpdatePetWithForm(Long petId, String name, String status) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.updatePetWithForm(petId, name, status, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUpdatePetWithForm(Long petId, String name, String status, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.updatePetWithForm(petId, name, status, authInfo, fut) + )); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void uploadFile(Long petId, String additionalMetadata, AsyncFile _file, Handler> resultHandler) { + delegate.uploadFile(petId, additionalMetadata, _file, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void uploadFile(Long petId, String additionalMetadata, AsyncFile _file, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.uploadFile(petId, additionalMetadata, _file, authInfo, resultHandler); + } + + /** + * 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 Asynchronous result handler (RxJava Single) + */ + public Single rxUploadFile(Long petId, String additionalMetadata, AsyncFile _file) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.uploadFile(petId, additionalMetadata, _file, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUploadFile(Long petId, String additionalMetadata, AsyncFile _file, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.uploadFile(petId, additionalMetadata, _file, authInfo, fut) + )); + } + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void uploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata, Handler> resultHandler) { + delegate.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void uploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, authInfo, resultHandler); + } + + /** + * 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 Asynchronous result handler (RxJava Single) + */ + public Single rxUploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, authInfo, fut) + )); + } + + public static PetApi newInstance(org.openapitools.client.api.PetApi arg) { + return arg != null ? new PetApi(arg) : null; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/StoreApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/StoreApi.java new file mode 100644 index 000000000000..e8f54748b125 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/StoreApi.java @@ -0,0 +1,205 @@ +package org.openapitools.client.api.rxjava; + +import org.openapitools.client.model.Order; +import org.openapitools.client.ApiClient; + +import java.util.*; + +import rx.Single; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class StoreApi { + + private final org.openapitools.client.api.StoreApi delegate; + + public StoreApi(org.openapitools.client.api.StoreApi delegate) { + this.delegate = delegate; + } + + public org.openapitools.client.api.StoreApi getDelegate() { + return delegate; + } + + /** + * 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) + * @param resultHandler Asynchronous result handler + */ + public void deleteOrder(String orderId, Handler> resultHandler) { + delegate.deleteOrder(orderId, resultHandler); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void deleteOrder(String orderId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.deleteOrder(orderId, authInfo, resultHandler); + } + + /** + * 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) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDeleteOrder(String orderId) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.deleteOrder(orderId, fut) + )); + } + + /** + * 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) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDeleteOrder(String orderId, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.deleteOrder(orderId, authInfo, fut) + )); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param resultHandler Asynchronous result handler + */ + public void getInventory(Handler>> resultHandler) { + delegate.getInventory(resultHandler); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void getInventory(ApiClient.AuthInfo authInfo, Handler>> resultHandler) { + delegate.getInventory(authInfo, resultHandler); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Asynchronous result handler (RxJava Single) + */ + public Single> rxGetInventory() { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getInventory(fut) + )); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single> rxGetInventory(ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getInventory(authInfo, fut) + )); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param resultHandler Asynchronous result handler + */ + public void getOrderById(Long orderId, Handler> resultHandler) { + delegate.getOrderById(orderId, resultHandler); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void getOrderById(Long orderId, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.getOrderById(orderId, authInfo, resultHandler); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxGetOrderById(Long orderId) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getOrderById(orderId, fut) + )); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxGetOrderById(Long orderId, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getOrderById(orderId, authInfo, fut) + )); + } + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param resultHandler Asynchronous result handler + */ + public void placeOrder(Order order, Handler> resultHandler) { + delegate.placeOrder(order, resultHandler); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void placeOrder(Order order, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.placeOrder(order, authInfo, resultHandler); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxPlaceOrder(Order order) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.placeOrder(order, fut) + )); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxPlaceOrder(Order order, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.placeOrder(order, authInfo, fut) + )); + } + + public static StoreApi newInstance(org.openapitools.client.api.StoreApi arg) { + return arg != null ? new StoreApi(arg) : null; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/UserApi.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/UserApi.java new file mode 100644 index 000000000000..8324e04798ac --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/api/rxjava/UserApi.java @@ -0,0 +1,394 @@ +package org.openapitools.client.api.rxjava; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.openapitools.client.ApiClient; + +import java.util.*; + +import rx.Single; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class UserApi { + + private final org.openapitools.client.api.UserApi delegate; + + public UserApi(org.openapitools.client.api.UserApi delegate) { + this.delegate = delegate; + } + + public org.openapitools.client.api.UserApi getDelegate() { + return delegate; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param resultHandler Asynchronous result handler + */ + public void createUser(User user, Handler> resultHandler) { + delegate.createUser(user, resultHandler); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void createUser(User user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.createUser(user, authInfo, resultHandler); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCreateUser(User user) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.createUser(user, fut) + )); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCreateUser(User user, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.createUser(user, authInfo, fut) + )); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithArrayInput(List user, Handler> resultHandler) { + delegate.createUsersWithArrayInput(user, resultHandler); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithArrayInput(List user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.createUsersWithArrayInput(user, authInfo, resultHandler); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCreateUsersWithArrayInput(List user) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.createUsersWithArrayInput(user, fut) + )); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCreateUsersWithArrayInput(List user, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.createUsersWithArrayInput(user, authInfo, fut) + )); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithListInput(List user, Handler> resultHandler) { + delegate.createUsersWithListInput(user, resultHandler); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void createUsersWithListInput(List user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.createUsersWithListInput(user, authInfo, resultHandler); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCreateUsersWithListInput(List user) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.createUsersWithListInput(user, fut) + )); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxCreateUsersWithListInput(List user, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.createUsersWithListInput(user, authInfo, fut) + )); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param resultHandler Asynchronous result handler + */ + public void deleteUser(String username, Handler> resultHandler) { + delegate.deleteUser(username, resultHandler); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void deleteUser(String username, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.deleteUser(username, authInfo, resultHandler); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDeleteUser(String username) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.deleteUser(username, fut) + )); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxDeleteUser(String username, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.deleteUser(username, authInfo, fut) + )); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param resultHandler Asynchronous result handler + */ + public void getUserByName(String username, Handler> resultHandler) { + delegate.getUserByName(username, resultHandler); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void getUserByName(String username, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.getUserByName(username, authInfo, resultHandler); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxGetUserByName(String username) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getUserByName(username, fut) + )); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxGetUserByName(String username, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.getUserByName(username, authInfo, fut) + )); + } + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param resultHandler Asynchronous result handler + */ + public void loginUser(String username, String password, Handler> resultHandler) { + delegate.loginUser(username, password, resultHandler); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void loginUser(String username, String password, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.loginUser(username, password, authInfo, resultHandler); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxLoginUser(String username, String password) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.loginUser(username, password, fut) + )); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxLoginUser(String username, String password, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.loginUser(username, password, authInfo, fut) + )); + } + /** + * Logs out current logged in user session + * + * @param resultHandler Asynchronous result handler + */ + public void logoutUser(Handler> resultHandler) { + delegate.logoutUser(resultHandler); + } + + /** + * Logs out current logged in user session + * + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void logoutUser(ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.logoutUser(authInfo, resultHandler); + } + + /** + * Logs out current logged in user session + * + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxLogoutUser() { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.logoutUser(fut) + )); + } + + /** + * Logs out current logged in user session + * + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxLogoutUser(ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.logoutUser(authInfo, fut) + )); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param resultHandler Asynchronous result handler + */ + public void updateUser(String username, User user, Handler> resultHandler) { + delegate.updateUser(username, user, resultHandler); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param authInfo call specific auth overrides + * @param resultHandler Asynchronous result handler + */ + public void updateUser(String username, User user, ApiClient.AuthInfo authInfo, Handler> resultHandler) { + delegate.updateUser(username, user, authInfo, resultHandler); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUpdateUser(String username, User user) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.updateUser(username, user, fut) + )); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param authInfo call specific auth overrides + * @return Asynchronous result handler (RxJava Single) + */ + public Single rxUpdateUser(String username, User user, ApiClient.AuthInfo authInfo) { + return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> + delegate.updateUser(username, user, authInfo, fut) + )); + } + + public static UserApi newInstance(org.openapitools.client.api.UserApi arg) { + return arg != null ? new UserApi(arg) : null; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..f24264613c9b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,77 @@ +/* + * 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.client.auth; + +import org.openapitools.client.Pair; +import io.vertx.core.MultiMap; + +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, MultiMap headerParams, MultiMap cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.add(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.add(paramName, value); + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..08b071ee036f --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,30 @@ +/* + * 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.client.auth; + +import org.openapitools.client.Pair; +import io.vertx.core.MultiMap; + +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, MultiMap headerParams, MultiMap cookieParams); +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..fee0b34edfc2 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,51 @@ +/* + * 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.client.auth; + +import org.openapitools.client.Pair; +import io.vertx.core.MultiMap; +import java.util.Base64; +import java.nio.charset.StandardCharsets; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + 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; + } + + @Override + public void applyToParams(List queryParams, MultiMap headerParams, MultiMap cookieParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.add("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..e7a007717b20 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,50 @@ +/* + * 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.client.auth; + +import org.openapitools.client.Pair; +import io.vertx.core.MultiMap; +import java.util.Base64; +import java.nio.charset.StandardCharsets; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + public String getBearerToken() { + return bearerToken; + } + + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, MultiMap headerParams, MultiMap cookieParams) { + if (bearerToken == null) { + return; + } + headerParams.add("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..4474ae170be9 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,39 @@ +/* + * 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.client.auth; + +import org.openapitools.client.Pair; +import io.vertx.core.MultiMap; + +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, MultiMap headerParams, MultiMap cookieParams) { + if (accessToken != null) { + headerParams.add("Authorization", "Bearer " + accessToken); + } + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..b2d11ff0c4f0 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,18 @@ +/* + * 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.client.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..01e6dd38c2e2 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,154 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * AdditionalPropertiesClass + */ +@JsonPropertyOrder({ + AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + @javax.annotation.Nullable + private Map mapProperty = new HashMap<>(); + + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + @javax.annotation.Nullable + private Map> mapOfMapProperty = new HashMap<>(); + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapProperty(@javax.annotation.Nullable Map mapProperty) { + + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapProperty() { + return mapProperty; + } + + + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapProperty(@javax.annotation.Nullable Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(@javax.annotation.Nullable Map> mapOfMapProperty) { + + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfMapProperty(@javax.annotation.Nullable Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + @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.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java new file mode 100644 index 000000000000..4369abfbfa8c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/AllOfWithSingleRef.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.SingleRefType; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * AllOfWithSingleRef + */ +@JsonPropertyOrder({ + AllOfWithSingleRef.JSON_PROPERTY_USERNAME, + AllOfWithSingleRef.JSON_PROPERTY_SINGLE_REF_TYPE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class AllOfWithSingleRef { + public static final String JSON_PROPERTY_USERNAME = "username"; + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_SINGLE_REF_TYPE = "SingleRefType"; + @javax.annotation.Nullable + private SingleRefType singleRefType; + + public AllOfWithSingleRef() { + } + + public AllOfWithSingleRef username(@javax.annotation.Nullable String username) { + + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String username) { + this.username = username; + } + + public AllOfWithSingleRef singleRefType(@javax.annotation.Nullable SingleRefType singleRefType) { + + this.singleRefType = singleRefType; + return this; + } + + /** + * Get singleRefType + * @return singleRefType + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SingleRefType getSingleRefType() { + return singleRefType; + } + + + @JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSingleRefType(@javax.annotation.Nullable SingleRefType singleRefType) { + this.singleRefType = singleRefType; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o; + return Objects.equals(this.username, allOfWithSingleRef.username) && + Objects.equals(this.singleRefType, allOfWithSingleRef.singleRefType); + } + + @Override + public int hashCode() { + return Objects.hash(username, singleRefType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfWithSingleRef {\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" singleRefType: ").append(toIndentedString(singleRefType)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..76d809224eb5 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,149 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) + +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @javax.annotation.Nonnull + protected String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + @javax.annotation.Nullable + protected String color = "red"; + + public Animal() { + } + + public Animal className(@javax.annotation.Nonnull String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull String className) { + this.className = className; + } + + public Animal color(@javax.annotation.Nullable String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..9f9230f5c51b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,116 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @javax.annotation.Nullable + private List> arrayArrayNumber = new ArrayList<>(); + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..95eb35a262ca --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,116 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + @javax.annotation.Nullable + private List arrayNumber = new ArrayList<>(); + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..6e87eafcc512 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,196 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ArrayTest + */ +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + @javax.annotation.Nullable + private List arrayOfString = new ArrayList<>(); + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @javax.annotation.Nullable + private List> arrayArrayOfInteger = new ArrayList<>(); + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @javax.annotation.Nullable + private List> arrayArrayOfModel = new ArrayList<>(); + + public ArrayTest() { + } + + public ArrayTest arrayOfString(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..dec70966d099 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,264 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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 +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + @javax.annotation.Nullable + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + @javax.annotation.Nullable + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + @javax.annotation.Nullable + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + @javax.annotation.Nullable + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @javax.annotation.Nullable + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + @javax.annotation.Nullable + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(@javax.annotation.Nullable String smallCamel) { + + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(@javax.annotation.Nullable String capitalCamel) { + + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(@javax.annotation.Nullable String smallSnake) { + + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(@javax.annotation.Nullable String capitalSnake) { + + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(@javax.annotation.Nullable String ATT_NAME) { + + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..53bed2e41f6b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Cat.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + @javax.annotation.Nullable + private Boolean declawed; + + public Cat() { + + } + + public Cat declawed(@javax.annotation.Nullable Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + @Override + public Cat className(@javax.annotation.Nonnull String className) { + this.setClassName(className); + return this; + } + + @Override + public Cat color(@javax.annotation.Nullable String color) { + this.setColor(color); + return this; + } + + @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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..d1fc7b09c499 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,136 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull + private String name = "default-name"; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Long id) { + this.id = id; + } + + public Category name(@javax.annotation.Nonnull String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ChildWithNullable.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ChildWithNullable.java new file mode 100644 index 000000000000..557f2f88af9a --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ChildWithNullable.java @@ -0,0 +1,141 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ParentWithNullable; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ChildWithNullable + */ +@JsonPropertyOrder({ + ChildWithNullable.JSON_PROPERTY_OTHER_PROPERTY +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) + +public class ChildWithNullable extends ParentWithNullable { + public static final String JSON_PROPERTY_OTHER_PROPERTY = "otherProperty"; + @javax.annotation.Nullable + private String otherProperty; + + public ChildWithNullable() { + + } + + public ChildWithNullable otherProperty(@javax.annotation.Nullable String otherProperty) { + + this.otherProperty = otherProperty; + return this; + } + + /** + * Get otherProperty + * @return otherProperty + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OTHER_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getOtherProperty() { + return otherProperty; + } + + + @JsonProperty(JSON_PROPERTY_OTHER_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOtherProperty(@javax.annotation.Nullable String otherProperty) { + this.otherProperty = otherProperty; + } + + @Override + public ChildWithNullable type(@javax.annotation.Nullable TypeEnum type) { + this.setType(type); + return this; + } + + @Override + public ChildWithNullable nullableProperty(@javax.annotation.Nullable String nullableProperty) { + this.setNullableProperty(nullableProperty); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildWithNullable childWithNullable = (ChildWithNullable) o; + return Objects.equals(this.otherProperty, childWithNullable.otherProperty) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(otherProperty, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildWithNullable {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" otherProperty: ").append(toIndentedString(otherProperty)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..675e9f398283 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ClassModel.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model with \"_class\" property + */ +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + @javax.annotation.Nullable + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(@javax.annotation.Nullable String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..434d46ad1b64 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Client.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + @javax.annotation.Nullable + private String client; + + public Client() { + } + + public Client client(@javax.annotation.Nullable String client) { + + this.client = client; + return this; + } + + /** + * Get client + * @return client + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String client) { + this.client = client; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) 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 Client {\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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/DeprecatedObject.java new file mode 100644 index 000000000000..fee5fff083d4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/DeprecatedObject.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * DeprecatedObject + * @deprecated + */ +@Deprecated +@JsonPropertyOrder({ + DeprecatedObject.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class DeprecatedObject { + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public DeprecatedObject() { + } + + public DeprecatedObject name(@javax.annotation.Nullable String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(this.name, deprecatedObject.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..b62b147f96e1 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Dog.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + @javax.annotation.Nullable + private String breed; + + public Dog() { + + } + + public Dog breed(@javax.annotation.Nullable String breed) { + + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + @Override + public Dog className(@javax.annotation.Nonnull String className) { + this.setClassName(className); + return this; + } + + @Override + public Dog color(@javax.annotation.Nullable String color) { + this.setColor(color); + return this; + } + + @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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..96da52dd6a11 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,217 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(String.valueOf(">=")), + + DOLLAR(String.valueOf("$")); + + 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"; + @javax.annotation.Nullable + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH(String.valueOf("fish")), + + CRAB(String.valueOf("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"; + @javax.annotation.Nullable + private List arrayEnum = new ArrayList<>(); + + public EnumArrays() { + } + + public EnumArrays justSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..1190cf5abe3c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,61 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..69c3f59d7f9b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,500 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE +}) +@JsonTypeName("Enum_Test") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER(String.valueOf("UPPER")), + + LOWER(String.valueOf("lower")), + + EMPTY(String.valueOf("")); + + 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"; + @javax.annotation.Nullable + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER(String.valueOf("UPPER")), + + LOWER(String.valueOf("lower")), + + EMPTY(String.valueOf("")); + + 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"; + @javax.annotation.Nonnull + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(Integer.valueOf(1)), + + NUMBER_MINUS_1(Integer.valueOf(-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"; + @javax.annotation.Nullable + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(Double.valueOf(1.1)), + + NUMBER_MINUS_1_DOT_2(Double.valueOf(-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"; + @javax.annotation.Nullable + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + @javax.annotation.Nullable + private JsonNullable outerEnum = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + @javax.annotation.Nullable + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + @javax.annotation.Nullable + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + @javax.annotation.Nullable + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + public EnumTest() { + } + + public EnumTest enumString(@javax.annotation.Nullable EnumStringEnum enumString) { + + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest outerEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + + return this; + } + + /** + * Get outerEnum + * @return outerEnum + */ + @javax.annotation.Nullable + @JsonIgnore + + public OuterEnum getOuterEnum() { + return outerEnum.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getOuterEnum_JsonNullable() { + return outerEnum; + } + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + public void setOuterEnum_JsonNullable(JsonNullable outerEnum) { + this.outerEnum = outerEnum; + } + + public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + } + + public EnumTest outerEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + public EnumTest outerEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + public EnumTest outerEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + @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) && + equalsNullable(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @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(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 000000000000..7eca4111f558 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,148 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@JsonTypeName("fakeBigDecimalMap_200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + @javax.annotation.Nullable + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + @javax.annotation.Nullable + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(@javax.annotation.Nullable BigDecimal someId) { + + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(@javax.annotation.Nullable BigDecimal someId) { + this.someId = someId; + } + + public FakeBigDecimalMap200Response someMap(@javax.annotation.Nullable Map someMap) { + + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(@javax.annotation.Nullable Map someMap) { + this.someMap = someMap; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..3231a00ed0f3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,148 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FileSchemaTestClass + */ +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + @javax.annotation.Nullable + private ModelFile _file; + + public static final String JSON_PROPERTY_FILES = "files"; + @javax.annotation.Nullable + private List files = new ArrayList<>(); + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(@javax.annotation.Nullable ModelFile _file) { + + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ModelFile getFile() { + return _file; + } + + + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFile(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + } + + public FileSchemaTestClass files(@javax.annotation.Nullable List files) { + + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..161a8e206d43 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Foo.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Foo + */ +@JsonPropertyOrder({ + Foo.JSON_PROPERTY_BAR +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + @javax.annotation.Nullable + private String bar = "bar"; + + public Foo() { + } + + public Foo bar(@javax.annotation.Nullable String bar) { + + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBar(@javax.annotation.Nullable String bar) { + this.bar = bar; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..fb1067ffcb00 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FooGetDefaultResponse + */ +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@JsonTypeName("_foo_get_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + @javax.annotation.Nullable + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(@javax.annotation.Nullable Foo string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(@javax.annotation.Nullable Foo string) { + this.string = string; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..22fbd79aa7d6 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,600 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.vertx.core.file.AsyncFile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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_DECIMAL, + 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_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER +}) +@JsonTypeName("format_test") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + @javax.annotation.Nullable + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + @javax.annotation.Nullable + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + @javax.annotation.Nullable + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + @javax.annotation.Nonnull + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + @javax.annotation.Nullable + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + @javax.annotation.Nullable + private Double _double; + + public static final String JSON_PROPERTY_DECIMAL = "decimal"; + @javax.annotation.Nullable + private BigDecimal decimal; + + public static final String JSON_PROPERTY_STRING = "string"; + @javax.annotation.Nullable + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + @javax.annotation.Nonnull + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + @javax.annotation.Nullable + private AsyncFile binary; + + public static final String JSON_PROPERTY_DATE = "date"; + @javax.annotation.Nonnull + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + @javax.annotation.Nullable + private UUID uuid; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @javax.annotation.Nonnull + private String password; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + @javax.annotation.Nullable + private String patternWithDigits; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + @javax.annotation.Nullable + private String patternWithDigitsAndDelimiter; + + public FormatTest() { + } + + public FormatTest integer(@javax.annotation.Nullable Integer integer) { + + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + } + + public FormatTest int32(@javax.annotation.Nullable Integer int32) { + + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(@javax.annotation.Nullable Long int64) { + + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + } + + public FormatTest number(@javax.annotation.Nonnull BigDecimal number) { + + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + } + + public FormatTest _float(@javax.annotation.Nullable Float _float) { + + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Float _float) { + this._float = _float; + } + + public FormatTest _double(@javax.annotation.Nullable Double _double) { + + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Double _double) { + this._double = _double; + } + + public FormatTest decimal(@javax.annotation.Nullable BigDecimal decimal) { + + this.decimal = decimal; + return this; + } + + /** + * Get decimal + * @return decimal + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getDecimal() { + return decimal; + } + + + @JsonProperty(JSON_PROPERTY_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDecimal(@javax.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + } + + public FormatTest string(@javax.annotation.Nullable String string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String string) { + this.string = string; + } + + public FormatTest _byte(@javax.annotation.Nonnull byte[] _byte) { + + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(@javax.annotation.Nullable AsyncFile binary) { + + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AsyncFile getBinary() { + return binary; + } + + + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBinary(@javax.annotation.Nullable AsyncFile binary) { + this.binary = binary; + } + + public FormatTest date(@javax.annotation.Nonnull LocalDate date) { + + this.date = date; + return this; + } + + /** + * Get date + * @return date + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDate() { + return date; + } + + + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDate(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + } + + public FormatTest dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(@javax.annotation.Nullable UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + public FormatTest password(@javax.annotation.Nonnull String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull String password) { + this.password = password; + } + + public FormatTest patternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigits() { + return patternWithDigits; + } + + + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + public FormatTest patternWithDigitsAndDelimiter(@javax.annotation.Nullable String patternWithDigitsAndDelimiter) { + + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + * @return patternWithDigitsAndDelimiter + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigitsAndDelimiter(@javax.annotation.Nullable String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + @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.decimal, formatTest.decimal) && + 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.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); + } + + @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(" decimal: ").append(toIndentedString(decimal)).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("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..fab16c721c1c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,127 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) +@JsonTypeName("hasOnlyReadOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + @javax.annotation.Nullable + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + @javax.annotation.Nullable + private String foo; + + public HasOnlyReadOnly() { + } + /** + * Constructor with only readonly parameters + */ + @JsonCreator + public HasOnlyReadOnly( + @JsonProperty(JSON_PROPERTY_BAR) String bar, + @JsonProperty(JSON_PROPERTY_FOO) String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + /** + * Get foo + * @return foo + */ + @javax.annotation.Nullable + @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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..8780c33267c5 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -0,0 +1,127 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + @javax.annotation.Nullable + private JsonNullable nullableMessage = JsonNullable.undefined(); + + public HealthCheckResult() { + } + + public HealthCheckResult nullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + */ + @javax.annotation.Nullable + @JsonIgnore + + public String getNullableMessage() { + return nullableMessage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableMessage_JsonNullable() { + return nullableMessage; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + public void setNullableMessage_JsonNullable(JsonNullable nullableMessage) { + this.nullableMessage = nullableMessage; + } + + public void setNullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return equalsNullable(this.nullableMessage, healthCheckResult.nullableMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(hashCodeNullable(nullableMessage)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..226af5128b2b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,269 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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 +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + @javax.annotation.Nullable + private Map> mapMapOfString = new HashMap<>(); + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER(String.valueOf("UPPER")), + + LOWER(String.valueOf("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"; + @javax.annotation.Nullable + private Map mapOfEnumString = new HashMap<>(); + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + @javax.annotation.Nullable + private Map directMap = new HashMap<>(); + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + @javax.annotation.Nullable + private Map indirectMap = new HashMap<>(); + + public MapTest() { + } + + public MapTest mapMapOfString(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest directMap(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..be9066f8a227 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,181 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + @javax.annotation.Nullable + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + @javax.annotation.Nullable + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(@javax.annotation.Nullable UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..f445295ef573 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Model200Response.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model name starting with number + */ +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + @javax.annotation.Nullable + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(@javax.annotation.Nullable Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Integer name) { + this.name = name; + } + + public Model200Response propertyClass(@javax.annotation.Nullable String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..9fce2e1e3bab --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,169 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ModelApiResponse + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@JsonTypeName("ApiResponse") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @javax.annotation.Nullable + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String type) { + this.type = type; + } + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..b56cda290634 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,105 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Must be named `File` for test. + */ +@JsonPropertyOrder({ + ModelFile.JSON_PROPERTY_SOURCE_U_R_I +}) +@JsonTypeName("File") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ModelFile { + public static final String JSON_PROPERTY_SOURCE_U_R_I = "sourceURI"; + @javax.annotation.Nullable + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(@javax.annotation.Nullable String sourceURI) { + + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCE_U_R_I) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSourceURI() { + return sourceURI; + } + + + @JsonProperty(JSON_PROPERTY_SOURCE_U_R_I) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..d0f770be3bdb --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,105 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ModelList + */ +@JsonPropertyOrder({ + ModelList.JSON_PROPERTY_123LIST +}) +@JsonTypeName("List") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ModelList { + public static final String JSON_PROPERTY_123LIST = "123-list"; + @javax.annotation.Nullable + private String _123list; + + public ModelList() { + } + + public ModelList _123list(@javax.annotation.Nullable String _123list) { + + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_123LIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String get123list() { + return _123list; + } + + + @JsonProperty(JSON_PROPERTY_123LIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list); + } + + @Override + public int hashCode() { + return Objects.hash(_123list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..a5e4c8656d48 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,105 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing reserved words + */ +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) +@JsonTypeName("Return") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + @javax.annotation.Nullable + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(@javax.annotation.Nullable Integer _return) { + + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..7c79599ff5d8 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,190 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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 +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + @javax.annotation.Nullable + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + @javax.annotation.Nullable + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + @javax.annotation.Nullable + private Integer _123number; + + public Name() { + } + /** + * Constructor with only readonly parameters + */ + @JsonCreator + public Name( + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) Integer snakeCase, + @JsonProperty(JSON_PROPERTY_123NUMBER) Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(@javax.annotation.Nonnull Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull Integer name) { + this.name = name; + } + + /** + * Get snakeCase + * @return snakeCase + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSnakeCase() { + return snakeCase; + } + + + + public Name property(@javax.annotation.Nullable String property) { + + this.property = property; + return this; + } + + /** + * Get property + * @return property + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String property) { + this.property = property; + } + + /** + * Get _123number + * @return _123number + */ + @javax.annotation.Nullable + @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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..44dc3d35a5ac --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,626 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * NullableClass + */ +@JsonPropertyOrder({ + NullableClass.JSON_PROPERTY_INTEGER_PROP, + NullableClass.JSON_PROPERTY_NUMBER_PROP, + NullableClass.JSON_PROPERTY_BOOLEAN_PROP, + NullableClass.JSON_PROPERTY_STRING_PROP, + NullableClass.JSON_PROPERTY_DATE_PROP, + NullableClass.JSON_PROPERTY_DATETIME_PROP, + NullableClass.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + NullableClass.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class NullableClass extends HashMap { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + @javax.annotation.Nullable + private JsonNullable integerProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + @javax.annotation.Nullable + private JsonNullable numberProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + @javax.annotation.Nullable + private JsonNullable booleanProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + @javax.annotation.Nullable + private JsonNullable stringProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + @javax.annotation.Nullable + private JsonNullable dateProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + @javax.annotation.Nullable + private JsonNullable datetimeProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @javax.annotation.Nullable + private JsonNullable> arrayNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @javax.annotation.Nullable + private JsonNullable> arrayAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @javax.annotation.Nullable + private List arrayItemsNullable = new ArrayList<>(); + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @javax.annotation.Nullable + private JsonNullable> objectNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @javax.annotation.Nullable + private JsonNullable> objectAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @javax.annotation.Nullable + private Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + + } + + public NullableClass integerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public Integer getIntegerProp() { + return integerProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIntegerProp_JsonNullable() { + return integerProp; + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + public void setIntegerProp_JsonNullable(JsonNullable integerProp) { + this.integerProp = integerProp; + } + + public void setIntegerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + } + + public NullableClass numberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public BigDecimal getNumberProp() { + return numberProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNumberProp_JsonNullable() { + return numberProp; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + public void setNumberProp_JsonNullable(JsonNullable numberProp) { + this.numberProp = numberProp; + } + + public void setNumberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + } + + public NullableClass booleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public Boolean getBooleanProp() { + return booleanProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getBooleanProp_JsonNullable() { + return booleanProp; + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + public void setBooleanProp_JsonNullable(JsonNullable booleanProp) { + this.booleanProp = booleanProp; + } + + public void setBooleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + } + + public NullableClass stringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public String getStringProp() { + return stringProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getStringProp_JsonNullable() { + return stringProp; + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + public void setStringProp_JsonNullable(JsonNullable stringProp) { + this.stringProp = stringProp; + } + + public void setStringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + } + + public NullableClass dateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public LocalDate getDateProp() { + return dateProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDateProp_JsonNullable() { + return dateProp; + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + public void setDateProp_JsonNullable(JsonNullable dateProp) { + this.dateProp = dateProp; + } + + public void setDateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + } + + public NullableClass datetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public OffsetDateTime getDatetimeProp() { + return datetimeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDatetimeProp_JsonNullable() { + return datetimeProp; + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + public void setDatetimeProp_JsonNullable(JsonNullable datetimeProp) { + this.datetimeProp = datetimeProp; + } + + public void setDatetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + } + + public NullableClass arrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayNullableProp.get().add(arrayNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public List getArrayNullableProp() { + return arrayNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayNullableProp_JsonNullable() { + return arrayNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + public void setArrayNullableProp_JsonNullable(JsonNullable> arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public void setArrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + } + + public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayAndItemsNullableProp_JsonNullable() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + public void setArrayAndItemsNullableProp_JsonNullable(JsonNullable> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + } + + public NullableClass arrayItemsNullable(@javax.annotation.Nullable List arrayItemsNullable) { + + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayItemsNullable(@javax.annotation.Nullable List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass objectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) { + this.objectNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectNullableProp.get().put(key, objectNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public Map getObjectNullableProp() { + return objectNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectNullableProp_JsonNullable() { + return objectNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + public void setObjectNullableProp_JsonNullable(JsonNullable> objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public void setObjectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + } + + public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonIgnore + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectAndItemsNullableProp_JsonNullable() { + return objectAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + public void setObjectAndItemsNullableProp_JsonNullable(JsonNullable> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + } + + public NullableClass objectItemsNullable(@javax.annotation.Nullable Map objectItemsNullable) { + + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + /** + * Get objectItemsNullable + * @return objectItemsNullable + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectItemsNullable(@javax.annotation.Nullable Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return equalsNullable(this.integerProp, nullableClass.integerProp) && + equalsNullable(this.numberProp, nullableClass.numberProp) && + equalsNullable(this.booleanProp, nullableClass.booleanProp) && + equalsNullable(this.stringProp, nullableClass.stringProp) && + equalsNullable(this.dateProp, nullableClass.dateProp) && + equalsNullable(this.datetimeProp, nullableClass.datetimeProp) && + equalsNullable(this.arrayNullableProp, nullableClass.arrayNullableProp) && + equalsNullable(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) && + equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..2b2688a79089 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,105 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + @javax.annotation.Nullable + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(@javax.annotation.Nullable BigDecimal justNumber) { + + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..027bfe18ab35 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,219 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ObjectWithDeprecatedFields + */ +@JsonPropertyOrder({ + ObjectWithDeprecatedFields.JSON_PROPERTY_UUID, + ObjectWithDeprecatedFields.JSON_PROPERTY_ID, + ObjectWithDeprecatedFields.JSON_PROPERTY_DEPRECATED_REF, + ObjectWithDeprecatedFields.JSON_PROPERTY_BARS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ObjectWithDeprecatedFields { + public static final String JSON_PROPERTY_UUID = "uuid"; + @javax.annotation.Nullable + private String uuid; + + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private BigDecimal id; + + public static final String JSON_PROPERTY_DEPRECATED_REF = "deprecatedRef"; + @javax.annotation.Nullable + private DeprecatedObject deprecatedRef; + + public static final String JSON_PROPERTY_BARS = "bars"; + @javax.annotation.Nullable + private List bars = new ArrayList<>(); + + public ObjectWithDeprecatedFields() { + } + + public ObjectWithDeprecatedFields uuid(@javax.annotation.Nullable String uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUuid() { + return uuid; + } + + + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(@javax.annotation.Nullable String uuid) { + this.uuid = uuid; + } + + public ObjectWithDeprecatedFields id(@javax.annotation.Nullable BigDecimal id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getId() { + return id; + } + + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable BigDecimal id) { + this.id = id; + } + + public ObjectWithDeprecatedFields deprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + + this.deprecatedRef = deprecatedRef; + return this; + } + + /** + * Get deprecatedRef + * @return deprecatedRef + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DEPRECATED_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + + @JsonProperty(JSON_PROPERTY_DEPRECATED_REF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + public ObjectWithDeprecatedFields bars(@javax.annotation.Nullable List bars) { + + this.bars = bars; + return this; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + this.bars.add(barsItem); + return this; + } + + /** + * Get bars + * @return bars + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BARS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getBars() { + return bars; + } + + + @JsonProperty(JSON_PROPERTY_BARS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBars(@javax.annotation.Nullable List bars) { + this.bars = bars; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o; + return Objects.equals(this.uuid, objectWithDeprecatedFields.uuid) && + Objects.equals(this.id, objectWithDeprecatedFields.id) && + Objects.equals(this.deprecatedRef, objectWithDeprecatedFields.deprecatedRef) && + Objects.equals(this.bars, objectWithDeprecatedFields.bars); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, id, deprecatedRef, bars); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..19a6f2e22dd1 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Order.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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 +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @javax.annotation.Nullable + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @javax.annotation.Nullable + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED(String.valueOf("placed")), + + APPROVED(String.valueOf("approved")), + + DELIVERED(String.valueOf("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"; + @javax.annotation.Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Long id) { + this.id = id; + } + + public Order petId(@javax.annotation.Nullable Long petId) { + + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getShipDate() { + return shipDate; + } + + + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + public Order status(@javax.annotation.Nullable StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + public Order complete(@javax.annotation.Nullable Boolean complete) { + + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..7b928ac82f35 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,169 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * OuterComposite + */ +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + @javax.annotation.Nullable + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + @javax.annotation.Nullable + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + @javax.annotation.Nullable + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(@javax.annotation.Nullable BigDecimal myNumber) { + + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(@javax.annotation.Nullable String myString) { + + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(@javax.annotation.Nullable Boolean myBoolean) { + + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..4cd955b63dc3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,61 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +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; + } + } + return null; + } +} + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..73077cc8c31c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -0,0 +1,61 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..e6c2e38c2e7c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,61 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..ef61373b187f --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,61 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java new file mode 100644 index 000000000000..a8d574446886 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java @@ -0,0 +1,105 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnumInteger; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * OuterObjectWithEnumProperty + */ +@JsonPropertyOrder({ + OuterObjectWithEnumProperty.JSON_PROPERTY_VALUE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class OuterObjectWithEnumProperty { + public static final String JSON_PROPERTY_VALUE = "value"; + @javax.annotation.Nonnull + private OuterEnumInteger value; + + public OuterObjectWithEnumProperty() { + } + + public OuterObjectWithEnumProperty value(@javax.annotation.Nonnull OuterEnumInteger value) { + + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public OuterEnumInteger getValue() { + return value; + } + + + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull OuterEnumInteger value) { + this.value = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o; + return Objects.equals(this.value, outerObjectWithEnumProperty.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterObjectWithEnumProperty {\n"); + sb.append(" value: ").append(toIndentedString(value)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ParentWithNullable.java new file mode 100644 index 000000000000..44d26ee7013f --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ParentWithNullable.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ParentWithNullable + */ +@JsonPropertyOrder({ + ParentWithNullable.JSON_PROPERTY_TYPE, + ParentWithNullable.JSON_PROPERTY_NULLABLE_PROPERTY +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"), +}) + +public class ParentWithNullable { + /** + * Gets or Sets type + */ + public enum TypeEnum { + CHILD_WITH_NULLABLE(String.valueOf("ChildWithNullable")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nullable + protected TypeEnum type; + + public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty"; + @javax.annotation.Nullable + protected JsonNullable nullableProperty = JsonNullable.undefined(); + + public ParentWithNullable() { + } + + public ParentWithNullable type(@javax.annotation.Nullable TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + public ParentWithNullable nullableProperty(@javax.annotation.Nullable String nullableProperty) { + this.nullableProperty = JsonNullable.of(nullableProperty); + + return this; + } + + /** + * Get nullableProperty + * @return nullableProperty + */ + @javax.annotation.Nullable + @JsonIgnore + + public String getNullableProperty() { + return nullableProperty.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableProperty_JsonNullable() { + return nullableProperty; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_PROPERTY) + public void setNullableProperty_JsonNullable(JsonNullable nullableProperty) { + this.nullableProperty = nullableProperty; + } + + public void setNullableProperty(@javax.annotation.Nullable String nullableProperty) { + this.nullableProperty = JsonNullable.of(nullableProperty); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParentWithNullable parentWithNullable = (ParentWithNullable) o; + return Objects.equals(this.type, parentWithNullable.type) && + equalsNullable(this.nullableProperty, parentWithNullable.nullableProperty); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, hashCodeNullable(nullableProperty)); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentWithNullable {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..9c64c19a7c2c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,326 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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 +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @javax.annotation.Nonnull + private Set photoUrls = new LinkedHashSet<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE(String.valueOf("available")), + + PENDING(String.valueOf("pending")), + + SOLD(String.valueOf("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"; + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Long id) { + this.id = id; + } + + public Pet category(@javax.annotation.Nullable Category category) { + + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Category category) { + this.category = category; + } + + public Pet name(@javax.annotation.Nonnull String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @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(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public Pet photoUrls(@javax.annotation.Nonnull Set photoUrls) { + + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new LinkedHashSet<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Set getPhotoUrls() { + return photoUrls; + } + + + @JsonDeserialize(as = LinkedHashSet.class) + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull Set photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(@javax.annotation.Nullable 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 + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..784d47d6a106 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,135 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + @javax.annotation.Nullable + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + @javax.annotation.Nullable + private String baz; + + public ReadOnlyFirst() { + } + /** + * Constructor with only readonly parameters + */ + @JsonCreator + public ReadOnlyFirst( + @JsonProperty(JSON_PROPERTY_BAR) String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + public ReadOnlyFirst baz(@javax.annotation.Nullable String baz) { + + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/SingleRefType.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/SingleRefType.java new file mode 100644 index 000000000000..f99224547559 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/SingleRefType.java @@ -0,0 +1,59 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SingleRefType + */ +public enum SingleRefType { + + ADMIN("admin"), + + USER("user"); + + private String value; + + SingleRefType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SingleRefType fromValue(String value) { + for (SingleRefType b : SingleRefType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..7e37da197795 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,105 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME +}) +@JsonTypeName("_special_model.name_") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @javax.annotation.Nullable + private Long $specialPropertyName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..fc2ee7bfc564 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,136 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Long id) { + this.id = id; + } + + public Tag name(@javax.annotation.Nullable String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..b8c473679982 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +@JsonPropertyOrder({ + TestInlineFreeformAdditionalPropertiesRequest.JSON_PROPERTY_SOME_PROPERTY +}) +@JsonTypeName("testInlineFreeformAdditionalProperties_request") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap { + public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty"; + @javax.annotation.Nullable + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + + } + + public TestInlineFreeformAdditionalPropertiesRequest someProperty(@javax.annotation.Nullable String someProperty) { + + this.someProperty = someProperty; + return this; + } + + /** + * Get someProperty + * @return someProperty + */ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSomeProperty() { + return someProperty; + } + + + @JsonProperty(JSON_PROPERTY_SOME_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeProperty(@javax.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o; + return Objects.equals(this.someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(someProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).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/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..4aa0d35c2889 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,328 @@ +/* + * 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.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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 +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @javax.annotation.Nullable + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @javax.annotation.Nullable + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @javax.annotation.Nullable + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @javax.annotation.Nullable + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @javax.annotation.Nullable + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable Long id) { + this.id = id; + } + + public User username(@javax.annotation.Nullable String username) { + + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String username) { + this.username = username; + } + + public User firstName(@javax.annotation.Nullable String firstName) { + + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + public User lastName(@javax.annotation.Nullable String lastName) { + + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + public User email(@javax.annotation.Nullable String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String email) { + this.email = email; + } + + public User password(@javax.annotation.Nullable String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String password) { + this.password = password; + } + + public User phone(@javax.annotation.Nullable String phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @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(@javax.annotation.Nullable 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/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..249eceb90ae3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,68 @@ +/* + * 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.client.api; + +import org.openapitools.client.model.Client; + +import org.openapitools.client.Configuration; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.json.JsonObject; +import io.vertx.core.Vertx; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.ext.unit.junit.RunTestOnContext; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.Async; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Disabled +public class AnotherFakeApiTest { + + private AnotherFakeApi api; + + @BeforeAll + public void setupApiClient() { + api = new AnotherFakeApiImpl(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * + * @param context Vertx test context for doing assertions + */ + @Test + public void call123testSpecialTagsTest(TestContext testContext) { + Async async = testContext.async(); + Client client = null; + api.call123testSpecialTags(client, result -> { + // TODO: test validations + async.complete(); + }); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..84ffe45ce619 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,67 @@ +/* + * 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.client.api; + +import org.openapitools.client.model.FooGetDefaultResponse; + +import org.openapitools.client.Configuration; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.json.JsonObject; +import io.vertx.core.Vertx; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.ext.unit.junit.RunTestOnContext; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.Async; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private DefaultApi api; + + @BeforeAll + public void setupApiClient() { + api = new DefaultApiImpl(); + } + + /** + * + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fooGetTest(TestContext testContext) { + Async async = testContext.async(); + api.fooGet(result -> { + // TODO: test validations + async.complete(); + }); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..2004d3803671 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,431 @@ +/* + * 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.client.api; + +import io.vertx.core.file.AsyncFile; +import java.math.BigDecimal; +import org.openapitools.client.model.ChildWithNullable; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterObjectWithEnumProperty; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; + +import org.openapitools.client.Configuration; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.json.JsonObject; +import io.vertx.core.Vertx; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.ext.unit.junit.RunTestOnContext; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.Async; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private FakeApi api; + + @BeforeAll + public void setupApiClient() { + api = new FakeApiImpl(); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakeBigDecimalMapTest(TestContext testContext) { + Async async = testContext.async(); + api.fakeBigDecimalMap(result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Health check endpoint + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakeHealthGetTest(TestContext testContext) { + Async async = testContext.async(); + api.fakeHealthGet(result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * test http signature authentication + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakeHttpSignatureTestTest(TestContext testContext) { + Async async = testContext.async(); + Pet pet = null; + String query1 = null; + String header1 = null; + api.fakeHttpSignatureTest(pet, query1, header1, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * Test serialization of outer boolean types + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakeOuterBooleanSerializeTest(TestContext testContext) { + Async async = testContext.async(); + Boolean body = null; + api.fakeOuterBooleanSerialize(body, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * Test serialization of object with outer number type + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakeOuterCompositeSerializeTest(TestContext testContext) { + Async async = testContext.async(); + OuterComposite outerComposite = null; + api.fakeOuterCompositeSerialize(outerComposite, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * Test serialization of outer number types + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakeOuterNumberSerializeTest(TestContext testContext) { + Async async = testContext.async(); + BigDecimal body = null; + api.fakeOuterNumberSerialize(body, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * Test serialization of outer string types + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakeOuterStringSerializeTest(TestContext testContext) { + Async async = testContext.async(); + String body = null; + api.fakeOuterStringSerialize(body, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * Test serialization of enum (int) properties with examples + * + * @param context Vertx test context for doing assertions + */ + @Test + public void fakePropertyEnumIntegerSerializeTest(TestContext testContext) { + Async async = testContext.async(); + OuterObjectWithEnumProperty outerObjectWithEnumProperty = null; + api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * test referenced additionalProperties + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testAdditionalPropertiesReferenceTest(TestContext testContext) { + Async async = testContext.async(); + Map requestBody = null; + api.testAdditionalPropertiesReference(requestBody, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * For this test, the body has to be a binary file. + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testBodyWithBinaryTest(TestContext testContext) { + Async async = testContext.async(); + AsyncFile body = null; + api.testBodyWithBinary(body, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * For this test, the body for this request must reference a schema named `File`. + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testBodyWithFileSchemaTest(TestContext testContext) { + Async async = testContext.async(); + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testBodyWithQueryParamsTest(TestContext testContext) { + Async async = testContext.async(); + String query = null; + User user = null; + api.testBodyWithQueryParams(query, user, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * To test \"client\" model + * To test \"client\" model + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testClientModelTest(TestContext testContext) { + Async async = testContext.async(); + Client client = null; + api.testClientModel(client, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testEndpointParametersTest(TestContext testContext) { + Async async = testContext.async(); + 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; + AsyncFile binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * To test enum parameters + * To test enum parameters + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testEnumParametersTest(TestContext testContext) { + Async async = testContext.async(); + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumQueryModelArray = null; + List enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testGroupParametersTest(TestContext testContext) { + Async async = testContext.async(); + 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, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * test inline additionalProperties + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testInlineAdditionalPropertiesTest(TestContext testContext) { + Async async = testContext.async(); + Map requestBody = null; + api.testInlineAdditionalProperties(requestBody, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * test inline free-form additionalProperties + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testInlineFreeformAdditionalPropertiesTest(TestContext testContext) { + Async async = testContext.async(); + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = null; + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * test json serialization of form data + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testJsonFormDataTest(TestContext testContext) { + Async async = testContext.async(); + String param = null; + String param2 = null; + api.testJsonFormData(param, param2, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * test nullable parent property + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testNullableTest(TestContext testContext) { + Async async = testContext.async(); + ChildWithNullable childWithNullable = null; + api.testNullable(childWithNullable, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * + * To test the collection format in query parameters + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testQueryParameterCollectionFormatTest(TestContext testContext) { + Async async = testContext.async(); + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + String allowEmpty = null; + Map language = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * test referenced string map + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testStringMapReferenceTest(TestContext testContext) { + Async async = testContext.async(); + Map requestBody = null; + api.testStringMapReference(requestBody, result -> { + // TODO: test validations + async.complete(); + }); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..692c23f6bd27 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,68 @@ +/* + * 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.client.api; + +import org.openapitools.client.model.Client; + +import org.openapitools.client.Configuration; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.json.JsonObject; +import io.vertx.core.Vertx; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.ext.unit.junit.RunTestOnContext; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.Async; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Disabled +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @BeforeAll + public void setupApiClient() { + api = new FakeClassnameTags123ApiImpl(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * + * @param context Vertx test context for doing assertions + */ + @Test + public void testClassnameTest(TestContext testContext) { + Async async = testContext.async(); + Client client = null; + api.testClassname(client, result -> { + // TODO: test validations + async.complete(); + }); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..18a10252a46c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,198 @@ +/* + * 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.client.api; + +import io.vertx.core.file.AsyncFile; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; + +import org.openapitools.client.Configuration; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.json.JsonObject; +import io.vertx.core.Vertx; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.ext.unit.junit.RunTestOnContext; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.Async; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private PetApi api; + + @BeforeAll + public void setupApiClient() { + api = new PetApiImpl(); + } + + /** + * Add a new pet to the store + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void addPetTest(TestContext testContext) { + Async async = testContext.async(); + Pet pet = null; + api.addPet(pet, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Deletes a pet + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void deletePetTest(TestContext testContext) { + Async async = testContext.async(); + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param context Vertx test context for doing assertions + */ + @Test + public void findPetsByStatusTest(TestContext testContext) { + Async async = testContext.async(); + List status = null; + api.findPetsByStatus(status, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param context Vertx test context for doing assertions + */ + @Test + public void findPetsByTagsTest(TestContext testContext) { + Async async = testContext.async(); + Set tags = null; + api.findPetsByTags(tags, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Find pet by ID + * Returns a single pet + * + * @param context Vertx test context for doing assertions + */ + @Test + public void getPetByIdTest(TestContext testContext) { + Async async = testContext.async(); + Long petId = null; + api.getPetById(petId, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Update an existing pet + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void updatePetTest(TestContext testContext) { + Async async = testContext.async(); + Pet pet = null; + api.updatePet(pet, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Updates a pet in the store with form data + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void updatePetWithFormTest(TestContext testContext) { + Async async = testContext.async(); + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * uploads an image + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void uploadFileTest(TestContext testContext) { + Async async = testContext.async(); + Long petId = null; + String additionalMetadata = null; + AsyncFile _file = null; + api.uploadFile(petId, additionalMetadata, _file, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * uploads an image (required) + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void uploadFileWithRequiredFileTest(TestContext testContext) { + Async async = testContext.async(); + Long petId = null; + AsyncFile requiredFile = null; + String additionalMetadata = null; + api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, result -> { + // TODO: test validations + async.complete(); + }); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..757b3a802cc1 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,112 @@ +/* + * 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.client.api; + +import org.openapitools.client.model.Order; + +import org.openapitools.client.Configuration; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.json.JsonObject; +import io.vertx.core.Vertx; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.ext.unit.junit.RunTestOnContext; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.Async; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private StoreApi api; + + @BeforeAll + public void setupApiClient() { + api = new StoreApiImpl(); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @param context Vertx test context for doing assertions + */ + @Test + public void deleteOrderTest(TestContext testContext) { + Async async = testContext.async(); + String orderId = null; + api.deleteOrder(orderId, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @param context Vertx test context for doing assertions + */ + @Test + public void getInventoryTest(TestContext testContext) { + Async async = testContext.async(); + api.getInventory(result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @param context Vertx test context for doing assertions + */ + @Test + public void getOrderByIdTest(TestContext testContext) { + Async async = testContext.async(); + Long orderId = null; + api.getOrderById(orderId, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Place an order for a pet + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void placeOrderTest(TestContext testContext) { + Async async = testContext.async(); + Order order = null; + api.placeOrder(order, result -> { + // TODO: test validations + async.complete(); + }); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..debaeec310f6 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/api/UserApiTest.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.client.api; + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import org.openapitools.client.Configuration; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.json.JsonObject; +import io.vertx.core.Vertx; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.ext.unit.junit.RunTestOnContext; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.Async; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private UserApi api; + + @BeforeAll + public void setupApiClient() { + api = new UserApiImpl(); + } + + /** + * Create user + * This can only be done by the logged in user. + * + * @param context Vertx test context for doing assertions + */ + @Test + public void createUserTest(TestContext testContext) { + Async async = testContext.async(); + User user = null; + api.createUser(user, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Creates list of users with given input array + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void createUsersWithArrayInputTest(TestContext testContext) { + Async async = testContext.async(); + List user = null; + api.createUsersWithArrayInput(user, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Creates list of users with given input array + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void createUsersWithListInputTest(TestContext testContext) { + Async async = testContext.async(); + List user = null; + api.createUsersWithListInput(user, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Delete user + * This can only be done by the logged in user. + * + * @param context Vertx test context for doing assertions + */ + @Test + public void deleteUserTest(TestContext testContext) { + Async async = testContext.async(); + String username = null; + api.deleteUser(username, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Get user by user name + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void getUserByNameTest(TestContext testContext) { + Async async = testContext.async(); + String username = null; + api.getUserByName(username, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Logs user into the system + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void loginUserTest(TestContext testContext) { + Async async = testContext.async(); + String username = null; + String password = null; + api.loginUser(username, password, result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Logs out current logged in user session + * + * + * @param context Vertx test context for doing assertions + */ + @Test + public void logoutUserTest(TestContext testContext) { + Async async = testContext.async(); + api.logoutUser(result -> { + // TODO: test validations + async.complete(); + }); + } + /** + * Updated user + * This can only be done by the logged in user. + * + * @param context Vertx test context for doing assertions + */ + @Test + public void updateUserTest(TestContext testContext) { + Async async = testContext.async(); + String username = null; + User user = null; + api.updateUser(username, user, result -> { + // TODO: test validations + async.complete(); + }); + } +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..6bdecfe07c92 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,57 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapProperty' + */ + @Test + void mapPropertyTest() { + // TODO: test mapProperty + } + + /** + * Test the property 'mapOfMapProperty' + */ + @Test + void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AllOfWithSingleRefTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AllOfWithSingleRefTest.java new file mode 100644 index 000000000000..f4b06d323d63 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AllOfWithSingleRefTest.java @@ -0,0 +1,56 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.SingleRefType; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfWithSingleRef + */ +class AllOfWithSingleRefTest { + private final AllOfWithSingleRef model = new AllOfWithSingleRef(); + + /** + * Model tests for AllOfWithSingleRef + */ + @Test + void testAllOfWithSingleRef() { + // TODO: test AllOfWithSingleRef + } + + /** + * Test the property 'username' + */ + @Test + void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'singleRefType' + */ + @Test + void singleRefTypeTest() { + // TODO: test singleRefType + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..24776d3cb515 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,58 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..6bbe877044db --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..eaf908bb1ab7 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..99c6bcf53601 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,67 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..a0217acd1f20 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,87 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..1b389a075be0 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,67 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..22fcbd7f3ccb --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ChildWithNullableTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ChildWithNullableTest.java new file mode 100644 index 000000000000..a89d26497bc3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ChildWithNullableTest.java @@ -0,0 +1,68 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ParentWithNullable; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ChildWithNullable + */ +class ChildWithNullableTest { + private final ChildWithNullable model = new ChildWithNullable(); + + /** + * Model tests for ChildWithNullable + */ + @Test + void testChildWithNullable() { + // TODO: test ChildWithNullable + } + + /** + * Test the property 'type' + */ + @Test + void typeTest() { + // TODO: test type + } + + /** + * Test the property 'nullableProperty' + */ + @Test + void nullablePropertyTest() { + // TODO: test nullableProperty + } + + /** + * Test the property 'otherProperty' + */ + @Test + void otherPropertyTest() { + // TODO: test otherProperty + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..6ef5c744fbcb --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..8028f11bc2b9 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java new file mode 100644 index 000000000000..b04c2097b209 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DeprecatedObject + */ +class DeprecatedObjectTest { + private final DeprecatedObject model = new DeprecatedObject(); + + /** + * Model tests for DeprecatedObject + */ + @Test + void testDeprecatedObject() { + // TODO: test DeprecatedObject + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..b2a12ab4c5e0 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,67 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..4a755b0d4425 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,58 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..48aa1a737fce --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -0,0 +1,32 @@ +/* + * 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.client.model; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..1e65944cbdc9 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,111 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumNumber' + */ + @Test + void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + void outerEnumTest() { + // TODO: test outerEnum + } + + /** + * Test the property 'outerEnumInteger' + */ + @Test + void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } + + /** + * Test the property 'outerEnumDefaultValue' + */ + @Test + void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + + /** + * Test the property 'outerEnumIntegerDefaultValue' + */ + @Test + void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 000000000000..3250ad91974c --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,58 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..0048cb2c7497 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,59 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 000000000000..81bc69c9a7b4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Foo; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FooGetDefaultResponse + */ +class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..a9e2c8c126e1 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Foo + */ +class FooTest { + private final Foo model = new Foo(); + + /** + * Model tests for Foo + */ + @Test + void testFoo() { + // TODO: test Foo + } + + /** + * Test the property 'bar' + */ + @Test + void barTest() { + // TODO: test bar + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..1d42701a4540 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,172 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.vertx.core.file.AsyncFile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'decimal' + */ + @Test + void decimalTest() { + // TODO: test decimal + } + + /** + * Test the property 'string' + */ + @Test + void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'password' + */ + @Test + void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'patternWithDigits' + */ + @Test + void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** + * Test the property 'patternWithDigitsAndDelimiter' + */ + @Test + void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..908f0aff6ed7 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,55 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..0f45c2fcd5ba --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,51 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HealthCheckResult + */ +class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** + * Model tests for HealthCheckResult + */ + @Test + void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** + * Test the property 'nullableMessage' + */ + @Test + void nullableMessageTest() { + // TODO: test nullableMessage + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..3752c5ba31fd --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,73 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..0f47e193af8d --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,68 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..5743b70142b8 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,55 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..436e4abd59e3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..f128d7b9ac2e --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..92273f48d239 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..1c5337654cd4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..1a6aa18fa20d --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,71 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..d960ef76e5c3 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -0,0 +1,147 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableClass + */ +class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** + * Model tests for NullableClass + */ + @Test + void testNullableClass() { + // TODO: test NullableClass + } + + /** + * Test the property 'integerProp' + */ + @Test + void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..8623386a5e95 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/NumberOnlyTest.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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java new file mode 100644 index 000000000000..aa755cf8cb48 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java @@ -0,0 +1,76 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ObjectWithDeprecatedFields + */ +class ObjectWithDeprecatedFieldsTest { + private final ObjectWithDeprecatedFields model = new ObjectWithDeprecatedFields(); + + /** + * Model tests for ObjectWithDeprecatedFields + */ + @Test + void testObjectWithDeprecatedFields() { + // TODO: test ObjectWithDeprecatedFields + } + + /** + * Test the property 'uuid' + */ + @Test + void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'deprecatedRef' + */ + @Test + void deprecatedRefTest() { + // TODO: test deprecatedRef + } + + /** + * Test the property 'bars' + */ + @Test + void barsTest() { + // TODO: test bars + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..670c2535646b --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..870a977da944 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,64 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..d818b23c7d53 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java @@ -0,0 +1,32 @@ +/* + * 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.client.model; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumDefaultValue + */ +class OuterEnumDefaultValueTest { + /** + * Model tests for OuterEnumDefaultValue + */ + @Test + void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..1d7b3338bca2 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java @@ -0,0 +1,32 @@ +/* + * 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.client.model; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumIntegerDefaultValue + */ +class OuterEnumIntegerDefaultValueTest { + /** + * Model tests for OuterEnumIntegerDefaultValue + */ + @Test + void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..cacda46a76f4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java @@ -0,0 +1,32 @@ +/* + * 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.client.model; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumInteger + */ +class OuterEnumIntegerTest { + /** + * Model tests for OuterEnumInteger + */ + @Test + void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..0333ee657a0f --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -0,0 +1,32 @@ +/* + * 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.client.model; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterObjectWithEnumPropertyTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterObjectWithEnumPropertyTest.java new file mode 100644 index 000000000000..ac7169192a50 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/OuterObjectWithEnumPropertyTest.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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterObjectWithEnumProperty + */ +class OuterObjectWithEnumPropertyTest { + private final OuterObjectWithEnumProperty model = new OuterObjectWithEnumProperty(); + + /** + * Model tests for OuterObjectWithEnumProperty + */ + @Test + void testOuterObjectWithEnumProperty() { + // TODO: test OuterObjectWithEnumProperty + } + + /** + * Test the property 'value' + */ + @Test + void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ParentWithNullableTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ParentWithNullableTest.java new file mode 100644 index 000000000000..2e4de5618065 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ParentWithNullableTest.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.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ParentWithNullable + */ +class ParentWithNullableTest { + private final ParentWithNullable model = new ParentWithNullable(); + + /** + * Model tests for ParentWithNullable + */ + @Test + void testParentWithNullable() { + // TODO: test ParentWithNullable + } + + /** + * Test the property 'type' + */ + @Test + void typeTest() { + // TODO: test type + } + + /** + * Test the property 'nullableProperty' + */ + @Test + void nullablePropertyTest() { + // TODO: test nullableProperty + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..2e4303f1e4b5 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,95 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..c56da4290fa9 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,55 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/SingleRefTypeTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/SingleRefTypeTest.java new file mode 100644 index 000000000000..476e4ca161b4 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/SingleRefTypeTest.java @@ -0,0 +1,32 @@ +/* + * 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.client.model; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SingleRefType + */ +class SingleRefTypeTest { + /** + * Model tests for SingleRefType + */ + @Test + void testSingleRefType() { + // TODO: test SingleRefType + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..9501cf722d66 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,47 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..dc9cf9742efa --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java new file mode 100644 index 000000000000..edb986ca550f --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java @@ -0,0 +1,49 @@ +/* + * 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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ +class TestInlineFreeformAdditionalPropertiesRequestTest { + private final TestInlineFreeformAdditionalPropertiesRequest model = new TestInlineFreeformAdditionalPropertiesRequest(); + + /** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ + @Test + void testTestInlineFreeformAdditionalPropertiesRequest() { + // TODO: test TestInlineFreeformAdditionalPropertiesRequest + } + + /** + * Test the property 'someProperty' + */ + @Test + void somePropertyTest() { + // TODO: test someProperty + } + +} diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..69d274133b97 --- /dev/null +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/test/java/org/openapitools/client/model/UserTest.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.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle.properties b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle.properties index 5bac8ac50462..a9707aaf9931 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle.properties +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-volley/gradle.properties @@ -1 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# android.useAndroidX=true diff --git a/samples/client/petstore/kotlin-default-values-jvm-volley/gradle.properties b/samples/client/petstore/kotlin-default-values-jvm-volley/gradle.properties index 646c51b977f3..3b3d9b0770bc 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-volley/gradle.properties +++ b/samples/client/petstore/kotlin-default-values-jvm-volley/gradle.properties @@ -1,2 +1,7 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# android.useAndroidX=true android.enableJetifier=true diff --git a/samples/client/petstore/kotlin-jvm-volley/gradle.properties b/samples/client/petstore/kotlin-jvm-volley/gradle.properties index 646c51b977f3..3b3d9b0770bc 100644 --- a/samples/client/petstore/kotlin-jvm-volley/gradle.properties +++ b/samples/client/petstore/kotlin-jvm-volley/gradle.properties @@ -1,2 +1,7 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# android.useAndroidX=true android.enableJetifier=true diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES index 15feb03a699f..66030f86f31f 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/.openapi-generator/FILES @@ -30,6 +30,7 @@ docs/Model/EnumArrays.md docs/Model/EnumClass.md docs/Model/EnumTest.md docs/Model/EnumWithNameAndDescription.md +docs/Model/Error.md docs/Model/ErrorResponse.md docs/Model/FakeBigDecimalMap200Response.md docs/Model/File.md @@ -74,6 +75,7 @@ src/Api/StoreApi.php src/Api/UserApi.php src/ApiException.php src/Configuration.php +src/FormDataProcessor.php src/HeaderSelector.php src/Model/AdditionalPropertiesClass.php src/Model/AllOfWithSingleRef.php @@ -94,6 +96,7 @@ src/Model/EnumArrays.php src/Model/EnumClass.php src/Model/EnumTest.php src/Model/EnumWithNameAndDescription.php +src/Model/Error.php src/Model/ErrorResponse.php src/Model/FakeBigDecimalMap200Response.php src/Model/File.php diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md index 103d2a59c10d..05dd8d2e7e9c 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md @@ -72,8 +72,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123TestSpecialTags**](docs/Api/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**error**](docs/Api/DefaultApi.md#error) | **GET** /error | Will always generate an error *DefaultApi* | [**fooGet**](docs/Api/DefaultApi.md#fooget) | **GET** /foo | *FakeApi* | [**fakeBigDecimalMap**](docs/Api/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +*FakeApi* | [**fakeDeletePet**](docs/Api/FakeApi.md#fakedeletepet) | **DELETE** /fake/pet/{pet_id} | *FakeApi* | [**fakeEnumEndpoint**](docs/Api/FakeApi.md#fakeenumendpoint) | **GET** /fake/enum/endpoint | test endpoint with enum parameter *FakeApi* | [**fakeHealthGet**](docs/Api/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](docs/Api/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication @@ -145,6 +147,7 @@ Class | Method | HTTP request | Description - [EnumClass](docs/Model/EnumClass.md) - [EnumTest](docs/Model/EnumTest.md) - [EnumWithNameAndDescription](docs/Model/EnumWithNameAndDescription.md) +- [Error](docs/Model/Error.md) - [ErrorResponse](docs/Model/ErrorResponse.md) - [FakeBigDecimalMap200Response](docs/Model/FakeBigDecimalMap200Response.md) - [File](docs/Model/File.md) diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/DefaultApi.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/DefaultApi.md index d603956cfaff..4309c38f39c1 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/DefaultApi.md +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/DefaultApi.md @@ -4,9 +4,60 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati | Method | HTTP request | Description | | ------------- | ------------- | ------------- | +| [**error()**](DefaultApi.md#error) | **GET** /error | Will always generate an error | | [**fooGet()**](DefaultApi.md#fooGet) | **GET** /foo | | +## `error()` + +```php +error() +``` + +Will always generate an error + +### Example + +```php +error(); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->error: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `fooGet()` ```php diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md index 74de3fcede10..9e3a212955f2 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**fakeBigDecimalMap()**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | +| [**fakeDeletePet()**](FakeApi.md#fakeDeletePet) | **DELETE** /fake/pet/{pet_id} | | | [**fakeEnumEndpoint()**](FakeApi.md#fakeEnumEndpoint) | **GET** /fake/enum/endpoint | test endpoint with enum parameter | | [**fakeHealthGet()**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest()**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | @@ -87,6 +88,59 @@ No authorization required [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `fakeDeletePet()` + +```php +fakeDeletePet($pet_id) +``` + + + +### Example + +```php +fakeDeletePet($pet_id); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeDeletePet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **pet_id** | **string**| The id of the pet to retrieve | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `fakeEnumEndpoint()` ```php diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Model/Error.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Model/Error.md new file mode 100644 index 000000000000..9e3479db475c --- /dev/null +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Model/Error.md @@ -0,0 +1,10 @@ +# # Error + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | A human readable error message | +**errors** | **string[]** | Optional array of multiple errors encountered during processing | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php index 9927734e053a..1253d56a33a2 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php @@ -40,6 +40,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php index bdc2f7af0c14..439e8883eaf5 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/DefaultApi.php @@ -40,6 +40,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -73,6 +74,9 @@ class DefaultApi /** @var string[] $contentTypes **/ public const contentTypes = [ + 'error' => [ + 'application/json', + ], 'fooGet' => [ 'application/json', ], @@ -124,6 +128,246 @@ class DefaultApi return $this->config; } + /** + * Operation error + * + * Will always generate an error + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['error'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\Error + */ + public function error( + string $contentType = self::contentTypes['error'][0] + ): \OpenAPI\Client\Model\Error + { + list($response) = $this->errorWithHttpInfo($contentType); + return $response; + } + + /** + * Operation errorWithHttpInfo + * + * Will always generate an error + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['error'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function errorWithHttpInfo( + string $contentType = self::contentTypes['error'][0] + ): array + { + $request = $this->errorRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation errorAsync + * + * Will always generate an error + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['error'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function errorAsync( + string $contentType = self::contentTypes['error'][0] + ): PromiseInterface + { + return $this->errorAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation errorAsyncWithHttpInfo + * + * Will always generate an error + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['error'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function errorAsyncWithHttpInfo( + string $contentType = self::contentTypes['error'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->errorRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'error' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['error'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function errorRequest( + string $contentType = self::contentTypes['error'][0] + ): Request + { + + + $resourcePath = '/error'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation fooGet * diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php index 88940c8bc124..5f0123a5e18c 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php @@ -40,6 +40,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -76,6 +77,9 @@ class FakeApi 'fakeBigDecimalMap' => [ 'application/json', ], + 'fakeDeletePet' => [ + 'application/json', + ], 'fakeEnumEndpoint' => [ 'application/json', ], @@ -458,6 +462,263 @@ class FakeApi ); } + /** + * Operation fakeDeletePet + * + * @param string $pet_id The id of the pet to retrieve (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeDeletePet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \OpenAPI\Client\Model\Error + */ + public function fakeDeletePet( + string $pet_id, + string $contentType = self::contentTypes['fakeDeletePet'][0] + ): \OpenAPI\Client\Model\Error + { + list($response) = $this->fakeDeletePetWithHttpInfo($pet_id, $contentType); + return $response; + } + + /** + * Operation fakeDeletePetWithHttpInfo + * + * @param string $pet_id The id of the pet to retrieve (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeDeletePet'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeDeletePetWithHttpInfo( + string $pet_id, + string $contentType = self::contentTypes['fakeDeletePet'][0] + ): array + { + $request = $this->fakeDeletePetRequest($pet_id, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation fakeDeletePetAsync + * + * @param string $pet_id The id of the pet to retrieve (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeDeletePet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function fakeDeletePetAsync( + string $pet_id, + string $contentType = self::contentTypes['fakeDeletePet'][0] + ): PromiseInterface + { + return $this->fakeDeletePetAsyncWithHttpInfo($pet_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fakeDeletePetAsyncWithHttpInfo + * + * @param string $pet_id The id of the pet to retrieve (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeDeletePet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function fakeDeletePetAsyncWithHttpInfo( + string $pet_id, + string $contentType = self::contentTypes['fakeDeletePet'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->fakeDeletePetRequest($pet_id, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fakeDeletePet' + * + * @param string $pet_id The id of the pet to retrieve (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeDeletePet'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fakeDeletePetRequest( + string $pet_id, + string $contentType = self::contentTypes['fakeDeletePet'][0] + ): Request + { + + // verify the required parameter 'pet_id' is set + if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $pet_id when calling fakeDeletePet' + ); + } + + + $resourcePath = '/fake/pet/{pet_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($pet_id !== null) { + $resourcePath = str_replace( + '{' . 'pet_id' . '}', + ObjectSerializer::toPathValue($pet_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation fakeEnumEndpoint * @@ -5678,71 +5939,27 @@ class FakeApi // form params - if ($integer !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('integer', $integer)); - } - // form params - if ($int32 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('int32', $int32)); - } - // form params - if ($int64 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('int64', $int64)); - } - // form params - if ($number !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('number', $number)); - } - // form params - if ($float !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('float', $float)); - } - // form params - if ($double !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('double', $double)); - } - // form params - if ($string !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('string', $string)); - } - // form params - if ($pattern_without_delimiter !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('pattern_without_delimiter', $pattern_without_delimiter)); - } - // form params - if ($byte !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('byte', $byte)); - } - // form params - if ($binary !== null) { - $multipart = true; - $formParams['binary'] = []; - $paramFiles = is_array($binary) ? $binary : [$binary]; - foreach ($paramFiles as $paramFile) { - $formParams['binary'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('binary', $paramFile)['binary'], - 'rb' - ); - } - } - // form params - if ($date !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('date', $date)); - } - // form params - if ($date_time !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('dateTime', $date_time)); - } - // form params - if ($password !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('password', $password)); - } - // form params - if ($callback !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('callback', $callback)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'integer' => $integer, + 'int32' => $int32, + 'int64' => $int64, + 'number' => $number, + 'float' => $float, + 'double' => $double, + 'string' => $string, + 'pattern_without_delimiter' => $pattern_without_delimiter, + 'byte' => $byte, + 'binary' => $binary, + 'date' => $date, + 'date_time' => $date_time, + 'password' => $password, + 'callback' => $callback, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -6110,13 +6327,15 @@ class FakeApi // form params - if ($enum_form_string_array !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('enum_form_string_array', $enum_form_string_array)); - } - // form params - if ($enum_form_string !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('enum_form_string', $enum_form_string)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'enum_form_string_array' => $enum_form_string_array, + 'enum_form_string' => $enum_form_string, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -7148,13 +7367,15 @@ class FakeApi // form params - if ($param !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('param', $param)); - } - // form params - if ($param2 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('param2', $param2)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'param' => $param, + 'param2' => $param2, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php index 30635a2fe9ee..49d4dc6236d1 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php @@ -40,6 +40,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php index 702bc9e51cc6..31a2e1de91eb 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php @@ -40,6 +40,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** @@ -2236,13 +2237,15 @@ class PetApi } // form params - if ($name !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('name', $name)); - } - // form params - if ($status !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('status', $status)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'name' => $name, + 'status' => $status, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -2550,23 +2553,15 @@ class PetApi } // form params - if ($additional_metadata !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('additionalMetadata', $additional_metadata)); - } - // form params - if ($file !== null) { - $multipart = true; - $formParams['file'] = []; - $paramFiles = is_array($file) ? $file : [$file]; - foreach ($paramFiles as $paramFile) { - $formParams['file'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('file', $paramFile)['file'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'additional_metadata' => $additional_metadata, + 'file' => $file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['application/json', ], @@ -2880,23 +2875,15 @@ class PetApi } // form params - if ($additional_metadata !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('additionalMetadata', $additional_metadata)); - } - // form params - if ($required_file !== null) { - $multipart = true; - $formParams['requiredFile'] = []; - $paramFiles = is_array($required_file) ? $required_file : [$required_file]; - foreach ($paramFiles as $paramFile) { - $formParams['requiredFile'][] = $paramFile instanceof \Psr\Http\Message\StreamInterface - ? $paramFile - : \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('requiredFile', $paramFile)['requiredFile'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'additional_metadata' => $additional_metadata, + 'required_file' => $required_file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['application/json', ], diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php index d815e6651c47..eb4a1024cc36 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php @@ -40,6 +40,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php index 880491926710..c6d18d78a134 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php @@ -40,6 +40,7 @@ use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; /** diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/FormDataProcessor.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/FormDataProcessor.php new file mode 100644 index 000000000000..f044f1c6dbc7 --- /dev/null +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/FormDataProcessor.php @@ -0,0 +1,236 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix . $key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + $result[$currentName] = ObjectSerializer::toString($val); + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + * + * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value + */ + protected function makeFormSafe(mixed $value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || is_object($value)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (str_contains($type, '\SplFileObject')) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/Error.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/Error.php new file mode 100644 index 000000000000..a20fb6249283 --- /dev/null +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/Error.php @@ -0,0 +1,445 @@ + + */ +class Error implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string', + 'errors' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError', + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['error'] === null) { + $invalidProperties[] = "'error' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error + * + * @return string + */ + public function getError(): string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string $error A human readable error message + * + * @return $this + */ + public function setError(string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors Optional array of multiple errors encountered during processing + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php index a3f70ac9a987..87daefd327c2 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/ObjectSerializer.php @@ -27,7 +27,6 @@ namespace OpenAPI\Client; -use ArrayAccess; use DateTimeInterface; use DateTime; use GuzzleHttp\Psr7\Utils; @@ -325,37 +324,6 @@ class ObjectSerializer return self::toString($value); } - /** - * Take value and turn it into an array suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|bool|array|DateTime|ArrayAccess|\SplFileObject $value the value of the form parameter - * - * @return array [key => value] of formdata - */ - public static function toFormValue( - string $key, - string|bool|array|DateTime|ArrayAccess|\SplFileObject $value, - ): array { - if ($value instanceof \SplFileObject) { - return [$key => $value->getRealPath()]; - } elseif (is_array($value) || $value instanceof ArrayAccess) { - $flattened = []; - $result = []; - - self::flattenArray(json_decode(json_encode($value), true), $flattened); - - foreach ($flattened as $k => $v) { - $result["{$key}{$k}"] = self::toString($v); - } - - return $result; - } else { - return [$key => self::toString($value)]; - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -621,58 +589,4 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - - /** - * Flattens an array of Model object and generates an array compatible - * with formdata - a single-level array where the keys use bracket - * notation to signify nested data. - * - * credit: https://github.com/FranBar1966/FlatPHP - */ - private static function flattenArray( - ArrayAccess|array $source, - array &$destination, - string $start = '', - ) { - $opt = [ - 'prefix' => '[', - 'suffix' => ']', - 'suffix-end' => true, - 'prefix-list' => '[', - 'suffix-list' => ']', - 'suffix-list-end' => true, - ]; - - if (!is_array($source)) { - $source = (array) $source; - } - - if (array_is_list($source)) { - $currentPrefix = $opt['prefix-list']; - $currentSuffix = $opt['suffix-list']; - $currentSuffixEnd = $opt['suffix-list-end']; - } else { - $currentPrefix = $opt['prefix']; - $currentSuffix = $opt['suffix']; - $currentSuffixEnd = $opt['suffix-end']; - } - - $currentName = $start; - - foreach ($source as $key => $val) { - $currentName .= $currentPrefix.$key; - - if (is_array($val) && !empty($val)) { - $currentName .= "{$currentSuffix}"; - self::flattenArray($val, $destination, $currentName); - } else { - if ($currentSuffixEnd) { - $currentName .= $currentSuffix; - } - $destination[$currentName] = self::toString($val); - } - - $currentName = $start; - } - } } diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/tests/Model/ErrorTest.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/tests/Model/ErrorTest.php new file mode 100644 index 000000000000..c1b8c85311ca --- /dev/null +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/tests/Model/ErrorTest.php @@ -0,0 +1,97 @@ +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new OpenAPI\Client\Api\PetApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$pet_id = 56; // int | ID of pet to update +$pet = new \OpenAPI\Client\Model\PetWithFile(); // \OpenAPI\Client\Model\PetWithFile + +try { + $result = $apiInstance->uploadImageFullFormDataNested($pet_id, $pet); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->uploadImageFullFormDataNested: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **pet_id** | **int**| ID of pet to update | | +| **pet** | [**\OpenAPI\Client\Model\PetWithFile**](../Model/PetWithFile.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ApiResponse**](../Model/ApiResponse.md) + +### Authorization + +[petstore_auth](../../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/PetWithFile.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/PetWithFile.md new file mode 100644 index 000000000000..520cd0b8725a --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/PetWithFile.md @@ -0,0 +1,16 @@ +# # PetWithFile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional] +**name** | **string** | | +**photo_urls** | **string[]** | | +**tags** | [**\OpenAPI\Client\Model\Tag[]**](Tag.md) | | [optional] +**status** | **string** | pet status in the store | [optional] +**file** | **\SplFileObject** | file to upload | [optional] +**multiple_files** | **\SplFileObject[]** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 34f82fd71744..d50d661539e1 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -38,6 +38,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index 00ff8ae25454..fe72d1716d6a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -38,6 +38,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 762e9d7a1849..d4845564804e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -38,6 +38,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -5632,69 +5633,27 @@ class FakeApi // form params - if ($integer !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('integer', $integer)); - } - // form params - if ($int32 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('int32', $int32)); - } - // form params - if ($int64 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('int64', $int64)); - } - // form params - if ($number !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('number', $number)); - } - // form params - if ($float !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('float', $float)); - } - // form params - if ($double !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('double', $double)); - } - // form params - if ($string !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('string', $string)); - } - // form params - if ($pattern_without_delimiter !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('pattern_without_delimiter', $pattern_without_delimiter)); - } - // form params - if ($byte !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('byte', $byte)); - } - // form params - if ($binary !== null) { - $multipart = true; - $formParams['binary'] = []; - $paramFiles = is_array($binary) ? $binary : [$binary]; - foreach ($paramFiles as $paramFile) { - $formParams['binary'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('binary', $paramFile)['binary'], - 'rb' - ); - } - } - // form params - if ($date !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('date', $date)); - } - // form params - if ($date_time !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('dateTime', $date_time)); - } - // form params - if ($password !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('password', $password)); - } - // form params - if ($callback !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('callback', $callback)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'integer' => $integer, + 'int32' => $int32, + 'int64' => $int64, + 'number' => $number, + 'float' => $float, + 'double' => $double, + 'string' => $string, + 'pattern_without_delimiter' => $pattern_without_delimiter, + 'byte' => $byte, + 'binary' => $binary, + 'date' => $date, + 'date_time' => $date_time, + 'password' => $password, + 'callback' => $callback, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -6008,13 +5967,15 @@ class FakeApi // form params - if ($enum_form_string_array !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('enum_form_string_array', $enum_form_string_array)); - } - // form params - if ($enum_form_string !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('enum_form_string', $enum_form_string)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'enum_form_string_array' => $enum_form_string_array, + 'enum_form_string' => $enum_form_string, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -6990,13 +6951,15 @@ class FakeApi // form params - if ($param !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('param', $param)); - } - // form params - if ($param2 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('param2', $param2)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'param' => $param, + 'param2' => $param2, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index 3508d16ea37f..4c0cfd5c8c0a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -38,6 +38,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 48b57f7f140d..61f60642dadf 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -38,6 +38,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; @@ -105,6 +106,9 @@ class PetApi 'uploadImageFullFormData' => [ 'multipart/form-data', ], + 'uploadImageFullFormDataNested' => [ + 'multipart/form-data', + ], ]; /** @@ -2112,13 +2116,15 @@ class PetApi } // form params - if ($name !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('name', $name)); - } - // form params - if ($status !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('status', $status)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'name' => $name, + 'status' => $status, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -2404,21 +2410,15 @@ class PetApi } // form params - if ($additional_metadata !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('additionalMetadata', $additional_metadata)); - } - // form params - if ($file !== null) { - $multipart = true; - $formParams['file'] = []; - $paramFiles = is_array($file) ? $file : [$file]; - foreach ($paramFiles as $paramFile) { - $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('file', $paramFile)['file'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'additional_metadata' => $additional_metadata, + 'file' => $file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $multipart = true; $headers = $this->headerSelector->selectHeaders( @@ -2711,21 +2711,15 @@ class PetApi } // form params - if ($additional_metadata !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('additionalMetadata', $additional_metadata)); - } - // form params - if ($required_file !== null) { - $multipart = true; - $formParams['requiredFile'] = []; - $paramFiles = is_array($required_file) ? $required_file : [$required_file]; - foreach ($paramFiles as $paramFile) { - $formParams['requiredFile'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('requiredFile', $paramFile)['requiredFile'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'additional_metadata' => $additional_metadata, + 'required_file' => $required_file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $multipart = true; $headers = $this->headerSelector->selectHeaders( @@ -3060,53 +3054,309 @@ class PetApi } // form params - if ($id !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('id', $id)); - } - // form params - if ($category !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('category', $category)); - } - // form params - if ($name !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('name', $name)); - } - // form params - if ($photo_urls !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('photoUrls', $photo_urls)); - } - // form params - if ($tags !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('tags', $tags)); - } - // form params - if ($status !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('status', $status)); - } - // form params - if ($file !== null) { - $multipart = true; - $formParams['file'] = []; - $paramFiles = is_array($file) ? $file : [$file]; - foreach ($paramFiles as $paramFile) { - $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('file', $paramFile)['file'], - 'rb' - ); + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'id' => $id, + 'category' => $category, + 'name' => $name, + 'photo_urls' => $photo_urls, + 'tags' => $tags, + 'status' => $status, + 'file' => $file, + 'multiple_files' => $multiple_files, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; + + $multipart = true; + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); } } - // form params - if ($multiple_files !== null) { - $multipart = true; - $formParams['multiple_files'] = []; - $paramFiles = is_array($multiple_files) ? $multiple_files : [$multiple_files]; - foreach ($paramFiles as $paramFile) { - $formParams['multiple_files'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue('multiple_files', $paramFile)['multiple_files'], - 'rb' + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation uploadImageFullFormDataNested + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile|null $pet pet (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageFullFormDataNested'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ApiResponse + */ + public function uploadImageFullFormDataNested($pet_id, $pet = null, string $contentType = self::contentTypes['uploadImageFullFormDataNested'][0]) + { + list($response) = $this->uploadImageFullFormDataNestedWithHttpInfo($pet_id, $pet, $contentType); + return $response; + } + + /** + * Operation uploadImageFullFormDataNestedWithHttpInfo + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile|null $pet (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageFullFormDataNested'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function uploadImageFullFormDataNestedWithHttpInfo($pet_id, $pet = null, string $contentType = self::contentTypes['uploadImageFullFormDataNested'][0]) + { + $request = $this->uploadImageFullFormDataNestedRequest($pet_id, $pet, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null ); } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\ApiResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\ApiResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\ApiResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; } + } + + /** + * Operation uploadImageFullFormDataNestedAsync + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile|null $pet (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageFullFormDataNested'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadImageFullFormDataNestedAsync($pet_id, $pet = null, string $contentType = self::contentTypes['uploadImageFullFormDataNested'][0]) + { + return $this->uploadImageFullFormDataNestedAsyncWithHttpInfo($pet_id, $pet, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation uploadImageFullFormDataNestedAsyncWithHttpInfo + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile|null $pet (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageFullFormDataNested'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function uploadImageFullFormDataNestedAsyncWithHttpInfo($pet_id, $pet = null, string $contentType = self::contentTypes['uploadImageFullFormDataNested'][0]) + { + $returnType = '\OpenAPI\Client\Model\ApiResponse'; + $request = $this->uploadImageFullFormDataNestedRequest($pet_id, $pet, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'uploadImageFullFormDataNested' + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile|null $pet (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadImageFullFormDataNested'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function uploadImageFullFormDataNestedRequest($pet_id, $pet = null, string $contentType = self::contentTypes['uploadImageFullFormDataNested'][0]) + { + + // verify the required parameter 'pet_id' is set + if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pet_id when calling uploadImageFullFormDataNested' + ); + } + + + + $resourcePath = '/pet/{petId}/uploadImageFullFormDataNested'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($pet_id !== null) { + $resourcePath = str_replace( + '{' . 'petId' . '}', + ObjectSerializer::toPathValue($pet_id), + $resourcePath + ); + } + + // form params + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'pet' => $pet, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $multipart = true; $headers = $this->headerSelector->selectHeaders( diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index bfbcfcd2e119..f04b8a45f9fa 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -38,6 +38,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index 2fd2e9423493..1d2b64ec9bae 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -38,6 +38,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\HeaderSelector; use OpenAPI\Client\ObjectSerializer; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/FormDataProcessor.php b/samples/client/petstore/php/OpenAPIClient-php/lib/FormDataProcessor.php new file mode 100644 index 000000000000..c416f584e6aa --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/FormDataProcessor.php @@ -0,0 +1,242 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + $result[$currentName] = ObjectSerializer::toString($val); + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/PetWithFile.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/PetWithFile.php new file mode 100644 index 000000000000..3e91dabb4b55 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/PetWithFile.php @@ -0,0 +1,691 @@ + + */ +class PetWithFile implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PetWithFile'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'category' => '\OpenAPI\Client\Model\Category', + 'name' => 'string', + 'photo_urls' => 'string[]', + 'tags' => '\OpenAPI\Client\Model\Tag[]', + 'status' => 'string', + 'file' => '\SplFileObject', + 'multiple_files' => '\SplFileObject[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'int64', + 'category' => null, + 'name' => null, + 'photo_urls' => null, + 'tags' => null, + 'status' => null, + 'file' => 'binary', + 'multiple_files' => 'binary' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'category' => false, + 'name' => false, + 'photo_urls' => false, + 'tags' => false, + 'status' => false, + 'file' => false, + 'multiple_files' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'category' => 'category', + 'name' => 'name', + 'photo_urls' => 'photoUrls', + 'tags' => 'tags', + 'status' => 'status', + 'file' => 'file', + 'multiple_files' => 'multiple_files' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'category' => 'setCategory', + 'name' => 'setName', + 'photo_urls' => 'setPhotoUrls', + 'tags' => 'setTags', + 'status' => 'setStatus', + 'file' => 'setFile', + 'multiple_files' => 'setMultipleFiles' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'category' => 'getCategory', + 'name' => 'getName', + 'photo_urls' => 'getPhotoUrls', + 'tags' => 'getTags', + 'status' => 'getStatus', + 'file' => 'getFile', + 'multiple_files' => 'getMultipleFiles' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_AVAILABLE = 'available'; + public const STATUS_PENDING = 'pending'; + public const STATUS_SOLD = 'sold'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_AVAILABLE, + self::STATUS_PENDING, + self::STATUS_SOLD, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('photo_urls', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('file', $data ?? [], null); + $this->setIfExists('multiple_files', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['photo_urls'] === null) { + $invalidProperties[] = "'photo_urls' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets category + * + * @return \OpenAPI\Client\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \OpenAPI\Client\Model\Category|null $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets photo_urls + * + * @return string[] + */ + public function getPhotoUrls() + { + return $this->container['photo_urls']; + } + + /** + * Sets photo_urls + * + * @param string[] $photo_urls photo_urls + * + * @return self + */ + public function setPhotoUrls($photo_urls) + { + if (is_null($photo_urls)) { + throw new \InvalidArgumentException('non-nullable photo_urls cannot be null'); + } + + + $this->container['photo_urls'] = $photo_urls; + + return $this; + } + + /** + * Gets tags + * + * @return \OpenAPI\Client\Model\Tag[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param \OpenAPI\Client\Model\Tag[]|null $tags tags + * + * @return self + */ + public function setTags($tags) + { + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status pet status in the store + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets file + * + * @return \SplFileObject|null + */ + public function getFile() + { + return $this->container['file']; + } + + /** + * Sets file + * + * @param \SplFileObject|null $file file to upload + * + * @return self + */ + public function setFile($file) + { + if (is_null($file)) { + throw new \InvalidArgumentException('non-nullable file cannot be null'); + } + $this->container['file'] = $file; + + return $this; + } + + /** + * Gets multiple_files + * + * @return \SplFileObject[]|null + */ + public function getMultipleFiles() + { + return $this->container['multiple_files']; + } + + /** + * Sets multiple_files + * + * @param \SplFileObject[]|null $multiple_files multiple_files + * + * @return self + */ + public function setMultipleFiles($multiple_files) + { + if (is_null($multiple_files)) { + throw new \InvalidArgumentException('non-nullable multiple_files cannot be null'); + } + $this->container['multiple_files'] = $multiple_files; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index a144eb7641b1..daa7d49244ce 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -28,7 +28,6 @@ namespace OpenAPI\Client; -use ArrayAccess; use GuzzleHttp\Psr7\Utils; use OpenAPI\Client\Model\ModelInterface; @@ -324,35 +323,6 @@ class ObjectSerializer return self::toString($value); } - /** - * Take value and turn it into an array suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|bool|array|DateTime|ArrayAccess|\SplFileObject $value the value of the form parameter - * - * @return array [key => value] of formdata - */ - public static function toFormValue(string $key, $value) - { - if ($value instanceof \SplFileObject) { - return [$key => $value->getRealPath()]; - } elseif (is_array($value) || $value instanceof ArrayAccess) { - $flattened = []; - $result = []; - - self::flattenArray(json_decode(json_encode($value), true), $flattened); - - foreach ($flattened as $k => $v) { - $result["{$key}{$k}"] = self::toString($v); - } - - return $result; - } else { - return [$key => self::toString($value)]; - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -626,81 +596,4 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - - /** - * Flattens an array of Model object and generates an array compatible - * with formdata - a single-level array where the keys use bracket - * notation to signify nested data. - * - * @param \ArrayAccess|array $source - * - * credit: https://github.com/FranBar1966/FlatPHP - */ - private static function flattenArray( - $source, - array &$destination, - string $start = '' - ) { - $opt = [ - 'prefix' => '[', - 'suffix' => ']', - 'suffix-end' => true, - 'prefix-list' => '[', - 'suffix-list' => ']', - 'suffix-list-end' => true, - ]; - - if (!is_array($source)) { - $source = (array) $source; - } - - /** - * array_is_list only in PHP >= 8.1 - * - * credit: https://www.php.net/manual/en/function.array-is-list.php#127044 - */ - if (!function_exists('array_is_list')) { - function array_is_list(array $array) - { - $i = -1; - - foreach ($array as $k => $v) { - ++$i; - if ($k !== $i) { - return false; - } - } - - return true; - } - } - - if (array_is_list($source)) { - $currentPrefix = $opt['prefix-list']; - $currentSuffix = $opt['suffix-list']; - $currentSuffixEnd = $opt['suffix-list-end']; - } else { - $currentPrefix = $opt['prefix']; - $currentSuffix = $opt['suffix']; - $currentSuffixEnd = $opt['suffix-end']; - } - - $currentName = $start; - - foreach ($source as $key => $val) { - $currentName .= $currentPrefix.$key; - - if (is_array($val) && !empty($val)) { - $currentName .= "{$currentSuffix}"; - self::flattenArray($val, $destination, $currentName); - } else { - if ($currentSuffixEnd) { - $currentName .= $currentSuffix; - } - $destination[$currentName] = self::toString($val); - } - - $currentName = $start; - } - } } diff --git a/samples/client/petstore/php/OpenAPIClient-php/test/Model/PetWithFileTest.php b/samples/client/petstore/php/OpenAPIClient-php/test/Model/PetWithFileTest.php new file mode 100644 index 000000000000..ce0a73f294d0 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/test/Model/PetWithFileTest.php @@ -0,0 +1,153 @@ +prepare($data); + + $result = $formDataProcessor::flatten($formData); + + $this->assertEquals($expected, $result); + } + + public function providerFlatten(): iterable + { + $data = [ + 'id' => '1234', + 'name' => 'Spike', + 'photo_urls' => [ + 'https://example.com/picture_1.jpg', + 'https://example.com/picture_2.jpg', + ], + 'status' => Model\Pet::STATUS_AVAILABLE, + 'category' => [ + 'id' => '12345', + 'name' => 'Category_Name', + ], + 'tags' => [ + [ + 'id' => '12345', + 'name' => 'tag_1', + ], + [ + 'id' => '98765', + 'name' => 'tag_2', + ], + ], + ]; + + yield [ + 'data' => $data, + 'expected' => [ + 'id' => $data['id'], + 'name' => $data['name'], + 'photo_urls[0]' => $data['photo_urls'][0], + 'photo_urls[1]' => $data['photo_urls'][1], + 'status' => $data['status'], + 'category[id]' => (string) $data['category']['id'], + 'category[name]' => $data['category']['name'], + 'tags[0][id]' => (string) $data['tags'][0]['id'], + 'tags[0][name]' => $data['tags'][0]['name'], + 'tags[1][id]' => (string) $data['tags'][1]['id'], + 'tags[1][name]' => $data['tags'][1]['name'], + ], + ]; + + $category = (new Model\Category()) + ->setId($data['category']['id']) + ->setName($data['category']['name']); + + $tags_1 = (new Model\Tag()) + ->setId($data['tags'][0]['id']) + ->setName($data['tags'][0]['name']); + + $tags_2 = (new Model\Tag()) + ->setId($data['tags'][1]['id']) + ->setName($data['tags'][1]['name']); + + $tags = [ + $tags_1, + $tags_2, + ]; + + $pet = new Model\Pet([]); + $pet->setId($data['id']) + ->setName($data['name']) + ->setPhotoUrls($data['photo_urls']) + ->setStatus($data['status']) + ->setCategory($category) + ->setTags($tags); + + yield [ + 'data' => ['pet' => $pet], + 'expected' => [ + 'pet[id]' => $data['id'], + 'pet[name]' => $data['name'], + 'pet[photo_urls][0]' => $data['photo_urls'][0], + 'pet[photo_urls][1]' => $data['photo_urls'][1], + 'pet[status]' => $data['status'], + 'pet[category][id]' => (string) $data['category']['id'], + 'pet[category][name]' => $data['category']['name'], + 'pet[tags][0][id]' => (string) $data['tags'][0]['id'], + 'pet[tags][0][name]' => $data['tags'][0]['name'], + 'pet[tags][1][id]' => (string) $data['tags'][1]['id'], + 'pet[tags][1][name]' => $data['tags'][1]['name'], + ], + ]; + + yield [ + 'data' => ['nested' => ['pet' => $pet]], + 'expected' => [ + 'nested[pet][id]' => $data['id'], + 'nested[pet][name]' => $data['name'], + 'nested[pet][photo_urls][0]' => $data['photo_urls'][0], + 'nested[pet][photo_urls][1]' => $data['photo_urls'][1], + 'nested[pet][status]' => $data['status'], + 'nested[pet][category][id]' => (string) $data['category']['id'], + 'nested[pet][category][name]' => $data['category']['name'], + 'nested[pet][tags][0][id]' => (string) $data['tags'][0]['id'], + 'nested[pet][tags][0][name]' => $data['tags'][0]['name'], + 'nested[pet][tags][1][id]' => (string) $data['tags'][1]['id'], + 'nested[pet][tags][1][name]' => $data['tags'][1]['name'], + ], + ]; + + yield [ + 'data' => ['key' => new DateTime('2021-10-06T20:17:16')], + 'expected' => ['key' => '2021-10-06T20:17:16+00:00'], + ]; + + yield [ + 'data' => ['key' => true], + 'expected' => ['key' => 'true'], + ]; + + yield [ + 'data' => ['key' => false], + 'expected' => ['key' => 'false'], + ]; + + yield [ + 'data' => ['key' => 'some value'], + 'expected' => ['key' => 'some value'], + ]; + } + + public function testNullValueIgnored(): void + { + $data = [ + 'id' => '1234', + 'name' => 'Spike', + 'photo_urls' => null, + 'status' => null, + 'category' => null, + 'tags' => null, + ]; + + $expected = [ + 'id' => $data['id'], + 'name' => $data['name'], + ]; + + $formDataProcessor = new FormDataProcessor(); + $formData = $formDataProcessor->prepare($data); + + $result = $formDataProcessor::flatten($formData); + + $this->assertEquals($expected, $result); + } + + public function testHasFile(): void + { + $filepath = realpath(__DIR__ . '/../.openapi-generator/VERSION'); + $file = new SplFileObject($filepath); + + $pet = new Model\PetWithFile([]); + $pet->setId(123) + ->setName('Spike') + ->setFile($file); + + $formDataProcessor = new FormDataProcessor(); + + $this->assertFalse($formDataProcessor->has_file); + $formData = $formDataProcessor->prepare(['pet' => $pet]); + + $this->assertIsResource($formData['pet']['file'][0]); + $this->assertTrue($formDataProcessor->has_file); + } + + public function testHasFileNested(): void + { + $filepath = realpath(__DIR__ . '/../.openapi-generator/VERSION'); + $file = new SplFileObject($filepath); + + $pet = new Model\PetWithFile([]); + $pet->setId(123) + ->setName('Spike') + ->setFile($file); + + $formDataProcessor = new FormDataProcessor(); + + $this->assertFalse($formDataProcessor->has_file); + $formData = $formDataProcessor->prepare(['nested' => ['pet' => $pet]]); + + $this->assertIsResource($formData['nested']['pet']['file'][0]); + $this->assertTrue($formDataProcessor->has_file); + } + + public function testHasFileMultiple(): void + { + $filepath = realpath(__DIR__ . '/../.openapi-generator/VERSION'); + $file = new SplFileObject($filepath); + + $pet = new Model\PetWithFile([]); + $pet->setId(123) + ->setName('Spike') + ->setMultipleFiles([$file]); + + $formDataProcessor = new FormDataProcessor(); + + $this->assertFalse($formDataProcessor->has_file); + $formData = $formDataProcessor->prepare(['pet' => $pet]); + + $this->assertIsResource($formData['pet']['multiple_files'][0]); + $this->assertTrue($formDataProcessor->has_file); + } + + public function testHasFileMultipleNested(): void + { + $filepath = realpath(__DIR__ . '/../.openapi-generator/VERSION'); + $file = new SplFileObject($filepath); + + $pet = new Model\PetWithFile([]); + $pet->setId(123) + ->setName('Spike') + ->setMultipleFiles([$file]); + + $formDataProcessor = new FormDataProcessor(); + + $this->assertFalse($formDataProcessor->has_file); + $formData = $formDataProcessor->prepare(['nested' => ['pet' => $pet]]); + + $this->assertIsResource($formData['nested']['pet']['multiple_files'][0]); + $this->assertTrue($formDataProcessor->has_file); + } +} diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/ObjectSerializerTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/ObjectSerializerTest.php index 47b94f12f4fa..dc71cd108b85 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/ObjectSerializerTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/ObjectSerializerTest.php @@ -636,98 +636,4 @@ class ObjectSerializerTest extends TestCase $tag = $tags[0]; $this->assertInstanceOf(Tag::class, $tag); } - - /** - * @dataProvider providerToFormValue - */ - public function testToFormValue( - mixed $data, - mixed $expected, - ): void { - $result = ObjectSerializer::toFormValue('key', $data); - - $this->assertEquals($expected, $result); - } - - public function providerToFormValue(): iterable - { - yield [ - 'data' => new DateTime('2021-10-06T20:17:16'), - 'expected' => ['key' => '2021-10-06T20:17:16+00:00'], - ]; - - yield [ - 'data' => true, - 'expected' => ['key' => 'true'], - ]; - - yield [ - 'data' => false, - 'expected' => ['key' => 'false'], - ]; - - yield [ - 'data' => 'some value', - 'expected' => ['key' => 'some value'], - ]; - - $filepath = realpath(__DIR__ . '/../.openapi-generator/VERSION'); - $file = new \SplFileObject($filepath); - - yield [ - 'data' => $file, - 'expected' => ['key' => $filepath], - ]; - - $id = 1234; - $name = 'Spike'; - - $category = (new Model\Category()) - ->setId(12345) - ->setName("Category_Name"); - - $tags_1 = (new Model\Tag()) - ->setId(12345) - ->setName("tag_1"); - - $tags_2 = (new Model\Tag()) - ->setId(98765) - ->setName("tag_2"); - - $tags = [ - $tags_1, - $tags_2, - ]; - - $photo_urls = [ - "https://example.com/picture_1.jpg", - "https://example.com/picture_2.jpg", - ]; - $status = Model\Pet::STATUS_AVAILABLE; - - $pet = new Model\Pet([]); - $pet->setId($id) - ->setName($name) - ->setPhotoUrls($photo_urls) - ->setStatus($status) - ->setCategory($category) - ->setTags($tags); - - yield [ - 'data' => $pet, - 'expected' => [ - 'key[id]' => "{$id}", - 'key[name]' => $name, - 'key[photoUrls][0]' => $photo_urls[0], - 'key[photoUrls][1]' => $photo_urls[1], - 'key[status]' => $status, - 'key[category][id]' => "{$category->getId()}", - 'key[category][name]' => $category->getName(), - 'key[tags][0][id]' => "{$tags_1->getId()}", - 'key[tags][0][name]' => $tags_1->getName(), - 'key[tags][1][id]' => "{$tags_2->getId()}", - 'key[tags][1][name]' => $tags_2->getName(), - ], - ]; - } } diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php index 463f36a78af0..bd1c2fb2a8a9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php @@ -417,8 +417,8 @@ class PetApiTest extends TestCase $contents = $request->getBody()->getContents(); $this->assertBodyContents('name', $name, $contents); - $this->assertBodyContents('photoUrls[0]', $photo_urls[0], $contents); - $this->assertBodyContents('photoUrls[1]', $photo_urls[1], $contents); + $this->assertBodyContents('photo_urls[0]', $photo_urls[0], $contents); + $this->assertBodyContents('photo_urls[1]', $photo_urls[1], $contents); $this->assertBodyContents('category[id]', $category->getId(), $contents); $this->assertBodyContents('category[name]', $category->getName(), $contents); $this->assertBodyContents('tags[0][id]', $tags[0]->getId(), $contents); diff --git a/samples/client/petstore/php/psr-18/.openapi-generator/FILES b/samples/client/petstore/php/psr-18/.openapi-generator/FILES index 37dca3df0af8..d1d6f3c8d55d 100644 --- a/samples/client/petstore/php/psr-18/.openapi-generator/FILES +++ b/samples/client/petstore/php/psr-18/.openapi-generator/FILES @@ -54,6 +54,7 @@ docs/Model/OuterEnumInteger.md docs/Model/OuterEnumIntegerDefaultValue.md docs/Model/OuterObjectWithEnumProperty.md docs/Model/Pet.md +docs/Model/PetWithFile.md docs/Model/PropertyNameMapping.md docs/Model/ReadOnlyFirst.md docs/Model/SingleRefType.md @@ -72,6 +73,7 @@ lib/Api/UserApi.php lib/ApiException.php lib/Configuration.php lib/DebugPlugin.php +lib/FormDataProcessor.php lib/HeaderSelector.php lib/Model/AdditionalPropertiesClass.php lib/Model/AllOfWithSingleRef.php @@ -118,6 +120,7 @@ lib/Model/OuterEnumInteger.php lib/Model/OuterEnumIntegerDefaultValue.php lib/Model/OuterObjectWithEnumProperty.php lib/Model/Pet.php +lib/Model/PetWithFile.php lib/Model/PropertyNameMapping.php lib/Model/ReadOnlyFirst.php lib/Model/SingleRefType.php diff --git a/samples/client/petstore/php/psr-18/README.md b/samples/client/petstore/php/psr-18/README.md index c77a0d15c041..813223f24e11 100644 --- a/samples/client/petstore/php/psr-18/README.md +++ b/samples/client/petstore/php/psr-18/README.md @@ -124,6 +124,7 @@ Class | Method | HTTP request | Description *PetApi* | [**uploadFile**](docs/Api/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *PetApi* | [**uploadFileWithRequiredFile**](docs/Api/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *PetApi* | [**uploadImageFullFormData**](docs/Api/PetApi.md#uploadimagefullformdata) | **POST** /pet/{petId}/uploadImageFullFormData | uploads an image attached to a Pet object as formdata +*PetApi* | [**uploadImageFullFormDataNested**](docs/Api/PetApi.md#uploadimagefullformdatanested) | **POST** /pet/{petId}/uploadImageFullFormDataNested | uploads an image attached to a Pet object as formdata *StoreApi* | [**deleteOrder**](docs/Api/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**getInventory**](docs/Api/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**getOrderById**](docs/Api/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -183,6 +184,7 @@ Class | Method | HTTP request | Description - [OuterEnumIntegerDefaultValue](docs/Model/OuterEnumIntegerDefaultValue.md) - [OuterObjectWithEnumProperty](docs/Model/OuterObjectWithEnumProperty.md) - [Pet](docs/Model/Pet.md) +- [PetWithFile](docs/Model/PetWithFile.md) - [PropertyNameMapping](docs/Model/PropertyNameMapping.md) - [ReadOnlyFirst](docs/Model/ReadOnlyFirst.md) - [SingleRefType](docs/Model/SingleRefType.md) diff --git a/samples/client/petstore/php/psr-18/docs/Api/PetApi.md b/samples/client/petstore/php/psr-18/docs/Api/PetApi.md index 1b5a4c942fd5..c893be3b0e0b 100644 --- a/samples/client/petstore/php/psr-18/docs/Api/PetApi.md +++ b/samples/client/petstore/php/psr-18/docs/Api/PetApi.md @@ -14,6 +14,7 @@ Method | HTTP request | Description [**uploadFile()**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image [**uploadFileWithRequiredFile()**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) [**uploadImageFullFormData()**](PetApi.md#uploadImageFullFormData) | **POST** /pet/{petId}/uploadImageFullFormData | uploads an image attached to a Pet object as formdata +[**uploadImageFullFormDataNested()**](PetApi.md#uploadImageFullFormDataNested) | **POST** /pet/{petId}/uploadImageFullFormDataNested | uploads an image attached to a Pet object as formdata ## `addPet()` @@ -643,3 +644,65 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) + +## `uploadImageFullFormDataNested()` + +```php +uploadImageFullFormDataNested($pet_id, $pet): \OpenAPI\Client\Model\ApiResponse +``` + +uploads an image attached to a Pet object as formdata + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new OpenAPI\Client\Api\PetApi( + // If you want use custom http client, pass your client which implements `Psr\Http\Client\ClientInterface`. + // This is optional, `Psr18ClientDiscovery` will be used to find http client. For instance `GuzzleHttp\Client` implements that interface + new GuzzleHttp\Client(), + $config +); +$pet_id = 56; // int | ID of pet to update +$pet = new \OpenAPI\Client\Model\PetWithFile(); // \OpenAPI\Client\Model\PetWithFile + +try { + $result = $apiInstance->uploadImageFullFormDataNested($pet_id, $pet); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->uploadImageFullFormDataNested: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **pet** | [**\OpenAPI\Client\Model\PetWithFile**](../Model/PetWithFile.md)| | [optional] + +### Return type + +[**\OpenAPI\Client\Model\ApiResponse**](../Model/ApiResponse.md) + +### Authorization + +[petstore_auth](../../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/psr-18/docs/Model/PetWithFile.md b/samples/client/petstore/php/psr-18/docs/Model/PetWithFile.md new file mode 100644 index 000000000000..520cd0b8725a --- /dev/null +++ b/samples/client/petstore/php/psr-18/docs/Model/PetWithFile.md @@ -0,0 +1,16 @@ +# # PetWithFile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional] +**name** | **string** | | +**photo_urls** | **string[]** | | +**tags** | [**\OpenAPI\Client\Model\Tag[]**](Tag.md) | | [optional] +**status** | **string** | pet status in the store | [optional] +**file** | **\SplFileObject** | file to upload | [optional] +**multiple_files** | **\SplFileObject[]** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php index 62a8fceab5f1..3e06d99de983 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php @@ -43,6 +43,7 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\DebugPlugin; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; diff --git a/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php b/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php index 888725830578..5db97c39e741 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php @@ -43,6 +43,7 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\DebugPlugin; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; diff --git a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php index 02e1f928ff10..4cfc2e741dc1 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php @@ -43,6 +43,7 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\DebugPlugin; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; @@ -5394,69 +5395,27 @@ class FakeApi // form params - if ($integer !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('integer', $integer)); - } - // form params - if ($int32 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('int32', $int32)); - } - // form params - if ($int64 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('int64', $int64)); - } - // form params - if ($number !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('number', $number)); - } - // form params - if ($float !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('float', $float)); - } - // form params - if ($double !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('double', $double)); - } - // form params - if ($string !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('string', $string)); - } - // form params - if ($pattern_without_delimiter !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('pattern_without_delimiter', $pattern_without_delimiter)); - } - // form params - if ($byte !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('byte', $byte)); - } - // form params - if ($binary !== null) { - $multipart = true; - $formParams['binary'] = []; - $paramFiles = is_array($binary) ? $binary : [$binary]; - foreach ($paramFiles as $paramFile) { - $formParams['binary'][] = \GuzzleHttp\Psr7\try_fopen( - ObjectSerializer::toFormValue('binary', $paramFile)['binary'], - 'rb' - ); - } - } - // form params - if ($date !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('date', $date)); - } - // form params - if ($date_time !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('dateTime', $date_time)); - } - // form params - if ($password !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('password', $password)); - } - // form params - if ($callback !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('callback', $callback)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'integer' => $integer, + 'int32' => $int32, + 'int64' => $int64, + 'number' => $number, + 'float' => $float, + 'double' => $double, + 'string' => $string, + 'pattern_without_delimiter' => $pattern_without_delimiter, + 'byte' => $byte, + 'binary' => $binary, + 'date' => $date, + 'date_time' => $date_time, + 'password' => $password, + 'callback' => $callback, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -5765,13 +5724,15 @@ class FakeApi // form params - if ($enum_form_string_array !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('enum_form_string_array', $enum_form_string_array)); - } - // form params - if ($enum_form_string !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('enum_form_string', $enum_form_string)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'enum_form_string_array' => $enum_form_string_array, + 'enum_form_string' => $enum_form_string, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -6719,13 +6680,15 @@ class FakeApi // form params - if ($param !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('param', $param)); - } - // form params - if ($param2 !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('param2', $param2)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'param' => $param, + 'param2' => $param2, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], diff --git a/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php index 100429551e05..30264c8f199a 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php @@ -43,6 +43,7 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\DebugPlugin; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; diff --git a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php index 62abe18f2bd1..8f623f5eb0f2 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php @@ -43,6 +43,7 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\DebugPlugin; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; @@ -1838,13 +1839,15 @@ class PetApi } // form params - if ($name !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('name', $name)); - } - // form params - if ($status !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('status', $status)); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'name' => $name, + 'status' => $status, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( [], @@ -2118,21 +2121,15 @@ class PetApi } // form params - if ($additional_metadata !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('additionalMetadata', $additional_metadata)); - } - // form params - if ($file !== null) { - $multipart = true; - $formParams['file'] = []; - $paramFiles = is_array($file) ? $file : [$file]; - foreach ($paramFiles as $paramFile) { - $formParams['file'][] = \GuzzleHttp\Psr7\try_fopen( - ObjectSerializer::toFormValue('file', $paramFile)['file'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'additional_metadata' => $additional_metadata, + 'file' => $file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['application/json'], @@ -2412,21 +2409,15 @@ class PetApi } // form params - if ($additional_metadata !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('additionalMetadata', $additional_metadata)); - } - // form params - if ($required_file !== null) { - $multipart = true; - $formParams['requiredFile'] = []; - $paramFiles = is_array($required_file) ? $required_file : [$required_file]; - foreach ($paramFiles as $paramFile) { - $formParams['requiredFile'][] = \GuzzleHttp\Psr7\try_fopen( - ObjectSerializer::toFormValue('requiredFile', $paramFile)['requiredFile'], - 'rb' - ); - } - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'additional_metadata' => $additional_metadata, + 'required_file' => $required_file, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['application/json'], @@ -2743,53 +2734,297 @@ class PetApi } // form params - if ($id !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('id', $id)); - } - // form params - if ($category !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('category', $category)); - } - // form params - if ($name !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('name', $name)); - } - // form params - if ($photo_urls !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('photoUrls', $photo_urls)); - } - // form params - if ($tags !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('tags', $tags)); - } - // form params - if ($status !== null) { - $formParams = array_merge($formParams, ObjectSerializer::toFormValue('status', $status)); - } - // form params - if ($file !== null) { - $multipart = true; - $formParams['file'] = []; - $paramFiles = is_array($file) ? $file : [$file]; - foreach ($paramFiles as $paramFile) { - $formParams['file'][] = \GuzzleHttp\Psr7\try_fopen( - ObjectSerializer::toFormValue('file', $paramFile)['file'], - 'rb' - ); + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'id' => $id, + 'category' => $category, + 'name' => $name, + 'photo_urls' => $photo_urls, + 'tags' => $tags, + 'status' => $status, + 'file' => $file, + 'multiple_files' => $multiple_files, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; + + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + 'multipart/form-data', + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($this->headerSelector->isJsonMime($headers['Content-Type'])) { + $httpBody = json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); } } - // form params - if ($multiple_files !== null) { - $multipart = true; - $formParams['multiple_files'] = []; - $paramFiles = is_array($multiple_files) ? $multiple_files : [$multiple_files]; - foreach ($paramFiles as $paramFile) { - $formParams['multiple_files'][] = \GuzzleHttp\Psr7\try_fopen( - ObjectSerializer::toFormValue('multiple_files', $paramFile)['multiple_files'], - 'rb' + + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + + $uri = $this->createUri($operationHost, $resourcePath, $queryParams); + + return $this->createRequest('POST', $uri, $headers, $httpBody); + } + + /** + * Operation uploadImageFullFormDataNested + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile $pet pet (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ApiResponse + */ + public function uploadImageFullFormDataNested($pet_id, $pet = null) + { + list($response) = $this->uploadImageFullFormDataNestedWithHttpInfo($pet_id, $pet); + return $response; + } + + /** + * Operation uploadImageFullFormDataNestedWithHttpInfo + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile $pet (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function uploadImageFullFormDataNestedWithHttpInfo($pet_id, $pet = null) + { + $request = $this->uploadImageFullFormDataNestedRequest($pet_id, $pet); + + try { + try { + $response = $this->httpClient->sendRequest($request); + } catch (HttpException $e) { + $response = $e->getResponse(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $response->getStatusCode(), + (string) $request->getUri() + ), + $request, + $response, + $e + ); + } catch (ClientExceptionInterface $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $request, + null, + $e ); } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\ApiResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\OpenAPI\Client\Model\ApiResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\ApiResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; } + } + + /** + * Operation uploadImageFullFormDataNestedAsync + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile $pet (optional) + * + * @throws \InvalidArgumentException + * @return Promise + */ + public function uploadImageFullFormDataNestedAsync($pet_id, $pet = null) + { + return $this->uploadImageFullFormDataNestedAsyncWithHttpInfo($pet_id, $pet) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation uploadImageFullFormDataNestedAsyncWithHttpInfo + * + * uploads an image attached to a Pet object as formdata + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile $pet (optional) + * + * @throws \InvalidArgumentException + * @return Promise + */ + public function uploadImageFullFormDataNestedAsyncWithHttpInfo($pet_id, $pet = null) + { + $returnType = '\OpenAPI\Client\Model\ApiResponse'; + $request = $this->uploadImageFullFormDataNestedRequest($pet_id, $pet); + + return $this->httpAsyncClient->sendAsyncRequest($request) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function (HttpException $exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $exception->getRequest(), + $exception->getResponse(), + $exception + ); + } + ); + } + + /** + * Create request for operation 'uploadImageFullFormDataNested' + * + * @param int $pet_id ID of pet to update (required) + * @param \OpenAPI\Client\Model\PetWithFile $pet (optional) + * + * @throws \InvalidArgumentException + * @return RequestInterface + */ + public function uploadImageFullFormDataNestedRequest($pet_id, $pet = null) + { + // verify the required parameter 'pet_id' is set + if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pet_id when calling uploadImageFullFormDataNested' + ); + } + + $resourcePath = '/pet/{petId}/uploadImageFullFormDataNested'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = null; + $multipart = false; + + + + // path params + if ($pet_id !== null) { + $resourcePath = str_replace( + '{' . 'petId' . '}', + ObjectSerializer::toPathValue($pet_id), + $resourcePath + ); + } + + // form params + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'pet' => $pet, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $headers = $this->headerSelector->selectHeaders( ['application/json'], diff --git a/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php b/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php index 387bd9864a30..ced4b55f6f6b 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php @@ -43,6 +43,7 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\DebugPlugin; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; diff --git a/samples/client/petstore/php/psr-18/lib/Api/UserApi.php b/samples/client/petstore/php/psr-18/lib/Api/UserApi.php index e0c744726ed9..6e7edac2d9fb 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/UserApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/UserApi.php @@ -43,6 +43,7 @@ use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\DebugPlugin; use OpenAPI\Client\HeaderSelector; +use OpenAPI\Client\FormDataProcessor; use OpenAPI\Client\ObjectSerializer; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Client\ClientInterface; diff --git a/samples/client/petstore/php/psr-18/lib/FormDataProcessor.php b/samples/client/petstore/php/psr-18/lib/FormDataProcessor.php new file mode 100644 index 000000000000..c416f584e6aa --- /dev/null +++ b/samples/client/petstore/php/psr-18/lib/FormDataProcessor.php @@ -0,0 +1,242 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + $result[$currentName] = ObjectSerializer::toString($val); + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/samples/client/petstore/php/psr-18/lib/Model/PetWithFile.php b/samples/client/petstore/php/psr-18/lib/Model/PetWithFile.php new file mode 100644 index 000000000000..3e91dabb4b55 --- /dev/null +++ b/samples/client/petstore/php/psr-18/lib/Model/PetWithFile.php @@ -0,0 +1,691 @@ + + */ +class PetWithFile implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PetWithFile'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'category' => '\OpenAPI\Client\Model\Category', + 'name' => 'string', + 'photo_urls' => 'string[]', + 'tags' => '\OpenAPI\Client\Model\Tag[]', + 'status' => 'string', + 'file' => '\SplFileObject', + 'multiple_files' => '\SplFileObject[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'int64', + 'category' => null, + 'name' => null, + 'photo_urls' => null, + 'tags' => null, + 'status' => null, + 'file' => 'binary', + 'multiple_files' => 'binary' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'category' => false, + 'name' => false, + 'photo_urls' => false, + 'tags' => false, + 'status' => false, + 'file' => false, + 'multiple_files' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'category' => 'category', + 'name' => 'name', + 'photo_urls' => 'photoUrls', + 'tags' => 'tags', + 'status' => 'status', + 'file' => 'file', + 'multiple_files' => 'multiple_files' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'category' => 'setCategory', + 'name' => 'setName', + 'photo_urls' => 'setPhotoUrls', + 'tags' => 'setTags', + 'status' => 'setStatus', + 'file' => 'setFile', + 'multiple_files' => 'setMultipleFiles' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'category' => 'getCategory', + 'name' => 'getName', + 'photo_urls' => 'getPhotoUrls', + 'tags' => 'getTags', + 'status' => 'getStatus', + 'file' => 'getFile', + 'multiple_files' => 'getMultipleFiles' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_AVAILABLE = 'available'; + public const STATUS_PENDING = 'pending'; + public const STATUS_SOLD = 'sold'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_AVAILABLE, + self::STATUS_PENDING, + self::STATUS_SOLD, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('photo_urls', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('file', $data ?? [], null); + $this->setIfExists('multiple_files', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['photo_urls'] === null) { + $invalidProperties[] = "'photo_urls' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets category + * + * @return \OpenAPI\Client\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \OpenAPI\Client\Model\Category|null $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets photo_urls + * + * @return string[] + */ + public function getPhotoUrls() + { + return $this->container['photo_urls']; + } + + /** + * Sets photo_urls + * + * @param string[] $photo_urls photo_urls + * + * @return self + */ + public function setPhotoUrls($photo_urls) + { + if (is_null($photo_urls)) { + throw new \InvalidArgumentException('non-nullable photo_urls cannot be null'); + } + + + $this->container['photo_urls'] = $photo_urls; + + return $this; + } + + /** + * Gets tags + * + * @return \OpenAPI\Client\Model\Tag[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param \OpenAPI\Client\Model\Tag[]|null $tags tags + * + * @return self + */ + public function setTags($tags) + { + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status pet status in the store + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets file + * + * @return \SplFileObject|null + */ + public function getFile() + { + return $this->container['file']; + } + + /** + * Sets file + * + * @param \SplFileObject|null $file file to upload + * + * @return self + */ + public function setFile($file) + { + if (is_null($file)) { + throw new \InvalidArgumentException('non-nullable file cannot be null'); + } + $this->container['file'] = $file; + + return $this; + } + + /** + * Gets multiple_files + * + * @return \SplFileObject[]|null + */ + public function getMultipleFiles() + { + return $this->container['multiple_files']; + } + + /** + * Sets multiple_files + * + * @param \SplFileObject[]|null $multiple_files multiple_files + * + * @return self + */ + public function setMultipleFiles($multiple_files) + { + if (is_null($multiple_files)) { + throw new \InvalidArgumentException('non-nullable multiple_files cannot be null'); + } + $this->container['multiple_files'] = $multiple_files; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/psr-18/lib/ObjectSerializer.php b/samples/client/petstore/php/psr-18/lib/ObjectSerializer.php index a144eb7641b1..daa7d49244ce 100644 --- a/samples/client/petstore/php/psr-18/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/psr-18/lib/ObjectSerializer.php @@ -28,7 +28,6 @@ namespace OpenAPI\Client; -use ArrayAccess; use GuzzleHttp\Psr7\Utils; use OpenAPI\Client\Model\ModelInterface; @@ -324,35 +323,6 @@ class ObjectSerializer return self::toString($value); } - /** - * Take value and turn it into an array suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|bool|array|DateTime|ArrayAccess|\SplFileObject $value the value of the form parameter - * - * @return array [key => value] of formdata - */ - public static function toFormValue(string $key, $value) - { - if ($value instanceof \SplFileObject) { - return [$key => $value->getRealPath()]; - } elseif (is_array($value) || $value instanceof ArrayAccess) { - $flattened = []; - $result = []; - - self::flattenArray(json_decode(json_encode($value), true), $flattened); - - foreach ($flattened as $k => $v) { - $result["{$key}{$k}"] = self::toString($v); - } - - return $result; - } else { - return [$key => self::toString($value)]; - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -626,81 +596,4 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - - /** - * Flattens an array of Model object and generates an array compatible - * with formdata - a single-level array where the keys use bracket - * notation to signify nested data. - * - * @param \ArrayAccess|array $source - * - * credit: https://github.com/FranBar1966/FlatPHP - */ - private static function flattenArray( - $source, - array &$destination, - string $start = '' - ) { - $opt = [ - 'prefix' => '[', - 'suffix' => ']', - 'suffix-end' => true, - 'prefix-list' => '[', - 'suffix-list' => ']', - 'suffix-list-end' => true, - ]; - - if (!is_array($source)) { - $source = (array) $source; - } - - /** - * array_is_list only in PHP >= 8.1 - * - * credit: https://www.php.net/manual/en/function.array-is-list.php#127044 - */ - if (!function_exists('array_is_list')) { - function array_is_list(array $array) - { - $i = -1; - - foreach ($array as $k => $v) { - ++$i; - if ($k !== $i) { - return false; - } - } - - return true; - } - } - - if (array_is_list($source)) { - $currentPrefix = $opt['prefix-list']; - $currentSuffix = $opt['suffix-list']; - $currentSuffixEnd = $opt['suffix-list-end']; - } else { - $currentPrefix = $opt['prefix']; - $currentSuffix = $opt['suffix']; - $currentSuffixEnd = $opt['suffix-end']; - } - - $currentName = $start; - - foreach ($source as $key => $val) { - $currentName .= $currentPrefix.$key; - - if (is_array($val) && !empty($val)) { - $currentName .= "{$currentSuffix}"; - self::flattenArray($val, $destination, $currentName); - } else { - if ($currentSuffixEnd) { - $currentName .= $currentSuffix; - } - $destination[$currentName] = self::toString($val); - } - - $currentName = $start; - } - } } diff --git a/samples/client/petstore/php/psr-18/test/Model/PetWithFileTest.php b/samples/client/petstore/php/psr-18/test/Model/PetWithFileTest.php new file mode 100644 index 000000000000..ce0a73f294d0 --- /dev/null +++ b/samples/client/petstore/php/psr-18/test/Model/PetWithFileTest.php @@ -0,0 +1,153 @@ + | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/TypeTesting.md b/samples/client/petstore/rust/hyper0x/petstore/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/docs/TypeTesting.md +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/docs/TypeTesting.md b/samples/client/petstore/rust/reqwest-trait/petstore/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/docs/TypeTesting.md +++ b/samples/client/petstore/rust/reqwest-trait/petstore/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/reqwest-trait/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest-trait/petstore/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TypeTesting.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TypeTesting.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TypeTesting.md b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TypeTesting.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/TypeTesting.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/docs/TypeTesting.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TypeTesting.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TypeTesting.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TypeTesting.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TypeTesting.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTypeTesting.md b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTypeTesting.md index cc73c9906870..76008e985b30 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTypeTesting.md +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/docs/FooTypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_type_testing.rs index 4fe82f1015f3..facf71f65c72 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/foo_type_testing.rs @@ -34,6 +34,9 @@ pub struct FooTypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl FooTypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs index 6eb5170bcb75..fc3f2bacb464 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod foo_user; pub use self::foo_user::FooUser; pub mod foo_vehicle; pub use self::foo_vehicle::FooVehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/TypeTesting.md b/samples/client/petstore/rust/reqwest/petstore/docs/TypeTesting.md index 393d1b9bd27f..27b8f2622424 100644 --- a/samples/client/petstore/rust/reqwest/petstore/docs/TypeTesting.md +++ b/samples/client/petstore/rust/reqwest/petstore/docs/TypeTesting.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **boolean** | **bool** | | **uuid** | [**uuid::Uuid**](uuid::Uuid.md) | | **bytes** | **String** | | +**nullable_bytes** | Option<**String**> | | [optional] **decimal** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs index ee02ccdd5303..70b354278ab2 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs @@ -42,3 +42,40 @@ pub mod user; pub use self::user::User; pub mod vehicle; pub use self::vehicle::Vehicle; +use serde::{Deserialize, Deserializer, Serializer}; +use serde_with::{de::DeserializeAsWrap, ser::SerializeAsWrap, DeserializeAs, SerializeAs}; +use std::marker::PhantomData; + +pub(crate) struct DoubleOption(PhantomData); + +impl SerializeAs>> for DoubleOption +where + TAs: SerializeAs, +{ + fn serialize_as(values: &Option>, serializer: S) -> Result + where + S: Serializer, + { + match values { + None => serializer.serialize_unit(), + Some(None) => serializer.serialize_none(), + Some(Some(v)) => serializer.serialize_some(&SerializeAsWrap::::new(v)), + } + } +} + +impl<'de, T, TAs> DeserializeAs<'de, Option>> for DoubleOption +where + TAs: DeserializeAs<'de, T>, + T: std::fmt::Debug, +{ + fn deserialize_as(deserializer: D) -> Result>, D::Error> + where + D: Deserializer<'de>, + { + Ok(Some( + DeserializeAsWrap::, Option>::deserialize(deserializer)? + .into_inner(), + )) + } +} diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs index 9e797e82298d..1c406069fece 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs @@ -34,6 +34,9 @@ pub struct TypeTesting { #[serde_as(as = "serde_with::base64::Base64")] #[serde(rename = "bytes")] pub bytes: Vec, + #[serde_as(as = "super::DoubleOption")] + #[serde(rename = "nullableBytes", default, skip_serializing_if = "Option::is_none")] + pub nullable_bytes: Option>>, #[serde(rename = "decimal")] pub decimal: String, } @@ -50,6 +53,7 @@ impl TypeTesting { boolean, uuid, bytes, + nullable_bytes: None, decimal, } } diff --git a/samples/client/petstore/rust/reqwest/petstore/tests/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore/tests/type_testing.rs index 0ee189f7f5fb..39351798878a 100644 --- a/samples/client/petstore/rust/reqwest/petstore/tests/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/tests/type_testing.rs @@ -14,6 +14,7 @@ fn test_types() { boolean: true, uuid: Uuid::new_v4(), bytes: vec![1, 2, 3, 4], + nullable_bytes: Some(Some(vec![1, 2, 3, 4])), decimal: String::from("foo"), }; assert_eq!(type_of(tt.int32), "i32"); diff --git a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Order.scala b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Order.scala index a9649cc85cab..c43f5098eb8a 100644 --- a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Order.scala +++ b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Order.scala @@ -52,7 +52,7 @@ object Order { petId <- c.downField("petId").as[Option[Long]] quantity <- c.downField("quantity").as[Option[Int]] shipDate <- c.downField("shipDate").as[Option[Instant]] - status <- c.downField("status").as[Option[OrderStatus]] + status <- mapEmptyStringToNull(c.downField("status")).as[Option[OrderStatus]] complete <- c.downField("complete").as[Option[Boolean]] } yield Order( id = id, diff --git a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Pet.scala b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Pet.scala index 2800dcbdb4bb..011920e024f3 100644 --- a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Pet.scala +++ b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/Pet.scala @@ -53,7 +53,7 @@ object Pet { name <- c.downField("name").as[String] photoUrls <- c.downField("photoUrls").as[Seq[String]] tags <- c.downField("tags").as[Option[Seq[Tag]]] - status <- c.downField("status").as[Option[PetStatus]] + status <- mapEmptyStringToNull(c.downField("status")).as[Option[PetStatus]] } yield Pet( id = id, category = category, diff --git a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/package.scala b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/package.scala index 17fb2a647027..b90140c23915 100644 --- a/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/package.scala +++ b/samples/client/petstore/scala-http4s/src/main/scala/org/openapitools/client/models/package.scala @@ -10,7 +10,7 @@ */ package org.openapitools.client -import io.circe.{Decoder, Encoder, Json} +import io.circe.{Decoder, Encoder, Json, ACursor} import java.time.{Instant, LocalDate, OffsetDateTime} import java.util.UUID @@ -40,4 +40,7 @@ package object models { given encodeJson: Encoder[Json] = Encoder.encodeString.contramap[Json](_.toString) + def mapEmptyStringToNull(f: ACursor): ACursor = + f.withFocus(json => if json.toString == "\"\"" then Json.Null else json) + } \ No newline at end of file diff --git a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java index 5b80ec1cf779..a95f571f4299 100644 --- a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java @@ -135,6 +135,7 @@ public interface PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated @@ -165,6 +166,7 @@ public interface PetApi { ) ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags, + @ApiParam(value = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.") @RequestHeader(value = "size", required = false) String size, @ApiIgnore final Pageable pageable ); diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index 208ee2c917e0..7d61b0e77569 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ internal class JSONEncodingHelper { return params } - internal class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift index d28af2eba97a..71c8b4e84faf 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/JSONEncodingHelper.swift @@ -26,20 +26,4 @@ open class JSONEncodingHelper { return params } - open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? { - var params: [String: any Sendable]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - } diff --git a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts index 825f75dd08d0..47200d0aebd7 100644 --- a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * fruity + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts index 8dd96805b824..1ee2b0cf595e 100644 --- a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts +++ b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api/default.service.ts @@ -68,11 +68,12 @@ export class DefaultService extends BaseService { } let localVarPath = `/`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -122,12 +123,13 @@ export class DefaultService extends BaseService { } let localVarPath = `/`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/configuration.ts index 788d6f1a9ee9..2a128451c081 100644 --- a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; } /** diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/pet.service.ts index d3c961709cfe..0a22403c0bfd 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/pet.service.ts @@ -87,12 +87,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -144,11 +145,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -205,12 +207,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -268,12 +271,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -324,11 +328,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -386,12 +391,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -463,12 +469,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -544,12 +551,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/store.service.ts index de5f063fed7d..a4948f432839 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -234,12 +237,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/user.service.ts index 2017bb197dc8..e149df274bc8 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api/user.service.ts @@ -81,12 +81,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -139,12 +140,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -197,12 +199,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -248,11 +251,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -299,11 +303,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -360,12 +365,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -406,11 +412,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -468,12 +475,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts index bd521164ac1e..a7bcfa4cfaf3 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts @@ -87,12 +87,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -144,11 +145,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -205,12 +207,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -268,12 +271,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -324,11 +328,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -386,12 +391,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -463,12 +469,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -544,12 +551,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts index b16f3f92b60c..6224b9147f1e 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -234,12 +237,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts index 0ec7b7892934..9522c50a96db 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts @@ -81,12 +81,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -139,12 +140,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -197,12 +199,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -248,11 +251,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -299,11 +303,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -360,12 +365,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -406,11 +412,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -468,12 +475,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts index bd521164ac1e..a7bcfa4cfaf3 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts @@ -87,12 +87,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -144,11 +145,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -205,12 +207,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -268,12 +271,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -324,11 +328,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -386,12 +391,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -463,12 +469,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -544,12 +551,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts index b16f3f92b60c..6224b9147f1e 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -234,12 +237,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts index 0ec7b7892934..9522c50a96db 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts @@ -81,12 +81,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -139,12 +140,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -197,12 +199,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -248,11 +251,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -299,11 +303,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -360,12 +365,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -406,11 +412,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -468,12 +475,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json index 89cdedb1cb7f..41165c30a2c9 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json @@ -7,6 +7,8 @@ "module": "commonjs", "moduleResolution": "node", "removeComments": true, + "strictNullChecks": true, + "exactOptionalPropertyTypes": true, "sourceMap": true, "outDir": "./dist", "noLib": false, diff --git a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts index 825f75dd08d0..47200d0aebd7 100644 --- a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * fruity + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts index 8dd96805b824..1ee2b0cf595e 100644 --- a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts +++ b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api/default.service.ts @@ -68,11 +68,12 @@ export class DefaultService extends BaseService { } let localVarPath = `/`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -122,12 +123,13 @@ export class DefaultService extends BaseService { } let localVarPath = `/`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/configuration.ts index 788d6f1a9ee9..2a128451c081 100644 --- a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; } /** diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/pet.service.ts index d3c961709cfe..0a22403c0bfd 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/pet.service.ts @@ -87,12 +87,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -144,11 +145,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -205,12 +207,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -268,12 +271,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -324,11 +328,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -386,12 +391,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -463,12 +469,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -544,12 +551,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/store.service.ts index de5f063fed7d..a4948f432839 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -234,12 +237,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/user.service.ts index 2017bb197dc8..e149df274bc8 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api/user.service.ts @@ -81,12 +81,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -139,12 +140,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -197,12 +199,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -248,11 +251,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -299,11 +303,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -360,12 +365,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -406,11 +412,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -468,12 +475,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: body, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/pet.service.ts index 0d8a3c94ba32..e9dea48dc1e1 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/pet.service.ts @@ -90,12 +90,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,11 +149,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -209,12 +211,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -272,12 +275,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -328,11 +332,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -393,12 +398,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -471,12 +477,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -553,12 +560,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/store.service.ts index d7ef22bcbf32..293af2773e30 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -236,12 +239,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/user.service.ts index 8ae881bfc48c..a28a7d888830 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/user.service.ts @@ -85,12 +85,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,12 +149,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -211,12 +213,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -265,11 +268,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -317,11 +321,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -379,12 +384,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -429,11 +435,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -495,12 +502,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/pet.service.ts index 0d8a3c94ba32..e9dea48dc1e1 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/pet.service.ts @@ -90,12 +90,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,11 +149,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -209,12 +211,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -272,12 +275,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -328,11 +332,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -393,12 +398,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -471,12 +477,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -553,12 +560,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/store.service.ts index d7ef22bcbf32..293af2773e30 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -236,12 +239,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/user.service.ts index 8ae881bfc48c..a28a7d888830 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api/user.service.ts @@ -85,12 +85,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,12 +149,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -211,12 +213,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -265,11 +268,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -317,11 +321,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -379,12 +384,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -429,11 +435,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -495,12 +502,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/tsconfig.json b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/tsconfig.json index 85f130ae01ef..b3049e9eee69 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/tsconfig.json +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/tsconfig.json @@ -7,6 +7,8 @@ "module": "es6", "moduleResolution": "node", "removeComments": true, + "strictNullChecks": true, + "exactOptionalPropertyTypes": true, "sourceMap": true, "outDir": "./dist", "noLib": false, diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/pet.service.ts index 0d8a3c94ba32..e9dea48dc1e1 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/pet.service.ts @@ -90,12 +90,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,11 +149,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -209,12 +211,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -272,12 +275,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -328,11 +332,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -393,12 +398,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -471,12 +477,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -553,12 +560,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/store.service.ts index d7ef22bcbf32..293af2773e30 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -236,12 +239,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/user.service.ts index 8ae881bfc48c..a28a7d888830 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api/user.service.ts @@ -85,12 +85,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,12 +149,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -211,12 +213,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -265,11 +268,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -317,11 +321,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -379,12 +384,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -429,11 +435,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -495,12 +502,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/pet.service.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/pet.service.ts index 7c23109fcbd1..4f3efb627cc0 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/pet.service.ts @@ -90,12 +90,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,11 +149,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -209,12 +211,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -272,12 +275,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -328,11 +332,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -393,12 +398,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -471,12 +477,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -553,12 +560,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/store.service.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/store.service.ts index d7ef22bcbf32..293af2773e30 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -236,12 +239,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/user.service.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/user.service.ts index 8ae881bfc48c..a28a7d888830 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api/user.service.ts @@ -85,12 +85,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,12 +149,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -211,12 +213,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -265,11 +268,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -317,11 +321,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -379,12 +384,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -429,11 +435,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -495,12 +502,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/pet.service.ts index 0d8a3c94ba32..e9dea48dc1e1 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/pet.service.ts @@ -90,12 +90,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,11 +149,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -209,12 +211,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -272,12 +275,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -328,11 +332,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -393,12 +398,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -471,12 +477,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -553,12 +560,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/store.service.ts index d7ef22bcbf32..293af2773e30 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -236,12 +239,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/user.service.ts index 8ae881bfc48c..a28a7d888830 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api/user.service.ts @@ -85,12 +85,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,12 +149,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -211,12 +213,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -265,11 +268,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -317,11 +321,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -379,12 +384,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -429,11 +435,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -495,12 +502,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/pet.service.ts index 0d8a3c94ba32..e9dea48dc1e1 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/pet.service.ts @@ -90,12 +90,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,11 +149,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -209,12 +211,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -272,12 +275,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -328,11 +332,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -393,12 +398,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -471,12 +477,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -553,12 +560,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/store.service.ts index d7ef22bcbf32..293af2773e30 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/store.service.ts @@ -73,11 +73,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -123,11 +124,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -175,11 +177,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -236,12 +239,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/user.service.ts index 8ae881bfc48c..a28a7d888830 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api/user.service.ts @@ -85,12 +85,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -148,12 +149,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -211,12 +213,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -265,11 +268,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -317,11 +321,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -379,12 +384,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -429,11 +435,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress @@ -495,12 +502,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, reportProgress: reportProgress diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/pet.service.ts index bcf947daeefe..7eb28f7f8190 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/pet.service.ts @@ -92,12 +92,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,11 +154,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -217,12 +219,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -283,12 +286,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -342,11 +346,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -410,12 +415,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -491,12 +497,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -576,12 +583,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/store.service.ts index bea75200beb7..6a34d4e6e1d2 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/store.service.ts @@ -75,11 +75,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -128,11 +129,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -183,11 +185,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -247,12 +250,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/user.service.ts index 7f6bdae0ac28..12c23c43b419 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api/user.service.ts @@ -87,12 +87,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,12 +154,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -219,12 +221,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -276,11 +279,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -331,11 +335,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -396,12 +401,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -449,11 +455,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -518,12 +525,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/pet.service.ts index bcf947daeefe..7eb28f7f8190 100644 --- a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/pet.service.ts @@ -92,12 +92,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,11 +154,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -217,12 +219,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -283,12 +286,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -342,11 +346,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -410,12 +415,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -491,12 +497,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -576,12 +583,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/store.service.ts index bea75200beb7..6a34d4e6e1d2 100644 --- a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/store.service.ts @@ -75,11 +75,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -128,11 +129,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -183,11 +185,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -247,12 +250,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/user.service.ts index 7f6bdae0ac28..12c23c43b419 100644 --- a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api/user.service.ts @@ -87,12 +87,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,12 +154,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -219,12 +221,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -276,11 +279,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -331,11 +335,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -396,12 +401,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -449,11 +455,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -518,12 +525,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/pet.service.ts index bcf947daeefe..7eb28f7f8190 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/pet.service.ts @@ -92,12 +92,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,11 +154,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -217,12 +219,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -283,12 +286,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -342,11 +346,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -410,12 +415,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -491,12 +497,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -576,12 +583,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/store.service.ts index bea75200beb7..6a34d4e6e1d2 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/store.service.ts @@ -75,11 +75,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -128,11 +129,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -183,11 +185,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -247,12 +250,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/user.service.ts index 7f6bdae0ac28..12c23c43b419 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api/user.service.ts @@ -87,12 +87,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,12 +154,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -219,12 +221,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -276,11 +279,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -331,11 +335,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -396,12 +401,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -449,11 +455,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -518,12 +525,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/tsconfig.json b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/tsconfig.json index 85f130ae01ef..b3049e9eee69 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/tsconfig.json +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/tsconfig.json @@ -7,6 +7,8 @@ "module": "es6", "moduleResolution": "node", "removeComments": true, + "strictNullChecks": true, + "exactOptionalPropertyTypes": true, "sourceMap": true, "outDir": "./dist", "noLib": false, diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts index 3ccc0eb78d24..f8664864f0ba 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts @@ -1,3 +1,12 @@ +/** + * OpenAPI Petstore + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v19/builds/default/api/pet.service.ts index bcf947daeefe..7eb28f7f8190 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v19/builds/default/api/pet.service.ts @@ -92,12 +92,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,11 +154,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -217,12 +219,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByStatus`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -283,12 +286,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/findByTags`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -342,11 +346,12 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -410,12 +415,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: pet, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -491,12 +497,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -576,12 +583,13 @@ export class PetService extends BaseService { } let localVarPath = `/pet/${this.configuration.encodeParam({name: "petId", value: petId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}/uploadImage`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v19/builds/default/api/store.service.ts index bea75200beb7..6a34d4e6e1d2 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v19/builds/default/api/store.service.ts @@ -75,11 +75,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -128,11 +129,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/inventory`; - return this.httpClient.request<{ [key: string]: number; }>('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request<{ [key: string]: number; }>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -183,11 +185,12 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order/${this.configuration.encodeParam({name: "orderId", value: orderId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -247,12 +250,13 @@ export class StoreService extends BaseService { } let localVarPath = `/store/order`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: order, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v19/builds/default/api/user.service.ts index 7f6bdae0ac28..12c23c43b419 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v19/builds/default/api/user.service.ts @@ -87,12 +87,13 @@ export class UserService extends BaseService { } let localVarPath = `/user`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -153,12 +154,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithArray`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -219,12 +221,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/createWithList`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -276,11 +279,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -331,11 +335,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -396,12 +401,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/login`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -449,11 +455,12 @@ export class UserService extends BaseService { } let localVarPath = `/user/logout`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, @@ -518,12 +525,13 @@ export class UserService extends BaseService { } let localVarPath = `/user/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, { context: localVarHttpContext, body: user, responseType: responseType_, - withCredentials: this.configuration.withCredentials, + ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, transferCache: localVarTransferCache, diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts index cd1840342841..775b99892d50 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v19/builds/default/configuration.ts @@ -66,26 +66,30 @@ export class Configuration { */ credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; } - else { - this.encodeParam = param => this.defaultEncodeParam(param); + if (username !== undefined) { + this.username = username; } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; + if (password !== undefined) { + this.password = password; } - else { - this.credentials = {}; + if (accessToken !== undefined) { + this.accessToken = accessToken; } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; // init default petstore_auth credential if (!this.credentials['petstore_auth']) { diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/tsconfig.json b/samples/client/petstore/typescript-angular-v19/builds/default/tsconfig.json index 85f130ae01ef..b3049e9eee69 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/tsconfig.json +++ b/samples/client/petstore/typescript-angular-v19/builds/default/tsconfig.json @@ -7,6 +7,8 @@ "module": "es6", "moduleResolution": "node", "removeComments": true, + "strictNullChecks": true, + "exactOptionalPropertyTypes": true, "sourceMap": true, "outDir": "./dist", "noLib": false, diff --git a/samples/config/petstore/protobuf-schema-config/models/data.proto b/samples/config/petstore/protobuf-schema-config/models/data.proto index 45298f62de1a..934cd994cc4c 100644 --- a/samples/config/petstore/protobuf-schema-config/models/data.proto +++ b/samples/config/petstore/protobuf-schema-config/models/data.proto @@ -12,6 +12,10 @@ syntax = "proto3"; package petstore; +option java_multiple_files = false; +option java_package = "com.example.tutorial.protos.model"; +option java_outer_classname = "ExampleProtos"; + import public "google/protobuf/struct.proto"; message ApiResponse { diff --git a/samples/config/petstore/protobuf-schema-config/services/default_service.proto b/samples/config/petstore/protobuf-schema-config/services/default_service.proto index 762534348232..ed0454f7ad46 100644 --- a/samples/config/petstore/protobuf-schema-config/services/default_service.proto +++ b/samples/config/petstore/protobuf-schema-config/services/default_service.proto @@ -12,6 +12,10 @@ syntax = "proto3"; package petstore.services.defaultservice; +option java_multiple_files = true; +option java_package = "com.example.tutorial.protos.api"; +option java_outer_classname = "ExampleProtos"; + import "google/protobuf/empty.proto"; import public "models/data.proto"; diff --git a/samples/config/petstore/protobuf-schema-config/services/pet_service.proto b/samples/config/petstore/protobuf-schema-config/services/pet_service.proto index c083e9a55cd6..2ecee05014f4 100644 --- a/samples/config/petstore/protobuf-schema-config/services/pet_service.proto +++ b/samples/config/petstore/protobuf-schema-config/services/pet_service.proto @@ -12,6 +12,10 @@ syntax = "proto3"; package petstore.services.petservice; +option java_multiple_files = true; +option java_package = "com.example.tutorial.protos.api"; +option java_outer_classname = "ExampleProtos"; + import "google/protobuf/empty.proto"; import public "models/data.proto"; diff --git a/samples/config/petstore/protobuf-schema-config/services/store_service.proto b/samples/config/petstore/protobuf-schema-config/services/store_service.proto index 62c3aaf00ab6..4a435c8fe67c 100644 --- a/samples/config/petstore/protobuf-schema-config/services/store_service.proto +++ b/samples/config/petstore/protobuf-schema-config/services/store_service.proto @@ -12,6 +12,10 @@ syntax = "proto3"; package petstore.services.storeservice; +option java_multiple_files = true; +option java_package = "com.example.tutorial.protos.api"; +option java_outer_classname = "ExampleProtos"; + import "google/protobuf/empty.proto"; import public "models/data.proto"; diff --git a/samples/config/petstore/protobuf-schema-config/services/user_service.proto b/samples/config/petstore/protobuf-schema-config/services/user_service.proto index 888cd12a3ff9..2573cfa4edae 100644 --- a/samples/config/petstore/protobuf-schema-config/services/user_service.proto +++ b/samples/config/petstore/protobuf-schema-config/services/user_service.proto @@ -12,6 +12,10 @@ syntax = "proto3"; package petstore.services.userservice; +option java_multiple_files = true; +option java_package = "com.example.tutorial.protos.api"; +option java_outer_classname = "ExampleProtos"; + import "google/protobuf/empty.proto"; import public "models/data.proto"; diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index e4f654dc04b7..b1b582b33664 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -522,6 +522,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1060,6 +1061,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1090,22 +1107,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1188,8 +1189,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1210,6 +1213,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1219,8 +1227,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1312,4 +1318,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java index 2b0c723159fe..57a85a3816df 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java @@ -473,6 +473,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1011,6 +1012,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1041,22 +1058,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1139,8 +1140,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1161,6 +1164,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1170,8 +1178,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1263,4 +1269,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java index 17d9353fd64c..9cd3d085103e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -598,6 +598,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1136,6 +1137,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1166,22 +1183,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1280,8 +1281,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1302,6 +1305,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1311,8 +1319,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1404,4 +1410,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java index 17d9353fd64c..9cd3d085103e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java @@ -598,6 +598,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1136,6 +1137,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1166,22 +1183,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1280,8 +1281,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1302,6 +1305,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1311,8 +1319,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1404,4 +1410,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 60d1dd07ae88..0482577ff82b 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -696,6 +696,7 @@ public class ApiClient extends JavaTimeFormatter { */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; + applyDebugSetting(this.clientConfig); // Rebuild HTTP Client according to the new "debugging" value. this.httpClient = buildHttpClient(); return this; @@ -1234,6 +1235,22 @@ public class ApiClient extends JavaTimeFormatter { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + serializeToString(body, formParams, contentType, isBodyNullable), + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1264,22 +1281,6 @@ public class ApiClient extends JavaTimeFormatter { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - serializeToString(body, formParams, contentType, isBodyNullable), - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { @@ -1378,8 +1379,10 @@ public class ApiClient extends JavaTimeFormatter { * @return Client */ protected Client buildHttpClient() { - // recreate the client config to pickup changes - clientConfig = getDefaultClientConfig(); + // Create ClientConfig if it has not been initialized yet + if (clientConfig == null) { + clientConfig = getDefaultClientConfig(); + } ClientBuilder clientBuilder = ClientBuilder.newBuilder(); clientBuilder = clientBuilder.withConfig(clientConfig); @@ -1400,6 +1403,11 @@ public class ApiClient extends JavaTimeFormatter { clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + applyDebugSetting(clientConfig); + return clientConfig; + } + + private void applyDebugSetting(ClientConfig clientConfig) { if (debugging) { clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); @@ -1409,8 +1417,6 @@ public class ApiClient extends JavaTimeFormatter { // suppress warnings for payloads with DELETE calls: java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } - - return clientConfig; } /** @@ -1502,4 +1508,4 @@ public class ApiClient extends JavaTimeFormatter { auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } -} +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES index ffbffbcee5f5..e9cb10689de7 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES @@ -39,8 +39,10 @@ docs/Dog.md docs/DummyModel.md docs/EnumArrays.md docs/EnumClass.md +docs/EnumNumberVendorExt.md docs/EnumString1.md docs/EnumString2.md +docs/EnumStringVendorExt.md docs/EnumTest.md docs/FakeApi.md docs/FakeClassnameTags123Api.md @@ -167,8 +169,10 @@ petstore_api/models/dog.py petstore_api/models/dummy_model.py petstore_api/models/enum_arrays.py petstore_api/models/enum_class.py +petstore_api/models/enum_number_vendor_ext.py petstore_api/models/enum_string1.py petstore_api/models/enum_string2.py +petstore_api/models/enum_string_vendor_ext.py petstore_api/models/enum_test.py petstore_api/models/feeding.py petstore_api/models/file.py diff --git a/samples/openapi3/client/petstore/python-aiohttp/README.md b/samples/openapi3/client/petstore/python-aiohttp/README.md index dcfe63d69e4f..55b51449a6ed 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-aiohttp/README.md @@ -185,8 +185,10 @@ Class | Method | HTTP request | Description - [DummyModel](docs/DummyModel.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) + - [EnumNumberVendorExt](docs/EnumNumberVendorExt.md) - [EnumString1](docs/EnumString1.md) - [EnumString2](docs/EnumString2.md) + - [EnumStringVendorExt](docs/EnumStringVendorExt.md) - [EnumTest](docs/EnumTest.md) - [Feeding](docs/Feeding.md) - [File](docs/File.md) diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumNumberVendorExt.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumNumberVendorExt.md new file mode 100644 index 000000000000..4c1572b1d277 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumNumberVendorExt.md @@ -0,0 +1,14 @@ +# EnumNumberVendorExt + + +## Enum + +* `FortyTwo` (value: `42`) + +* `Eigtheen` (value: `18`) + +* `FiftySix` (value: `56`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumStringVendorExt.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumStringVendorExt.md new file mode 100644 index 000000000000..ce6077c18a3b --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumStringVendorExt.md @@ -0,0 +1,14 @@ +# EnumStringVendorExt + + +## Enum + +* `FOO_XEnumVarname` (value: `'FOO'`) + +* `BarVar_XEnumVarname` (value: `'Bar'`) + +* `bazVar_XEnumVarname` (value: `'baz'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumTest.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumTest.md index 8a3874d17375..9f96c605d888 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumTest.md @@ -10,14 +10,14 @@ Name | Type | Description | Notes **enum_integer_default** | **int** | | [optional] [default to 5] **enum_integer** | **int** | | [optional] **enum_number** | **float** | | [optional] -**enum_number_vendor_ext** | **int** | | [optional] -**enum_string_vendor_ext** | **str** | | [optional] **enum_string_single_member** | **str** | | [optional] **enum_integer_single_member** | **int** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] **outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] **outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to OuterEnumDefaultValue.PLACED] **outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] [default to OuterEnumIntegerDefaultValue.NUMBER_0] +**enum_number_vendor_ext** | [**EnumNumberVendorExt**](EnumNumberVendorExt.md) | | [optional] +**enum_string_vendor_ext** | [**EnumStringVendorExt**](EnumStringVendorExt.md) | | [optional] ## Example diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py index d7871f3e246c..9036b7a87421 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py @@ -73,8 +73,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.file import File diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py index 130555c82361..fc1f4acbdaf6 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py @@ -48,8 +48,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.file import File diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_number_vendor_ext.py new file mode 100644 index 000000000000..5588de5c7043 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_number_vendor_ext.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EnumNumberVendorExt(int, Enum): + """ + EnumNumberVendorExt + """ + + """ + allowed enum values + """ + FortyTwo = 42 + Eigtheen = 18 + FiftySix = 56 + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EnumNumberVendorExt from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string_vendor_ext.py new file mode 100644 index 000000000000..821812e9b088 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string_vendor_ext.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EnumStringVendorExt(str, Enum): + """ + EnumStringVendorExt + """ + + """ + allowed enum values + """ + FOO_XEnumVarname = 'FOO' + BarVar_XEnumVarname = 'Bar' + bazVar_XEnumVarname = 'baz' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EnumStringVendorExt from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py index 8d524d96f440..b7e6ec36230f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py @@ -19,6 +19,8 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.outer_enum import OuterEnum from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue from petstore_api.models.outer_enum_integer import OuterEnumInteger @@ -35,15 +37,15 @@ class EnumTest(BaseModel): enum_integer_default: Optional[StrictInt] = 5 enum_integer: Optional[StrictInt] = None enum_number: Optional[float] = None - enum_number_vendor_ext: Optional[StrictInt] = None - enum_string_vendor_ext: Optional[StrictStr] = None enum_string_single_member: Optional[StrictStr] = None enum_integer_single_member: Optional[StrictInt] = None outer_enum: Optional[OuterEnum] = Field(default=None, alias="outerEnum") outer_enum_integer: Optional[OuterEnumInteger] = Field(default=None, alias="outerEnumInteger") outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(default=OuterEnumDefaultValue.PLACED, alias="outerEnumDefaultValue") outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(default=OuterEnumIntegerDefaultValue.NUMBER_0, alias="outerEnumIntegerDefaultValue") - __properties: ClassVar[List[str]] = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_number_vendor_ext", "enum_string_vendor_ext", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] + enum_number_vendor_ext: Optional[EnumNumberVendorExt] = Field(default=None, alias="enumNumberVendorExt") + enum_string_vendor_ext: Optional[EnumStringVendorExt] = Field(default=None, alias="enumStringVendorExt") + __properties: ClassVar[List[str]] = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue", "enumNumberVendorExt", "enumStringVendorExt"] @field_validator('enum_string') def enum_string_validate_enum(cls, value): @@ -92,26 +94,6 @@ class EnumTest(BaseModel): raise ValueError("must be one of enum values (1.1, -1.2)") return value - @field_validator('enum_number_vendor_ext') - def enum_number_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set([42, 18, 56]): - raise ValueError("must be one of enum values (42, 18, 56)") - return value - - @field_validator('enum_string_vendor_ext') - def enum_string_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(['FOO', 'Bar', 'baz']): - raise ValueError("must be one of enum values ('FOO', 'Bar', 'baz')") - return value - @field_validator('enum_string_single_member') def enum_string_single_member_validate_enum(cls, value): """Validates the enum""" @@ -193,14 +175,14 @@ class EnumTest(BaseModel): "enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5, "enum_integer": obj.get("enum_integer"), "enum_number": obj.get("enum_number"), - "enum_number_vendor_ext": obj.get("enum_number_vendor_ext"), - "enum_string_vendor_ext": obj.get("enum_string_vendor_ext"), "enum_string_single_member": obj.get("enum_string_single_member"), "enum_integer_single_member": obj.get("enum_integer_single_member"), "outerEnum": obj.get("outerEnum"), "outerEnumInteger": obj.get("outerEnumInteger"), "outerEnumDefaultValue": obj.get("outerEnumDefaultValue") if obj.get("outerEnumDefaultValue") is not None else OuterEnumDefaultValue.PLACED, - "outerEnumIntegerDefaultValue": obj.get("outerEnumIntegerDefaultValue") if obj.get("outerEnumIntegerDefaultValue") is not None else OuterEnumIntegerDefaultValue.NUMBER_0 + "outerEnumIntegerDefaultValue": obj.get("outerEnumIntegerDefaultValue") if obj.get("outerEnumIntegerDefaultValue") is not None else OuterEnumIntegerDefaultValue.NUMBER_0, + "enumNumberVendorExt": obj.get("enumNumberVendorExt"), + "enumStringVendorExt": obj.get("enumStringVendorExt") }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_number_vendor_ext.py new file mode 100644 index 000000000000..62ff78318c77 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_number_vendor_ext.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt + +class TestEnumNumberVendorExt(unittest.TestCase): + """EnumNumberVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumNumberVendorExt(self): + """Test EnumNumberVendorExt""" + # inst = EnumNumberVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_string_vendor_ext.py new file mode 100644 index 000000000000..e82d7957d347 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_string_vendor_ext.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt + +class TestEnumStringVendorExt(unittest.TestCase): + """EnumStringVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumStringVendorExt(self): + """Test EnumStringVendorExt""" + # inst = EnumStringVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES index fc3e3d62b542..2e28d350da1a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES @@ -40,8 +40,10 @@ docs/Dog.md docs/DummyModel.md docs/EnumArrays.md docs/EnumClass.md +docs/EnumNumberVendorExt.md docs/EnumString1.md docs/EnumString2.md +docs/EnumStringVendorExt.md docs/EnumTest.md docs/FakeApi.md docs/FakeClassnameTags123Api.md @@ -168,8 +170,10 @@ petstore_api/models/dog.py petstore_api/models/dummy_model.py petstore_api/models/enum_arrays.py petstore_api/models/enum_class.py +petstore_api/models/enum_number_vendor_ext.py petstore_api/models/enum_string1.py petstore_api/models/enum_string2.py +petstore_api/models/enum_string_vendor_ext.py petstore_api/models/enum_test.py petstore_api/models/feeding.py petstore_api/models/field.py diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md index e819e5187b9c..ee90866eeb68 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md @@ -187,8 +187,10 @@ Class | Method | HTTP request | Description - [DummyModel](docs/DummyModel.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) + - [EnumNumberVendorExt](docs/EnumNumberVendorExt.md) - [EnumString1](docs/EnumString1.md) - [EnumString2](docs/EnumString2.md) + - [EnumStringVendorExt](docs/EnumStringVendorExt.md) - [EnumTest](docs/EnumTest.md) - [Feeding](docs/Feeding.md) - [Field](docs/Field.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumNumberVendorExt.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumNumberVendorExt.md new file mode 100644 index 000000000000..0c77b090abff --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumNumberVendorExt.md @@ -0,0 +1,14 @@ +# EnumNumberVendorExt + + +## Enum + +* `NUMBER_42` (value: `42`) + +* `NUMBER_18` (value: `18`) + +* `NUMBER_56` (value: `56`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumStringVendorExt.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumStringVendorExt.md new file mode 100644 index 000000000000..8abb456b402e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumStringVendorExt.md @@ -0,0 +1,14 @@ +# EnumStringVendorExt + + +## Enum + +* `FOO` (value: `'FOO'`) + +* `BAR` (value: `'Bar'`) + +* `BAZ` (value: `'baz'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md index 72470ff0c317..34ec6193b316 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md @@ -9,14 +9,14 @@ Name | Type | Description | Notes **enum_integer_default** | **int** | | [optional] [default to 5] **enum_integer** | **int** | | [optional] **enum_number** | **float** | | [optional] -**enum_number_vendor_ext** | **int** | | [optional] -**enum_string_vendor_ext** | **str** | | [optional] **enum_string_single_member** | **str** | | [optional] **enum_integer_single_member** | **int** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] **outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] **outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] **outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] +**enum_number_vendor_ext** | [**EnumNumberVendorExt**](EnumNumberVendorExt.md) | | [optional] +**enum_string_vendor_ext** | [**EnumStringVendorExt**](EnumStringVendorExt.md) | | [optional] ## Example diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py index 330c529ec6f4..0a4eca2f3b06 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py @@ -74,8 +74,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.field import Field diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py index 1a3ad2e2949d..91f0aad8026f 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py @@ -49,8 +49,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.field import Field diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_number_vendor_ext.py new file mode 100644 index 000000000000..b49e6ca339fe --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_number_vendor_ext.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumNumberVendorExt(int, Enum): + """ + EnumNumberVendorExt + """ + + """ + allowed enum values + """ + NUMBER_42 = 42 + NUMBER_18 = 18 + NUMBER_56 = 56 + + @classmethod + def from_json(cls, json_str: str) -> EnumNumberVendorExt: + """Create an instance of EnumNumberVendorExt from a JSON string""" + return EnumNumberVendorExt(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string_vendor_ext.py new file mode 100644 index 000000000000..ac33490efe13 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string_vendor_ext.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumStringVendorExt(str, Enum): + """ + EnumStringVendorExt + """ + + """ + allowed enum values + """ + FOO = 'FOO' + BAR = 'Bar' + BAZ = 'baz' + + @classmethod + def from_json(cls, json_str: str) -> EnumStringVendorExt: + """Create an instance of EnumStringVendorExt from a JSON string""" + return EnumStringVendorExt(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py index 5df6a535f199..40247e276473 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py @@ -20,6 +20,8 @@ import json from typing import Optional from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.outer_enum import OuterEnum from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue from petstore_api.models.outer_enum_integer import OuterEnumInteger @@ -34,15 +36,15 @@ class EnumTest(BaseModel): enum_integer_default: Optional[StrictInt] = 5 enum_integer: Optional[StrictInt] = None enum_number: Optional[float] = None - enum_number_vendor_ext: Optional[StrictInt] = None - enum_string_vendor_ext: Optional[StrictStr] = None enum_string_single_member: Optional[StrictStr] = None enum_integer_single_member: Optional[StrictInt] = None outer_enum: Optional[OuterEnum] = Field(default=None, alias="outerEnum") outer_enum_integer: Optional[OuterEnumInteger] = Field(default=None, alias="outerEnumInteger") outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(default=None, alias="outerEnumDefaultValue") outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(default=None, alias="outerEnumIntegerDefaultValue") - __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_number_vendor_ext", "enum_string_vendor_ext", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] + enum_number_vendor_ext: Optional[EnumNumberVendorExt] = Field(default=None, alias="enumNumberVendorExt") + enum_string_vendor_ext: Optional[EnumStringVendorExt] = Field(default=None, alias="enumStringVendorExt") + __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue", "enumNumberVendorExt", "enumStringVendorExt"] @validator('enum_string') def enum_string_validate_enum(cls, value): @@ -91,26 +93,6 @@ class EnumTest(BaseModel): raise ValueError("must be one of enum values (1.1, -1.2)") return value - @validator('enum_number_vendor_ext') - def enum_number_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in (42, 18, 56,): - raise ValueError("must be one of enum values (42, 18, 56)") - return value - - @validator('enum_string_vendor_ext') - def enum_string_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('FOO', 'Bar', 'baz',): - raise ValueError("must be one of enum values ('FOO', 'Bar', 'baz')") - return value - @validator('enum_string_single_member') def enum_string_single_member_validate_enum(cls, value): """Validates the enum""" @@ -177,14 +159,14 @@ class EnumTest(BaseModel): "enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5, "enum_integer": obj.get("enum_integer"), "enum_number": obj.get("enum_number"), - "enum_number_vendor_ext": obj.get("enum_number_vendor_ext"), - "enum_string_vendor_ext": obj.get("enum_string_vendor_ext"), "enum_string_single_member": obj.get("enum_string_single_member"), "enum_integer_single_member": obj.get("enum_integer_single_member"), "outer_enum": obj.get("outerEnum"), "outer_enum_integer": obj.get("outerEnumInteger"), "outer_enum_default_value": obj.get("outerEnumDefaultValue"), - "outer_enum_integer_default_value": obj.get("outerEnumIntegerDefaultValue") + "outer_enum_integer_default_value": obj.get("outerEnumIntegerDefaultValue"), + "enum_number_vendor_ext": obj.get("enumNumberVendorExt"), + "enum_string_vendor_ext": obj.get("enumStringVendorExt") }) return _obj diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_number_vendor_ext.py new file mode 100644 index 000000000000..b97aaf537c09 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_number_vendor_ext.py @@ -0,0 +1,34 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt # noqa: E501 + +class TestEnumNumberVendorExt(unittest.TestCase): + """EnumNumberVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumNumberVendorExt(self): + """Test EnumNumberVendorExt""" + # inst = EnumNumberVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string_vendor_ext.py new file mode 100644 index 000000000000..bf9ebcb8bfc0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string_vendor_ext.py @@ -0,0 +1,34 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt # noqa: E501 + +class TestEnumStringVendorExt(unittest.TestCase): + """EnumStringVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumStringVendorExt(self): + """Test EnumStringVendorExt""" + # inst = EnumStringVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES index fc3e3d62b542..2e28d350da1a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES @@ -40,8 +40,10 @@ docs/Dog.md docs/DummyModel.md docs/EnumArrays.md docs/EnumClass.md +docs/EnumNumberVendorExt.md docs/EnumString1.md docs/EnumString2.md +docs/EnumStringVendorExt.md docs/EnumTest.md docs/FakeApi.md docs/FakeClassnameTags123Api.md @@ -168,8 +170,10 @@ petstore_api/models/dog.py petstore_api/models/dummy_model.py petstore_api/models/enum_arrays.py petstore_api/models/enum_class.py +petstore_api/models/enum_number_vendor_ext.py petstore_api/models/enum_string1.py petstore_api/models/enum_string2.py +petstore_api/models/enum_string_vendor_ext.py petstore_api/models/enum_test.py petstore_api/models/feeding.py petstore_api/models/field.py diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index 57e2a3059fa3..6ed72198544d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -187,8 +187,10 @@ Class | Method | HTTP request | Description - [DummyModel](docs/DummyModel.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) + - [EnumNumberVendorExt](docs/EnumNumberVendorExt.md) - [EnumString1](docs/EnumString1.md) - [EnumString2](docs/EnumString2.md) + - [EnumStringVendorExt](docs/EnumStringVendorExt.md) - [EnumTest](docs/EnumTest.md) - [Feeding](docs/Feeding.md) - [Field](docs/Field.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumNumberVendorExt.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumNumberVendorExt.md new file mode 100644 index 000000000000..0c77b090abff --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumNumberVendorExt.md @@ -0,0 +1,14 @@ +# EnumNumberVendorExt + + +## Enum + +* `NUMBER_42` (value: `42`) + +* `NUMBER_18` (value: `18`) + +* `NUMBER_56` (value: `56`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumStringVendorExt.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumStringVendorExt.md new file mode 100644 index 000000000000..8abb456b402e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumStringVendorExt.md @@ -0,0 +1,14 @@ +# EnumStringVendorExt + + +## Enum + +* `FOO` (value: `'FOO'`) + +* `BAR` (value: `'Bar'`) + +* `BAZ` (value: `'baz'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md index 72470ff0c317..34ec6193b316 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md @@ -9,14 +9,14 @@ Name | Type | Description | Notes **enum_integer_default** | **int** | | [optional] [default to 5] **enum_integer** | **int** | | [optional] **enum_number** | **float** | | [optional] -**enum_number_vendor_ext** | **int** | | [optional] -**enum_string_vendor_ext** | **str** | | [optional] **enum_string_single_member** | **str** | | [optional] **enum_integer_single_member** | **int** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] **outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] **outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] **outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] +**enum_number_vendor_ext** | [**EnumNumberVendorExt**](EnumNumberVendorExt.md) | | [optional] +**enum_string_vendor_ext** | [**EnumStringVendorExt**](EnumStringVendorExt.md) | | [optional] ## Example diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py index 330c529ec6f4..0a4eca2f3b06 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py @@ -74,8 +74,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.field import Field diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py index 1a3ad2e2949d..91f0aad8026f 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py @@ -49,8 +49,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.field import Field diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_number_vendor_ext.py new file mode 100644 index 000000000000..b49e6ca339fe --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_number_vendor_ext.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumNumberVendorExt(int, Enum): + """ + EnumNumberVendorExt + """ + + """ + allowed enum values + """ + NUMBER_42 = 42 + NUMBER_18 = 18 + NUMBER_56 = 56 + + @classmethod + def from_json(cls, json_str: str) -> EnumNumberVendorExt: + """Create an instance of EnumNumberVendorExt from a JSON string""" + return EnumNumberVendorExt(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string_vendor_ext.py new file mode 100644 index 000000000000..ac33490efe13 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string_vendor_ext.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumStringVendorExt(str, Enum): + """ + EnumStringVendorExt + """ + + """ + allowed enum values + """ + FOO = 'FOO' + BAR = 'Bar' + BAZ = 'baz' + + @classmethod + def from_json(cls, json_str: str) -> EnumStringVendorExt: + """Create an instance of EnumStringVendorExt from a JSON string""" + return EnumStringVendorExt(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py index 6dfb92bfe94c..bd18624a5d08 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py @@ -20,6 +20,8 @@ import json from typing import Any, Dict, Optional from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.outer_enum import OuterEnum from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue from petstore_api.models.outer_enum_integer import OuterEnumInteger @@ -34,16 +36,16 @@ class EnumTest(BaseModel): enum_integer_default: Optional[StrictInt] = 5 enum_integer: Optional[StrictInt] = None enum_number: Optional[StrictFloat] = None - enum_number_vendor_ext: Optional[StrictInt] = None - enum_string_vendor_ext: Optional[StrictStr] = None enum_string_single_member: Optional[StrictStr] = None enum_integer_single_member: Optional[StrictInt] = None outer_enum: Optional[OuterEnum] = Field(default=None, alias="outerEnum") outer_enum_integer: Optional[OuterEnumInteger] = Field(default=None, alias="outerEnumInteger") outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(default=None, alias="outerEnumDefaultValue") outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(default=None, alias="outerEnumIntegerDefaultValue") + enum_number_vendor_ext: Optional[EnumNumberVendorExt] = Field(default=None, alias="enumNumberVendorExt") + enum_string_vendor_ext: Optional[EnumStringVendorExt] = Field(default=None, alias="enumStringVendorExt") additional_properties: Dict[str, Any] = {} - __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_number_vendor_ext", "enum_string_vendor_ext", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] + __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue", "enumNumberVendorExt", "enumStringVendorExt"] @validator('enum_string') def enum_string_validate_enum(cls, value): @@ -92,26 +94,6 @@ class EnumTest(BaseModel): raise ValueError("must be one of enum values (1.1, -1.2)") return value - @validator('enum_number_vendor_ext') - def enum_number_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in (42, 18, 56,): - raise ValueError("must be one of enum values (42, 18, 56)") - return value - - @validator('enum_string_vendor_ext') - def enum_string_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('FOO', 'Bar', 'baz',): - raise ValueError("must be one of enum values ('FOO', 'Bar', 'baz')") - return value - @validator('enum_string_single_member') def enum_string_single_member_validate_enum(cls, value): """Validates the enum""" @@ -184,14 +166,14 @@ class EnumTest(BaseModel): "enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5, "enum_integer": obj.get("enum_integer"), "enum_number": obj.get("enum_number"), - "enum_number_vendor_ext": obj.get("enum_number_vendor_ext"), - "enum_string_vendor_ext": obj.get("enum_string_vendor_ext"), "enum_string_single_member": obj.get("enum_string_single_member"), "enum_integer_single_member": obj.get("enum_integer_single_member"), "outer_enum": obj.get("outerEnum"), "outer_enum_integer": obj.get("outerEnumInteger"), "outer_enum_default_value": obj.get("outerEnumDefaultValue"), - "outer_enum_integer_default_value": obj.get("outerEnumIntegerDefaultValue") + "outer_enum_integer_default_value": obj.get("outerEnumIntegerDefaultValue"), + "enum_number_vendor_ext": obj.get("enumNumberVendorExt"), + "enum_string_vendor_ext": obj.get("enumStringVendorExt") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_number_vendor_ext.py new file mode 100644 index 000000000000..b97aaf537c09 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_number_vendor_ext.py @@ -0,0 +1,34 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt # noqa: E501 + +class TestEnumNumberVendorExt(unittest.TestCase): + """EnumNumberVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumNumberVendorExt(self): + """Test EnumNumberVendorExt""" + # inst = EnumNumberVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string_vendor_ext.py new file mode 100644 index 000000000000..bf9ebcb8bfc0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string_vendor_ext.py @@ -0,0 +1,34 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt # noqa: E501 + +class TestEnumStringVendorExt(unittest.TestCase): + """EnumStringVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumStringVendorExt(self): + """Test EnumStringVendorExt""" + # inst = EnumStringVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py index 9205f4ed998b..d92c78554617 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py @@ -9,8 +9,6 @@ $ cd OpenAPIetstore-python $ pytest """ -import os -import time import atexit import weakref import unittest diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py index eb8f12293ed4..55673c271ee9 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py @@ -9,20 +9,23 @@ $ cd petstore_api-python $ pytest """ -import os -import sys import unittest import petstore_api +from petstore_api import Configuration from petstore_api.rest import ApiException from .util import id_gen +HOST = 'http://localhost/v2' + class ApiExceptionTests(unittest.TestCase): def setUp(self): - self.api_client = petstore_api.ApiClient() + config = Configuration() + config.host = HOST + self.api_client = petstore_api.ApiClient(config) self.pet_api = petstore_api.PetApi(self.api_client) self.setUpModels() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py index c791384d92ff..d4c89e23946d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py @@ -14,16 +14,22 @@ import sys import unittest import petstore_api +from petstore_api import Configuration from petstore_api.rest import ApiException from pydantic import BaseModel, ValidationError from .util import id_gen +HOST = 'http://localhost/v2' + class ApiExceptionTests(unittest.TestCase): def setUp(self): - self.api_client = petstore_api.ApiClient() + config = Configuration() + config.host = HOST + config.access_token = 'ACCESS_TOKEN' + self.api_client = petstore_api.ApiClient(config) self.pet_api = petstore_api.PetApi(self.api_client) self.setUpModels() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py index 2784d3ac1d0b..569ae0ce4973 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py @@ -10,15 +10,12 @@ $ cd petstore_api-python $ pytest """ -from collections import namedtuple -from datetime import datetime, timedelta +from datetime import timedelta import base64 -import json import os import re -import shutil import unittest -from urllib.parse import urlencode, urlparse +from urllib.parse import urlparse from Crypto.Hash import SHA256, SHA512 from Crypto.PublicKey import ECC, RSA @@ -28,22 +25,11 @@ import petstore_api #from petstore_api.models import Category, Tag, Pet from petstore_api.api.pet_api import PetApi from petstore_api import Configuration, signing -from petstore_api.rest import ( - RESTClientObject, - RESTResponse -) - -from petstore_api.exceptions import ( - ApiException, - ApiValueError, - ApiTypeError, -) from .util import id_gen import urllib3 -from unittest.mock import patch HOST = 'http://localhost/v2' diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py index 178e44fd1fef..69a855ba100b 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py @@ -14,13 +14,19 @@ import time import unittest import petstore_api -from petstore_api.rest import ApiException +from petstore_api import Configuration + +HOST = 'http://localhost/v2' class StoreApiTests(unittest.TestCase): def setUp(self): - self.store_api = petstore_api.StoreApi() + config = Configuration() + config.host = HOST + config.access_token = 'ACCESS_TOKEN' + self.api_client = petstore_api.ApiClient(config) + self.store_api = petstore_api.StoreApi(self.api_client) def tearDown(self): # sleep 1 sec between two every 2 tests diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES index ffbffbcee5f5..e9cb10689de7 100755 --- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES @@ -39,8 +39,10 @@ docs/Dog.md docs/DummyModel.md docs/EnumArrays.md docs/EnumClass.md +docs/EnumNumberVendorExt.md docs/EnumString1.md docs/EnumString2.md +docs/EnumStringVendorExt.md docs/EnumTest.md docs/FakeApi.md docs/FakeClassnameTags123Api.md @@ -167,8 +169,10 @@ petstore_api/models/dog.py petstore_api/models/dummy_model.py petstore_api/models/enum_arrays.py petstore_api/models/enum_class.py +petstore_api/models/enum_number_vendor_ext.py petstore_api/models/enum_string1.py petstore_api/models/enum_string2.py +petstore_api/models/enum_string_vendor_ext.py petstore_api/models/enum_test.py petstore_api/models/feeding.py petstore_api/models/file.py diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 2dd68da47172..6c4c79a34aca 100755 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -185,8 +185,10 @@ Class | Method | HTTP request | Description - [DummyModel](docs/DummyModel.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) + - [EnumNumberVendorExt](docs/EnumNumberVendorExt.md) - [EnumString1](docs/EnumString1.md) - [EnumString2](docs/EnumString2.md) + - [EnumStringVendorExt](docs/EnumStringVendorExt.md) - [EnumTest](docs/EnumTest.md) - [Feeding](docs/Feeding.md) - [File](docs/File.md) diff --git a/samples/openapi3/client/petstore/python/docs/EnumNumberVendorExt.md b/samples/openapi3/client/petstore/python/docs/EnumNumberVendorExt.md new file mode 100644 index 000000000000..4c1572b1d277 --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/EnumNumberVendorExt.md @@ -0,0 +1,14 @@ +# EnumNumberVendorExt + + +## Enum + +* `FortyTwo` (value: `42`) + +* `Eigtheen` (value: `18`) + +* `FiftySix` (value: `56`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python/docs/EnumStringVendorExt.md b/samples/openapi3/client/petstore/python/docs/EnumStringVendorExt.md new file mode 100644 index 000000000000..ce6077c18a3b --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/EnumStringVendorExt.md @@ -0,0 +1,14 @@ +# EnumStringVendorExt + + +## Enum + +* `FOO_XEnumVarname` (value: `'FOO'`) + +* `BarVar_XEnumVarname` (value: `'Bar'`) + +* `bazVar_XEnumVarname` (value: `'baz'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python/docs/EnumTest.md b/samples/openapi3/client/petstore/python/docs/EnumTest.md index 8a3874d17375..9f96c605d888 100644 --- a/samples/openapi3/client/petstore/python/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/python/docs/EnumTest.md @@ -10,14 +10,14 @@ Name | Type | Description | Notes **enum_integer_default** | **int** | | [optional] [default to 5] **enum_integer** | **int** | | [optional] **enum_number** | **float** | | [optional] -**enum_number_vendor_ext** | **int** | | [optional] -**enum_string_vendor_ext** | **str** | | [optional] **enum_string_single_member** | **str** | | [optional] **enum_integer_single_member** | **int** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] **outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] **outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] [default to OuterEnumDefaultValue.PLACED] **outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] [default to OuterEnumIntegerDefaultValue.NUMBER_0] +**enum_number_vendor_ext** | [**EnumNumberVendorExt**](EnumNumberVendorExt.md) | | [optional] +**enum_string_vendor_ext** | [**EnumStringVendorExt**](EnumStringVendorExt.md) | | [optional] ## Example diff --git a/samples/openapi3/client/petstore/python/petstore_api/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/__init__.py index d7871f3e246c..9036b7a87421 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/__init__.py @@ -73,8 +73,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.file import File diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py index 130555c82361..fc1f4acbdaf6 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -48,8 +48,10 @@ from petstore_api.models.dog import Dog from petstore_api.models.dummy_model import DummyModel from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.enum_test import EnumTest from petstore_api.models.feeding import Feeding from petstore_api.models.file import File diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_number_vendor_ext.py new file mode 100644 index 000000000000..5588de5c7043 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_number_vendor_ext.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EnumNumberVendorExt(int, Enum): + """ + EnumNumberVendorExt + """ + + """ + allowed enum values + """ + FortyTwo = 42 + Eigtheen = 18 + FiftySix = 56 + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EnumNumberVendorExt from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_string_vendor_ext.py new file mode 100644 index 000000000000..821812e9b088 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_string_vendor_ext.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EnumStringVendorExt(str, Enum): + """ + EnumStringVendorExt + """ + + """ + allowed enum values + """ + FOO_XEnumVarname = 'FOO' + BarVar_XEnumVarname = 'Bar' + bazVar_XEnumVarname = 'baz' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EnumStringVendorExt from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py index 6d09daf049db..d39c2c95775e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py @@ -19,6 +19,8 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt from petstore_api.models.outer_enum import OuterEnum from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue from petstore_api.models.outer_enum_integer import OuterEnumInteger @@ -35,16 +37,16 @@ class EnumTest(BaseModel): enum_integer_default: Optional[StrictInt] = 5 enum_integer: Optional[StrictInt] = None enum_number: Optional[StrictFloat] = None - enum_number_vendor_ext: Optional[StrictInt] = None - enum_string_vendor_ext: Optional[StrictStr] = None enum_string_single_member: Optional[StrictStr] = None enum_integer_single_member: Optional[StrictInt] = None outer_enum: Optional[OuterEnum] = Field(default=None, alias="outerEnum") outer_enum_integer: Optional[OuterEnumInteger] = Field(default=None, alias="outerEnumInteger") outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(default=OuterEnumDefaultValue.PLACED, alias="outerEnumDefaultValue") outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(default=OuterEnumIntegerDefaultValue.NUMBER_0, alias="outerEnumIntegerDefaultValue") + enum_number_vendor_ext: Optional[EnumNumberVendorExt] = Field(default=None, alias="enumNumberVendorExt") + enum_string_vendor_ext: Optional[EnumStringVendorExt] = Field(default=None, alias="enumStringVendorExt") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_number_vendor_ext", "enum_string_vendor_ext", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] + __properties: ClassVar[List[str]] = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "enum_string_single_member", "enum_integer_single_member", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue", "enumNumberVendorExt", "enumStringVendorExt"] @field_validator('enum_string') def enum_string_validate_enum(cls, value): @@ -93,26 +95,6 @@ class EnumTest(BaseModel): raise ValueError("must be one of enum values (1.1, -1.2)") return value - @field_validator('enum_number_vendor_ext') - def enum_number_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set([42, 18, 56]): - raise ValueError("must be one of enum values (42, 18, 56)") - return value - - @field_validator('enum_string_vendor_ext') - def enum_string_vendor_ext_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(['FOO', 'Bar', 'baz']): - raise ValueError("must be one of enum values ('FOO', 'Bar', 'baz')") - return value - @field_validator('enum_string_single_member') def enum_string_single_member_validate_enum(cls, value): """Validates the enum""" @@ -201,14 +183,14 @@ class EnumTest(BaseModel): "enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5, "enum_integer": obj.get("enum_integer"), "enum_number": obj.get("enum_number"), - "enum_number_vendor_ext": obj.get("enum_number_vendor_ext"), - "enum_string_vendor_ext": obj.get("enum_string_vendor_ext"), "enum_string_single_member": obj.get("enum_string_single_member"), "enum_integer_single_member": obj.get("enum_integer_single_member"), "outerEnum": obj.get("outerEnum"), "outerEnumInteger": obj.get("outerEnumInteger"), "outerEnumDefaultValue": obj.get("outerEnumDefaultValue") if obj.get("outerEnumDefaultValue") is not None else OuterEnumDefaultValue.PLACED, - "outerEnumIntegerDefaultValue": obj.get("outerEnumIntegerDefaultValue") if obj.get("outerEnumIntegerDefaultValue") is not None else OuterEnumIntegerDefaultValue.NUMBER_0 + "outerEnumIntegerDefaultValue": obj.get("outerEnumIntegerDefaultValue") if obj.get("outerEnumIntegerDefaultValue") is not None else OuterEnumIntegerDefaultValue.NUMBER_0, + "enumNumberVendorExt": obj.get("enumNumberVendorExt"), + "enumStringVendorExt": obj.get("enumStringVendorExt") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/test/test_enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python/test/test_enum_number_vendor_ext.py new file mode 100644 index 000000000000..62ff78318c77 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_enum_number_vendor_ext.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from petstore_api.models.enum_number_vendor_ext import EnumNumberVendorExt + +class TestEnumNumberVendorExt(unittest.TestCase): + """EnumNumberVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumNumberVendorExt(self): + """Test EnumNumberVendorExt""" + # inst = EnumNumberVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python/test/test_enum_string_vendor_ext.py new file mode 100644 index 000000000000..e82d7957d347 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_enum_string_vendor_ext.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + 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 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from petstore_api.models.enum_string_vendor_ext import EnumStringVendorExt + +class TestEnumStringVendorExt(unittest.TestCase): + """EnumStringVendorExt unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumStringVendorExt(self): + """Test EnumStringVendorExt""" + # inst = EnumStringVendorExt() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java index fc8dc11d46d3..94a59908371c 100644 --- a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java @@ -138,6 +138,7 @@ public interface PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated @@ -168,6 +169,7 @@ public interface PetApi { ResponseEntity> findPetsByTags( @NotNull @Parameter(name = "tags", description = "Tags to filter by", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "tags", required = true) List tags, + @Parameter(name = "size", description = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.", in = ParameterIn.HEADER) @RequestHeader(value = "size", required = false) String size, @ParameterObject final Pageable pageable ); diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java index 8081a7077d6b..2c3db42ac490 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java @@ -162,7 +162,7 @@ public class PetApi { }, tags={ "pet" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file", required = false) InputStream _fileInputStream, @Multipart(value = "file" , required = false) Attachment _fileDetail) { - return delegate.uploadFile(petId, additionalMetadata, _fileInputStream, _fileDetail, securityContext); + public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment _fileDetail) { + return delegate.uploadFile(petId, additionalMetadata, _fileDetail, securityContext); } } diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApiService.java index 1ffcb7fab127..84c3f849531a 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApiService.java @@ -28,5 +28,5 @@ public interface PetApiService { public Response getPetById(Long petId, SecurityContext securityContext); public Response updatePet(Pet pet, SecurityContext securityContext); public Response updatePetWithForm(Long petId, String name, String status, SecurityContext securityContext); - public Response uploadFile(Long petId, String additionalMetadata, InputStream _fileInputStream, Attachment _fileDetail, SecurityContext securityContext); + public Response uploadFile(Long petId, String additionalMetadata, Attachment _fileDetail, SecurityContext securityContext); } diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs-cxf-cdi/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java index 323a1eff5ae1..ec16ab2266ba 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -58,7 +58,7 @@ public class PetApiServiceImpl implements PetApiService { return Response.ok().entity("magic!").build(); } @Override - public Response uploadFile(Long petId, String additionalMetadata, InputStream _fileInputStream, Attachment _fileDetail, SecurityContext securityContext) { + public Response uploadFile(Long petId, String additionalMetadata, Attachment _fileDetail, SecurityContext securityContext) { // do some magic! return Response.ok().entity("magic!").build(); } diff --git a/samples/server/petstore/kotlin-spring-default/gradlew b/samples/server/petstore/kotlin-spring-default/gradlew old mode 100644 new mode 100755 diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApi.java index 06a00735c20a..23e104542710 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApi.java @@ -148,6 +148,7 @@ public interface PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated @@ -179,9 +180,10 @@ public interface PetApi { default ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags, + @ApiParam(value = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.") @RequestHeader(value = "size", required = false) String size, @ApiIgnore final Pageable pageable ) { - return getDelegate().findPetsByTags(tags, pageable); + return getDelegate().findPetsByTags(tags, size, pageable); } diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApiDelegate.java index 286c2be5022d..4833a24c5200 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -89,13 +89,15 @@ public interface PetApiDelegate { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated * @see PetApi#findPetsByTags */ @Deprecated - default ResponseEntity> findPetsByTags(List tags, final Pageable pageable) { + default ResponseEntity> findPetsByTags(List tags, + String size, final Pageable pageable) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/resources/openapi.yaml index 83bb676d2105..615aa861b548 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/resources/openapi.yaml @@ -189,6 +189,47 @@ paths: type: string type: array style: form + - description: "A test HeaderParam for issue #8315 - must NOT be removed when\ + \ x-spring-paginated:true is used." + explode: false + in: header + name: size + required: false + schema: + type: string + style: simple + - description: "The number of items to return per page. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: size + required: true + schema: + default: 20 + minimum: 1 + type: integer + style: form + - description: "The page to return, starting with page 0. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: page + required: true + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: "The sorting to apply to the Pageable object. Test QueryParam\ + \ for issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: sort + required: true + schema: + default: "id,asc" + type: string + style: form responses: "200": content: diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApi.java index 06a00735c20a..23e104542710 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApi.java @@ -148,6 +148,7 @@ public interface PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated @@ -179,9 +180,10 @@ public interface PetApi { default ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags, + @ApiParam(value = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.") @RequestHeader(value = "size", required = false) String size, @ApiIgnore final Pageable pageable ) { - return getDelegate().findPetsByTags(tags, pageable); + return getDelegate().findPetsByTags(tags, size, pageable); } diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApiDelegate.java index 286c2be5022d..4833a24c5200 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -89,13 +89,15 @@ public interface PetApiDelegate { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated * @see PetApi#findPetsByTags */ @Deprecated - default ResponseEntity> findPetsByTags(List tags, final Pageable pageable) { + default ResponseEntity> findPetsByTags(List tags, + String size, final Pageable pageable) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/resources/openapi.yaml index 83bb676d2105..615aa861b548 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/resources/openapi.yaml @@ -189,6 +189,47 @@ paths: type: string type: array style: form + - description: "A test HeaderParam for issue #8315 - must NOT be removed when\ + \ x-spring-paginated:true is used." + explode: false + in: header + name: size + required: false + schema: + type: string + style: simple + - description: "The number of items to return per page. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: size + required: true + schema: + default: 20 + minimum: 1 + type: integer + style: form + - description: "The page to return, starting with page 0. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: page + required: true + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: "The sorting to apply to the Pageable object. Test QueryParam\ + \ for issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: sort + required: true + schema: + default: "id,asc" + type: string + style: form responses: "200": content: diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/PetApi.java index ecf74b30fb14..6432f800b20e 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/PetApi.java @@ -169,6 +169,7 @@ public interface PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated @@ -200,6 +201,7 @@ public interface PetApi { default ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags, + @ApiParam(value = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.") @RequestHeader(value = "size", required = false) String size, @ApiIgnore final Pageable pageable ) { getRequest().ifPresent(request -> { diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/resources/openapi.yaml index 83bb676d2105..615aa861b548 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/resources/openapi.yaml @@ -189,6 +189,47 @@ paths: type: string type: array style: form + - description: "A test HeaderParam for issue #8315 - must NOT be removed when\ + \ x-spring-paginated:true is used." + explode: false + in: header + name: size + required: false + schema: + type: string + style: simple + - description: "The number of items to return per page. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: size + required: true + schema: + default: 20 + minimum: 1 + type: integer + style: form + - description: "The page to return, starting with page 0. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: page + required: true + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: "The sorting to apply to the Pageable object. Test QueryParam\ + \ for issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: sort + required: true + schema: + default: "id,asc" + type: string + style: form responses: "200": content: diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/PetApi.java index ecf74b30fb14..6432f800b20e 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/PetApi.java @@ -169,6 +169,7 @@ public interface PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * @param tags Tags to filter by (required) + * @param size A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used. (optional) * @return successful operation (status code 200) * or Invalid tag value (status code 400) * @deprecated @@ -200,6 +201,7 @@ public interface PetApi { default ResponseEntity> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags, + @ApiParam(value = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.") @RequestHeader(value = "size", required = false) String size, @ApiIgnore final Pageable pageable ) { getRequest().ifPresent(request -> { diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-spring-pageable/src/main/resources/openapi.yaml index 83bb676d2105..615aa861b548 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-spring-pageable/src/main/resources/openapi.yaml @@ -189,6 +189,47 @@ paths: type: string type: array style: form + - description: "A test HeaderParam for issue #8315 - must NOT be removed when\ + \ x-spring-paginated:true is used." + explode: false + in: header + name: size + required: false + schema: + type: string + style: simple + - description: "The number of items to return per page. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: size + required: true + schema: + default: 20 + minimum: 1 + type: integer + style: form + - description: "The page to return, starting with page 0. Test QueryParam for\ + \ issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: page + required: true + schema: + default: 0 + minimum: 0 + type: integer + style: form + - description: "The sorting to apply to the Pageable object. Test QueryParam\ + \ for issue #8315 - must be removed when x-spring-paginated:true is used." + explode: true + in: query + name: sort + required: true + schema: + default: "id,asc" + type: string + style: form responses: "200": content: