diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index b869dea3bc6..c19ced37254 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -3724,6 +3724,10 @@ public class DefaultCodegen implements CodegenConfig { return; } if (ModelUtils.isComposedSchema(schema)) { + // fix issue #16797 and #15796, constructor fail by missing parent required params + if (schema.getProperties() != null && !schema.getProperties().isEmpty()) { + properties.putAll(schema.getProperties()); + } if (schema.getAllOf() != null) { for (Object component : schema.getAllOf()) { @@ -3747,6 +3751,11 @@ public class DefaultCodegen implements CodegenConfig { } } + for (String r : required) { + if (!properties.containsKey(r)) { + LOGGER.error("Required var %s not in properties", r); + } + } return; } @@ -7324,7 +7333,7 @@ public class DefaultCodegen implements CodegenConfig { } protected void updateRequestBodyForMap(CodegenParameter codegenParameter, Schema schema, String name, Set imports, String bodyParameterName) { - if (StringUtils.isNotBlank(name)) { + if (StringUtils.isNotBlank(name) && !(ModelUtils.isFreeFormObject(schema) && !ModelUtils.shouldGenerateFreeFormObjectModel(name, this))) { this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true); } else { Schema inner = ModelUtils.getAdditionalProperties(schema); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 52c7eb082e2..6af7f8cfb43 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -509,16 +509,7 @@ public class DefaultGenerator implements Generator { Schema schema = schemas.get(name); if (ModelUtils.isFreeFormObject(schema)) { // check to see if it's a free-form object - // there are 3 free form use cases - // 1. free form with no validation that is not allOf included in any composed schemas - // 2. free form with validation - // 3. free form that is allOf included in any composed schemas - // this use case arises when using interface schemas - // generators may choose to make models for use case 2 + 3 - Schema refSchema = new Schema(); - refSchema.set$ref("#/components/schemas/" + name); - Schema unaliasedSchema = config.unaliasSchema(refSchema); - if (unaliasedSchema.get$ref() == null) { + if (!ModelUtils.shouldGenerateFreeFormObjectModel(name, config)) { LOGGER.info("Model {} not generated since it's a free-form object", name); continue; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index 58830aced88..d19c4f9e7ed 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -35,6 +35,7 @@ import io.swagger.v3.parser.util.RemoteUrl; import io.swagger.v3.parser.util.SchemaTypeUtil; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.IJsonSchemaValidationProperties; import org.openapitools.codegen.config.GlobalSettings; @@ -831,6 +832,19 @@ public class ModelUtils { return false; } + public static boolean shouldGenerateFreeFormObjectModel(String name, CodegenConfig config) { + // there are 3 free form use cases + // 1. free form with no validation that is not allOf included in any composed schemas + // 2. free form with validation + // 3. free form that is allOf included in any composed schemas + // this use case arises when using interface schemas + // generators may choose to make models for use case 2 + 3 + Schema refSchema = new Schema(); + refSchema.set$ref("#/components/schemas/" + name); + Schema unaliasedSchema = config.unaliasSchema(refSchema); + return unaliasedSchema.get$ref() != null; + } + /** * If a Schema contains a reference to another Schema with '$ref', returns the referenced Schema if it is found or the actual Schema in the other cases. * diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 60a3b05b91c..d7d88c6717f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -4388,4 +4388,34 @@ public class SpringCodegenTest { assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/api/PetApi.java"), "@Valid @RequestParam(value = \"additionalMetadata\", required = false) String additionalMetadata"); } + + @Test + public void testMultiInheritanceParentRequiredParams_issue16797() throws IOException { + final Map output = generateFromContract("src/test/resources/3_0/spring/issue_16797.yaml", SPRING_BOOT); + // constructor should as + // public Object4(Type1 pageInfo, String responseType, String requestId, Boolean success) { + // super(responseType, requestId, success, pageInfo); + // } + JavaFileAssert.assertThat(output.get("Object4.java")) + .assertConstructor("Type1", "String", "String", "Boolean") + .hasParameter("responseType").toConstructor() + .hasParameter("requestId").toConstructor() + .hasParameter("success").toConstructor() + .hasParameter("pageInfo").toConstructor() + ; + } + + @Test + public void testMultiInheritanceParentRequiredParams_issue15796() throws IOException { + final Map output = generateFromContract("src/test/resources/3_0/spring/issue_15796.yaml", SPRING_BOOT); + // constructor should as this + //public Poodle(String race, String type) { + // super(race, type); + //} + JavaFileAssert.assertThat(output.get("Poodle.java")) + .assertConstructor("String", "String") + .hasParameter("type").toConstructor() + .hasParameter("race").toConstructor() + ; + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp-netcore/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp-netcore/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 6d3946023a8..fba2c981d82 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp-netcore/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp-netcore/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -961,6 +961,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1790,6 +1807,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 7d3e0b921ff..a238bd85bb2 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -974,6 +974,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1921,6 +1938,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/go/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/go/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 4c4b450e806..bfab71284ea 100644 --- a/modules/openapi-generator/src/test/resources/3_0/go/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/go/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -946,6 +946,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1802,6 +1819,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 035f90534ba..40e38cde720 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -944,6 +944,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1773,6 +1790,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml index ab739c76ec2..0fcc9905aae 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml @@ -920,6 +920,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1875,6 +1892,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index d85f7164628..29a142d7c42 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -924,6 +924,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1753,6 +1770,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/javascript/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/javascript/petstore-with-fake-endpoints-models-for-testing.yaml index 20c7e2f2684..182df263da3 100644 --- a/modules/openapi-generator/src/test/resources/3_0/javascript/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/javascript/petstore-with-fake-endpoints-models-for-testing.yaml @@ -959,6 +959,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1764,6 +1781,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-echo.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-echo.yaml index 7bff0154685..1ce0ac4c027 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-echo.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-echo.yaml @@ -972,6 +972,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1772,6 +1789,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 707d452b494..fd0450ad2b9 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -940,6 +940,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1738,6 +1755,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml index e9f73948e9b..3004706c6ba 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -995,6 +995,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1820,6 +1837,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true 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 e9f73948e9b..3004706c6ba 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 @@ -995,6 +995,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1820,6 +1837,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string 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 c620afc8c98..56c2c88cd76 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 @@ -995,6 +995,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1844,6 +1861,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index ff6dc25960f..c4cbbb00f4d 100644 --- a/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/powershell/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -925,6 +925,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1754,6 +1771,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/python-prior/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/python-prior/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 3bd93b2b5fc..2e1dc575517 100644 --- a/modules/openapi-generator/src/test/resources/3_0/python-prior/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/python-prior/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1047,6 +1047,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -2077,6 +2094,10 @@ components: type: integer enum: - 0 + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true ObjectModelWithRefProps: description: a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations type: object 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 eba5879a5ea..c9eee7da1db 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 @@ -983,6 +983,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1955,6 +1972,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/ruby/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/ruby/petstore-with-fake-endpoints-models-for-testing.yaml index c87242a6329..1fbc416d8f9 100644 --- a/modules/openapi-generator/src/test/resources/3_0/ruby/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/ruby/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1031,6 +1031,23 @@ paths: required: - param - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true /fake/inline-additionalProperties: post: tags: @@ -1883,6 +1900,10 @@ components: enum: - fish - crab + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true OuterEnum: nullable: true type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/issue_15796.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/issue_15796.yaml new file mode 100644 index 00000000000..2b93af76afd --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/spring/issue_15796.yaml @@ -0,0 +1,98 @@ +openapi: 3.0.0 +info: + title: My service + description: My service + version: 1.0.0 +servers: + - url: 'https://localhost' +paths: + /generator/test: + get: + summary: Get test generator models + responses: + 200: + description: Everything is fine +components: + schemas: + Pet: + type: object + required: + - type + properties: + name: + type: string + type: + type: string + discriminator: + propertyName: type + mapping: + CAT: '#/components/schemas/Cat' + DOG: '#/components/schemas/Dog' + Cat: + type: object + allOf: + - $ref: '#/components/schemas/Pet' + required: + - race + properties: + paws: + type: integer + race: + type: string + discriminator: + propertyName: race + mapping: + PERSIAN: '#/components/schemas/Persian' + MAINE_COON: '#/components/schemas/MaineCoon' + Dog: + type: object + allOf: + - $ref: '#/components/schemas/Pet' + required: + - race + properties: + tails: + type: integer + race: + type: string + discriminator: + propertyName: race + mapping: + POODLE: '#/components/schemas/Poodle' + LABRADOR: '#/components/schemas/Labrador' + Poodle: + type: object + allOf: + - $ref: '#/components/schemas/Dog' + properties: + hairType: + type: string + required: + - race + Labrador: + type: object + allOf: + - $ref: '#/components/schemas/Dog' + properties: + hairColor: + type: string + required: + - race + Persian: + type: object + allOf: + - $ref: '#/components/schemas/Cat' + properties: + hairType: + type: string + required: + - race + MaineCoon: + type: object + allOf: + - $ref: '#/components/schemas/Cat' + properties: + hairColor: + type: string + required: + - race diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/issue_16797.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/issue_16797.yaml new file mode 100644 index 00000000000..8201b6bd748 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/spring/issue_16797.yaml @@ -0,0 +1,88 @@ +openapi: 3.0.1 +info: + title: OpenAPI definition + version: v0 +servers: + - url: / + - url: '{protocolAndBaseURL}' + variables: + protocolAndBaseURL: + default: 'https://localhost' +paths: + /user: + get: + tags: + - user + summary: Get User By Id + operationId: getUserById + parameters: + - in: query + name: id + description: Unique Id of an User + schema: + type: integer + default: 10 + responses: + default: + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/Object4" + +components: + schemas: + + Object1: + type: object + properties: + responseType: + type: string + requestId: + type: string + success: + type: boolean + default: true + required: + - responseType + - requestId + - success + discriminator: + propertyName: responseType + + Object2: + allOf: + - $ref: '#/components/schemas/Object1' + - type: object + + Type1: + type: object + properties: + pageSize: + minimum: 1 + type: integer + format: int32 + rowCount: + minimum: 0 + type: integer + format: int32 + required: + - pageSize + - rowCount + + Object3: + allOf: + - $ref: '#/components/schemas/Object2' + properties: + pageInfo: + $ref: '#/components/schemas/Type1' + required: + - pageInfo + + Object4: + allOf: + - $ref: '#/components/schemas/Object3' + - type: object + properties: + data: + type: string diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md index c2d5ddeb353..1670f76c1a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md @@ -115,6 +115,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md index c8a21d2e25c..1debc2b6564 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs index 7282ba7821b..ce37acaec65 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs @@ -158,6 +158,26 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// /// /// /// @@ -603,6 +623,31 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1836,6 +1881,148 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/FakeApi.md index 54e9f37c6de..fdb257f14d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/apis/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using UseSourceGeneration.Api; +using UseSourceGeneration.Client; +using UseSourceGeneration.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeApi.cs index 02be1164082..d4140341ae8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Api/FakeApi.cs @@ -171,6 +171,29 @@ namespace UseSourceGeneration.Api /// <?> Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + /// /// /// @@ -544,6 +567,18 @@ namespace UseSourceGeneration.Api bool IsOk { get; } } + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : UseSourceGeneration.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + /// /// The /// @@ -801,6 +836,26 @@ namespace UseSourceGeneration.Api OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); } + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + /// /// The event raised after the server response /// @@ -2375,6 +2430,195 @@ namespace UseSourceGeneration.Api partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); } + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exception, string pathFormat, string path, Dictionary requestBody) + { + bool suppressDefaultLog = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLog, exception, pathFormat, path, requestBody); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : UseSourceGeneration.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md index 76873f715c8..b5ba5edafde 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs index b7ff2c95302..ce4dd3855eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs @@ -171,6 +171,29 @@ namespace Org.OpenAPITools.Api /// <?> Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + /// /// /// @@ -544,6 +567,18 @@ namespace Org.OpenAPITools.Api bool IsOk { get; } } + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + /// /// The /// @@ -801,6 +836,26 @@ namespace Org.OpenAPITools.Api OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); } + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + /// /// The event raised after the server response /// @@ -2375,6 +2430,195 @@ namespace Org.OpenAPITools.Api partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); } + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exception, string pathFormat, string path, Dictionary requestBody) + { + bool suppressDefaultLog = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLog, exception, pathFormat, path, requestBody); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md index 76873f715c8..b5ba5edafde 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs index 26f352c5256..252cfa496e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -169,6 +169,29 @@ namespace Org.OpenAPITools.Api /// <> Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + /// /// /// @@ -542,6 +565,18 @@ namespace Org.OpenAPITools.Api bool IsOk { get; } } + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + /// /// The /// @@ -799,6 +834,26 @@ namespace Org.OpenAPITools.Api OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); } + /// + /// The event raised after the server response + /// + public event EventHandler OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + /// /// The event raised after the server response /// @@ -2373,6 +2428,195 @@ namespace Org.OpenAPITools.Api partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); } + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exception, string pathFormat, string path, Dictionary requestBody) + { + bool suppressDefaultLog = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLog, exception, pathFormat, path, requestBody); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md index 76873f715c8..b5ba5edafde 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs index 44ea52c57d5..b26a5d92d5d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -168,6 +168,29 @@ namespace Org.OpenAPITools.Api /// <> Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + /// /// /// @@ -541,6 +564,18 @@ namespace Org.OpenAPITools.Api bool IsOk { get; } } + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + /// /// The /// @@ -798,6 +833,26 @@ namespace Org.OpenAPITools.Api OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); } + /// + /// The event raised after the server response + /// + public event EventHandler OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + /// /// The event raised after the server response /// @@ -2366,6 +2421,195 @@ namespace Org.OpenAPITools.Api partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); } + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exception, string pathFormat, string path, Dictionary requestBody) + { + bool suppressDefaultLog = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLog, exception, pathFormat, path, requestBody); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new TestAdditionalPropertiesReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md index 45508dddfc6..f41927be64a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md @@ -140,6 +140,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md index bd9b0d42c22..ada65ec3965 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -571,6 +572,95 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using System.Net.Http; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes + HttpClient httpClient = new HttpClient(); + HttpClientHandler httpClientHandler = new HttpClientHandler(); + var apiInstance = new FakeApi(httpClient, config, httpClientHandler); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs index 14104f06bee..57774764f56 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -146,6 +146,24 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// + void TestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody); + /// /// /// /// @@ -559,6 +577,29 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1715,6 +1756,119 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = requestBody; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = requestBody; + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md index b344c43c38b..b77dcd24dfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md @@ -127,6 +127,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md index c8a21d2e25c..1debc2b6564 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs index 7282ba7821b..ce37acaec65 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs @@ -158,6 +158,26 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// /// /// /// @@ -603,6 +623,31 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1836,6 +1881,148 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md index b344c43c38b..b77dcd24dfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md @@ -127,6 +127,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md index c8a21d2e25c..1debc2b6564 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs index 7282ba7821b..ce37acaec65 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs @@ -158,6 +158,26 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// /// /// /// @@ -603,6 +623,31 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1836,6 +1881,148 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md index b344c43c38b..b77dcd24dfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md @@ -127,6 +127,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md index 70d7da71e1c..46dc77ec1a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs index afe11803933..50aba343ce4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -158,6 +158,26 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// /// /// /// @@ -603,6 +623,31 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1836,6 +1881,148 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md index 7397b3f9816..06c969e72fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md @@ -101,6 +101,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md index c8a21d2e25c..1debc2b6564 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs index fa822317a0b..293a89f3b78 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs @@ -145,6 +145,24 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// + void TestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody); + /// /// /// /// @@ -558,6 +576,29 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1711,6 +1752,130 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = requestBody; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var task = TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, cancellationToken); +#if UNITY_EDITOR || !UNITY_WEBGL + await task.ConfigureAwait(false); +#else + await task; +#endif + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = requestBody; + + + // make the HTTP request + + var task = this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken); + +#if UNITY_EDITOR || !UNITY_WEBGL + var localVarResponse = await task.ConfigureAwait(false); +#else + var localVarResponse = await task; +#endif + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md index c2d5ddeb353..1670f76c1a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient/README.md @@ -115,6 +115,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md index c8a21d2e25c..1debc2b6564 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs index 7282ba7821b..ce37acaec65 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -158,6 +158,26 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// /// /// /// @@ -603,6 +623,31 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1836,6 +1881,148 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/README.md b/samples/client/petstore/csharp/OpenAPIClientCore/README.md index b344c43c38b..b77dcd24dfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientCore/README.md @@ -127,6 +127,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**GetArrayOfEnums**](docs/FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**TestAdditionalPropertiesReference**](docs/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml index 1514b794f5e..c03f1e44116 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml @@ -941,6 +941,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1868,6 +1885,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md index 70d7da71e1c..46dc77ec1a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | | | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | | | [**GetArrayOfEnums**](FakeApi.md#getarrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -547,6 +548,91 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithFileSchema** > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs index afe11803933..50aba343ce4 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -158,6 +158,26 @@ namespace Org.OpenAPITools.Api /// ApiResponse of List<OuterEnum> ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// /// /// /// @@ -603,6 +623,31 @@ namespace Org.OpenAPITools.Api /// Task of ApiResponse (List<OuterEnum>) System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// /// /// @@ -1836,6 +1881,148 @@ namespace Org.OpenAPITools.Api return localVarResponse; } + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// For this test, the body for this request much reference a schema named `File`. /// 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 2a4176b349f..41fbe7a7290 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex @@ -273,6 +273,37 @@ defmodule OpenapiPetstore.Api.Fake do ]) end + @doc """ + test referenced additionalProperties + + + ### Parameters + + - `connection` (OpenapiPetstore.Connection): Connection to server + - `request_body` (%{optional(String.t) => any()}): request body + - `opts` (keyword): Optional parameters + + ### Returns + + - `{:ok, nil}` on success + - `{:error, Tesla.Env.t}` on failure + """ + @spec test_additional_properties_reference(Tesla.Env.client, %{optional(String.t) => AnyType.t}, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t} + def test_additional_properties_reference(connection, request_body, _opts \\ []) do + request = + %{} + |> method(:post) + |> url("/fake/additionalProperties-reference") + |> add_param(:body, :body, request_body) + |> Enum.into([]) + + connection + |> Connection.request(request) + |> evaluate_response([ + {200, false} + ]) + end + @doc """ For this test, the body has to be a binary file. diff --git a/samples/client/petstore/go/go.sum b/samples/client/petstore/go/go.sum index 2eaa32c259e..918ee1769ee 100644 --- a/samples/client/petstore/go/go.sum +++ b/samples/client/petstore/go/go.sum @@ -273,9 +273,11 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -283,6 +285,7 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md b/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md index 7f7a569f2b4..7e243e14b73 100644 --- a/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md +++ b/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -299,6 +300,41 @@ No authorization required | **200** | Output enum (int) | - | +## testAdditionalPropertiesReference + +> void testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + +[**void**](Void.md) + +### 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 > void testBodyWithBinary(body) diff --git a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java index 533c19442d5..4c321d1cee8 100644 --- a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java @@ -102,6 +102,15 @@ public interface FakeApi { @Produces({ "*/*" }) OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws ApiException, ProcessingException; + /** + * test referenced additionalProperties + * + */ + @POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + void testAdditionalPropertiesReference(Map requestBody) throws ApiException, ProcessingException; + @PUT @Path("/body-with-binary") @Consumes({ "image/png" }) diff --git a/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md b/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md +++ b/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java index dc7a20295b5..b3afad3461c 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java @@ -65,6 +65,14 @@ public interface FakeApi { ApiResponse fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty); + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return {@code ApiResponse} + */ + ApiResponse testAdditionalPropertiesReference(Map requestBody); + ApiResponse testBodyWithBinary(File body); ApiResponse testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java index db9dce74ca3..b8ff4b36005 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java @@ -68,6 +68,7 @@ public class FakeApiImpl implements FakeApi { protected static final GenericType RESPONSE_TYPE_fakeOuterNumberSerialize = ResponseType.create(BigDecimal.class); protected static final GenericType RESPONSE_TYPE_fakeOuterStringSerialize = ResponseType.create(String.class); protected static final GenericType RESPONSE_TYPE_fakePropertyEnumIntegerSerialize = ResponseType.create(OuterObjectWithEnumProperty.class); + protected static final GenericType RESPONSE_TYPE_testAdditionalPropertiesReference = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_testBodyWithBinary = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_testBodyWithFileSchema = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_testBodyWithQueryParams = ResponseType.create(Void.class); @@ -398,6 +399,44 @@ public class FakeApiImpl implements FakeApi { return ApiResponse.create(RESPONSE_TYPE_fakePropertyEnumIntegerSerialize, webClientResponse); } + @Override + public ApiResponse testAdditionalPropertiesReference(Map requestBody) { + Objects.requireNonNull(requestBody, "Required parameter 'requestBody' not specified"); + WebClientRequestBuilder webClientRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody); + return testAdditionalPropertiesReferenceSubmit(webClientRequestBuilder, requestBody); + } + + /** + * Creates a {@code WebClientRequestBuilder} for the testAdditionalPropertiesReference operation. + * Optional customization point for subclasses. + * + * @param requestBody request body (required) + * @return WebClientRequestBuilder for testAdditionalPropertiesReference + */ + protected WebClientRequestBuilder testAdditionalPropertiesReferenceRequestBuilder(Map requestBody) { + WebClientRequestBuilder webClientRequestBuilder = apiClient.webClient() + .method("POST"); + + webClientRequestBuilder.path("/fake/additionalProperties-reference"); + webClientRequestBuilder.contentType(MediaType.APPLICATION_JSON); + webClientRequestBuilder.accept(MediaType.APPLICATION_JSON); + + return webClientRequestBuilder; + } + + /** + * Initiates the request for the testAdditionalPropertiesReference operation. + * Optional customization point for subclasses. + * + * @param webClientRequestBuilder the request builder to use for submitting the request + * @param requestBody request body (required) + * @return {@code ApiResponse} for the submitted request + */ + protected ApiResponse testAdditionalPropertiesReferenceSubmit(WebClientRequestBuilder webClientRequestBuilder, Map requestBody) { + Single webClientResponse = webClientRequestBuilder.submit(requestBody); + return ApiResponse.create(RESPONSE_TYPE_testAdditionalPropertiesReference, webClientResponse); + } + @Override public ApiResponse testBodyWithBinary(File body) { Objects.requireNonNull(body, "Required parameter 'body' not specified"); diff --git a/samples/client/petstore/java/apache-httpclient/README.md b/samples/client/petstore/java/apache-httpclient/README.md index fa0d4f88db0..4e08e78fc16 100644 --- a/samples/client/petstore/java/apache-httpclient/README.md +++ b/samples/client/petstore/java/apache-httpclient/README.md @@ -116,6 +116,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml +++ b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md b/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md +++ b/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java index de6b83f45ac..dfa04ecda4f 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -627,6 +627,77 @@ public class FakeApi { ); } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException if fails to make API call + */ + public void testAdditionalPropertiesReference(Map requestBody) throws ApiException { + this.testAdditionalPropertiesReference(requestBody, Collections.emptyMap()); + } + + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @param additionalHeaders additionalHeaders for this call + * @throws ApiException if fails to make API call + */ + public void testAdditionalPropertiesReference(Map requestBody, Map additionalHeaders) throws ApiException { + Object localVarPostBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + localVarHeaderParams.putAll(additionalHeaders); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null + ); + } + /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java index 1d216f59627..983e5ae9372 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java @@ -314,6 +314,33 @@ public interface FakeApi extends ApiClient.Api { + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + */ + @RequestLine("POST /fake/additionalProperties-reference") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void testAdditionalPropertiesReference(Map requestBody); + + /** + * test referenced additionalProperties + * Similar to testAdditionalPropertiesReference but it also returns the http response headers . + * + * @param requestBody request body (required) + */ + @RequestLine("POST /fake/additionalProperties-reference") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody); + + + /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/java/jersey3/README.md b/samples/client/petstore/java/jersey3/README.md index a4946d81fb5..42cef0edc3e 100644 --- a/samples/client/petstore/java/jersey3/README.md +++ b/samples/client/petstore/java/jersey3/README.md @@ -121,6 +121,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/java/jersey3/api/openapi.yaml b/samples/client/petstore/java/jersey3/api/openapi.yaml index 2dcf21ae0b3..814354567b0 100644 --- a/samples/client/petstore/java/jersey3/api/openapi.yaml +++ b/samples/client/petstore/java/jersey3/api/openapi.yaml @@ -937,6 +937,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1760,6 +1779,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/jersey3/docs/FakeApi.md b/samples/client/petstore/java/jersey3/docs/FakeApi.md index 83f469863c9..55a9c935065 100644 --- a/samples/client/petstore/java/jersey3/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey3/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | | [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -402,6 +403,70 @@ No authorization required | **200** | Got named array of enums | - | +## 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.model.*; +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>**| 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 | - | + + ## testBodyWithFileSchema > testBodyWithFileSchema(fileSchemaTestClass) diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java index 9bf3abd9fbe..9b965c9b57c 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/FakeApi.java @@ -268,6 +268,45 @@ public class FakeApi { new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, null, localVarReturnType, false); } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testAdditionalPropertiesReference(Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws ApiException { + // Check required parameters + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + String localVarAccept = apiClient.selectHeaderAccept(); + String localVarContentType = apiClient.selectHeaderContentType("application/json"); + return apiClient.invokeAPI("FakeApi.testAdditionalPropertiesReference", "/fake/additionalProperties-reference", "POST", new ArrayList<>(), requestBody, + new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, + null, null, false); + } /** * * For this test, the body for this request much reference a schema named `File`. diff --git a/samples/client/petstore/java/native-async/README.md b/samples/client/petstore/java/native-async/README.md index 5bbd36da000..0148d0b2d3c 100644 --- a/samples/client/petstore/java/native-async/README.md +++ b/samples/client/petstore/java/native-async/README.md @@ -124,6 +124,8 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterStringSerializeWithHttpInfo**](docs/FakeApi.md#fakeOuterStringSerializeWithHttpInfo) | **POST** /fake/outer/string | *FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums *FakeApi* | [**getArrayOfEnumsWithHttpInfo**](docs/FakeApi.md#getArrayOfEnumsWithHttpInfo) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*FakeApi* | [**testAdditionalPropertiesReferenceWithHttpInfo**](docs/FakeApi.md#testAdditionalPropertiesReferenceWithHttpInfo) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithFileSchemaWithHttpInfo**](docs/FakeApi.md#testBodyWithFileSchemaWithHttpInfo) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/java/native-async/api/openapi.yaml b/samples/client/petstore/java/native-async/api/openapi.yaml index 79127951b04..07a440cfe9d 100644 --- a/samples/client/petstore/java/native-async/api/openapi.yaml +++ b/samples/client/petstore/java/native-async/api/openapi.yaml @@ -952,6 +952,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1775,6 +1794,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/native-async/docs/FakeApi.md b/samples/client/petstore/java/native-async/docs/FakeApi.md index 5ad79f6eba2..cac951a5edc 100644 --- a/samples/client/petstore/java/native-async/docs/FakeApi.md +++ b/samples/client/petstore/java/native-async/docs/FakeApi.md @@ -18,6 +18,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fakeOuterStringSerializeWithHttpInfo**](FakeApi.md#fakeOuterStringSerializeWithHttpInfo) | **POST** /fake/outer/string | | | [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums | | [**getArrayOfEnumsWithHttpInfo**](FakeApi.md#getArrayOfEnumsWithHttpInfo) | **GET** /fake/array-of-enums | Array of Enums | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**testAdditionalPropertiesReferenceWithHttpInfo**](FakeApi.md#testAdditionalPropertiesReferenceWithHttpInfo) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | | | [**testBodyWithFileSchemaWithHttpInfo**](FakeApi.md#testBodyWithFileSchemaWithHttpInfo) | **PUT** /fake/body-with-file-schema | | | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | | @@ -1010,6 +1012,147 @@ No authorization required | **200** | Got named array of enums | - | +## testAdditionalPropertiesReference + +> CompletableFuture 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; +import java.util.concurrent.CompletableFuture; + +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 { + CompletableFuture result = 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 + + +CompletableFuture (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 | - | + +## testAdditionalPropertiesReferenceWithHttpInfo + +> CompletableFuture> testAdditionalPropertiesReference testAdditionalPropertiesReferenceWithHttpInfo(requestBody) + +test referenced additionalProperties + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +import java.util.concurrent.CompletableFuture; + +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 { + CompletableFuture> response = apiInstance.testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + + +CompletableFuture> + +### 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 | - | + + ## testBodyWithFileSchema > CompletableFuture testBodyWithFileSchema(fileSchemaTestClass) diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java index c3a4b4bbede..efd06759640 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -728,6 +728,89 @@ public class FakeApi { } return localVarRequestBuilder; } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return CompletableFuture<Void> + * @throws ApiException if fails to make API call + */ + public CompletableFuture testAdditionalPropertiesReference(Map requestBody) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("testAdditionalPropertiesReference", localVarResponse)); + } + return CompletableFuture.completedFuture(null); + }); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return CompletableFuture<ApiResponse<Void>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("testAdditionalPropertiesReference", localVarResponse)); + } + return CompletableFuture.completedFuture( + new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null) + ); + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(Map requestBody) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/additionalProperties-reference"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(requestBody); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } /** * * For this test, the body for this request much reference a schema named `File`. diff --git a/samples/client/petstore/java/native/README.md b/samples/client/petstore/java/native/README.md index c0ada1a69cc..bafb85f35de 100644 --- a/samples/client/petstore/java/native/README.md +++ b/samples/client/petstore/java/native/README.md @@ -123,6 +123,8 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterStringSerializeWithHttpInfo**](docs/FakeApi.md#fakeOuterStringSerializeWithHttpInfo) | **POST** /fake/outer/string | *FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums *FakeApi* | [**getArrayOfEnumsWithHttpInfo**](docs/FakeApi.md#getArrayOfEnumsWithHttpInfo) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*FakeApi* | [**testAdditionalPropertiesReferenceWithHttpInfo**](docs/FakeApi.md#testAdditionalPropertiesReferenceWithHttpInfo) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithFileSchemaWithHttpInfo**](docs/FakeApi.md#testBodyWithFileSchemaWithHttpInfo) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/java/native/api/openapi.yaml b/samples/client/petstore/java/native/api/openapi.yaml index 79127951b04..07a440cfe9d 100644 --- a/samples/client/petstore/java/native/api/openapi.yaml +++ b/samples/client/petstore/java/native/api/openapi.yaml @@ -952,6 +952,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1775,6 +1794,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/native/docs/FakeApi.md b/samples/client/petstore/java/native/docs/FakeApi.md index d741761672d..adff98c0889 100644 --- a/samples/client/petstore/java/native/docs/FakeApi.md +++ b/samples/client/petstore/java/native/docs/FakeApi.md @@ -18,6 +18,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fakeOuterStringSerializeWithHttpInfo**](FakeApi.md#fakeOuterStringSerializeWithHttpInfo) | **POST** /fake/outer/string | | | [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums | | [**getArrayOfEnumsWithHttpInfo**](FakeApi.md#getArrayOfEnumsWithHttpInfo) | **GET** /fake/array-of-enums | Array of Enums | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**testAdditionalPropertiesReferenceWithHttpInfo**](FakeApi.md#testAdditionalPropertiesReferenceWithHttpInfo) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | | | [**testBodyWithFileSchemaWithHttpInfo**](FakeApi.md#testBodyWithFileSchemaWithHttpInfo) | **PUT** /fake/body-with-file-schema | | | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | | @@ -947,6 +949,138 @@ No authorization required | **200** | Got named array of enums | - | +## testAdditionalPropertiesReference + +> void 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 | - | + +## testAdditionalPropertiesReferenceWithHttpInfo + +> ApiResponse testAdditionalPropertiesReference testAdditionalPropertiesReferenceWithHttpInfo(requestBody) + +test referenced additionalProperties + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +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 { + ApiResponse response = apiInstance.testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + + +ApiResponse + +### 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 | - | + + ## testBodyWithFileSchema > void testBodyWithFileSchema(fileSchemaTestClass) diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index 8a8b89d22ad..4ae6a081cdc 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -580,6 +580,86 @@ public class FakeApi { } return localVarRequestBuilder; } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException if fails to make API call + */ + public void testAdditionalPropertiesReference(Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testAdditionalPropertiesReferenceRequestBuilder(requestBody); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("testAdditionalPropertiesReference", localVarResponse); + } + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder testAdditionalPropertiesReferenceRequestBuilder(Map requestBody) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/additionalProperties-reference"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(requestBody); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } /** * * For this test, the body for this request much reference a schema named `File`. diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index 64c16f1ee5e..999fe54e594 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -125,6 +125,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums *FakeApi* | [**getParameterNameMapping**](docs/FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml index c26a3885de9..1ea1f92336d 100644 --- a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml @@ -933,6 +933,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1906,6 +1925,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md index bbfe7c1b97e..6af91003380 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -11,6 +11,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | | [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums | | [**getParameterNameMapping**](FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -446,6 +447,67 @@ No authorization required |-------------|-------------|------------------| | **200** | OK | - | + +# **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 | - | + # **testBodyWithFileSchema** > testBodyWithFileSchema(fileSchemaTestClass) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java index 3f048ddf6a2..35608948029 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java @@ -927,6 +927,124 @@ public class FakeApi { localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } + /** + * Build call for testAdditionalPropertiesReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceCall(Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testAdditionalPropertiesReferenceValidateBeforeCall(Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference(Async)"); + } + + return testAdditionalPropertiesReferenceCall(requestBody, _callback); + + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testAdditionalPropertiesReference(Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceAsync(Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for testBodyWithFileSchema * @param fileSchemaTestClass (required) diff --git a/samples/client/petstore/java/resteasy/README.md b/samples/client/petstore/java/resteasy/README.md index 88c593489c7..f436b871632 100644 --- a/samples/client/petstore/java/resteasy/README.md +++ b/samples/client/petstore/java/resteasy/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/resteasy/api/openapi.yaml b/samples/client/petstore/java/resteasy/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/resteasy/api/openapi.yaml +++ b/samples/client/petstore/java/resteasy/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/resteasy/docs/FakeApi.md b/samples/client/petstore/java/resteasy/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java/resteasy/docs/FakeApi.md +++ b/samples/client/petstore/java/resteasy/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java index f9093377f76..cceced91b3a 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java @@ -364,6 +364,48 @@ public class FakeApi { GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException if fails to make API call + */ + public void testAdditionalPropertiesReference(Map requestBody) throws ApiException { + Object localVarPostBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/java/resttemplate-withXml/README.md b/samples/client/petstore/java/resttemplate-withXml/README.md index aef90cd7fba..08a46fad488 100644 --- a/samples/client/petstore/java/resttemplate-withXml/README.md +++ b/samples/client/petstore/java/resttemplate-withXml/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java index c816078d248..daad5f9d7fb 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/FakeApi.java @@ -412,6 +412,51 @@ public class FakeApi { ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/property/enum-int", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body (required) + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void testAdditionalPropertiesReference(Map requestBody) throws RestClientException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body (required) + * @return ResponseEntity<Void> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws RestClientException { + Object localVarPostBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/additionalProperties-reference", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/java/resttemplate/README.md b/samples/client/petstore/java/resttemplate/README.md index 24053b816ed..046c1d47e35 100644 --- a/samples/client/petstore/java/resttemplate/README.md +++ b/samples/client/petstore/java/resttemplate/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/resttemplate/api/openapi.yaml b/samples/client/petstore/java/resttemplate/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/resttemplate/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/resttemplate/docs/FakeApi.md b/samples/client/petstore/java/resttemplate/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java/resttemplate/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java index c816078d248..daad5f9d7fb 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/FakeApi.java @@ -412,6 +412,51 @@ public class FakeApi { ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/property/enum-int", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body (required) + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void testAdditionalPropertiesReference(Map requestBody) throws RestClientException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body (required) + * @return ResponseEntity<Void> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws RestClientException { + Object localVarPostBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/additionalProperties-reference", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/java/vertx/README.md b/samples/client/petstore/java/vertx/README.md index 1cab57b4f6c..c022185a73c 100644 --- a/samples/client/petstore/java/vertx/README.md +++ b/samples/client/petstore/java/vertx/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/vertx/api/openapi.yaml b/samples/client/petstore/java/vertx/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/vertx/api/openapi.yaml +++ b/samples/client/petstore/java/vertx/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/vertx/docs/FakeApi.md b/samples/client/petstore/java/vertx/docs/FakeApi.md index b9dc1bfbd92..8aec7cab428 100644 --- a/samples/client/petstore/java/vertx/docs/FakeApi.md +++ b/samples/client/petstore/java/vertx/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApi.java index f0768854f80..e3717cf8f8c 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApi.java @@ -56,6 +56,10 @@ public interface FakeApi { void fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, ApiClient.AuthInfo authInfo, Handler> handler); + void testAdditionalPropertiesReference(Map requestBody, Handler> handler); + + void testAdditionalPropertiesReference(Map requestBody, ApiClient.AuthInfo authInfo, Handler> handler); + void testBodyWithBinary(AsyncFile body, Handler> handler); void testBodyWithBinary(AsyncFile body, ApiClient.AuthInfo authInfo, Handler> handler); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java index 88734181cfc..c1375f95b40 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java @@ -406,6 +406,54 @@ public class FakeApiImpl implements FakeApi { 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) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java index f5537a272c9..8980ce3c1af 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java @@ -397,6 +397,51 @@ public class FakeApi { )); } /** + * 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) diff --git a/samples/client/petstore/java/webclient-jakarta/README.md b/samples/client/petstore/java/webclient-jakarta/README.md index a88a5413c4f..65b06fccc8d 100644 --- a/samples/client/petstore/java/webclient-jakarta/README.md +++ b/samples/client/petstore/java/webclient-jakarta/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md b/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java index 3a38dbe7286..7b435264e5e 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java @@ -624,6 +624,75 @@ public class FakeApi { public ResponseSpec fakePropertyEnumIntegerSerializeWithResponseSpec(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws WebClientResponseException { return fakePropertyEnumIntegerSerializeRequestCreation(outerObjectWithEnumProperty); } + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec testAdditionalPropertiesReferenceRequestCreation(Map requestBody) throws WebClientResponseException { + Object postBody = requestBody; + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new WebClientResponseException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/additionalProperties-reference", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testAdditionalPropertiesReference(Map requestBody) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testAdditionalPropertiesReferenceRequestCreation(requestBody).bodyToMono(localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testAdditionalPropertiesReferenceRequestCreation(requestBody).toEntity(localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec testAdditionalPropertiesReferenceWithResponseSpec(Map requestBody) throws WebClientResponseException { + return testAdditionalPropertiesReferenceRequestCreation(requestBody); + } /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/java/webclient-swagger2/README.md b/samples/client/petstore/java/webclient-swagger2/README.md index a88a5413c4f..65b06fccc8d 100644 --- a/samples/client/petstore/java/webclient-swagger2/README.md +++ b/samples/client/petstore/java/webclient-swagger2/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md b/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java index 2170874323d..3e209c2ff62 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -624,6 +624,75 @@ public class FakeApi { public ResponseSpec fakePropertyEnumIntegerSerializeWithResponseSpec(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws WebClientResponseException { return fakePropertyEnumIntegerSerializeRequestCreation(outerObjectWithEnumProperty); } + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec testAdditionalPropertiesReferenceRequestCreation(Map requestBody) throws WebClientResponseException { + Object postBody = requestBody; + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new WebClientResponseException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/additionalProperties-reference", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testAdditionalPropertiesReference(Map requestBody) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testAdditionalPropertiesReferenceRequestCreation(requestBody).bodyToMono(localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testAdditionalPropertiesReferenceRequestCreation(requestBody).toEntity(localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec testAdditionalPropertiesReferenceWithResponseSpec(Map requestBody) throws WebClientResponseException { + return testAdditionalPropertiesReferenceRequestCreation(requestBody); + } /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/java/webclient/README.md b/samples/client/petstore/java/webclient/README.md index a88a5413c4f..65b06fccc8d 100644 --- a/samples/client/petstore/java/webclient/README.md +++ b/samples/client/petstore/java/webclient/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description *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 | diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 991caf59001..08f80151bfe 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/client/petstore/java/webclient/docs/FakeApi.md b/samples/client/petstore/java/webclient/docs/FakeApi.md index e442af92c3b..148fc7a22dd 100644 --- a/samples/client/petstore/java/webclient/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**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 | | @@ -548,6 +549,71 @@ No authorization required | **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) diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java index 2170874323d..3e209c2ff62 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -624,6 +624,75 @@ public class FakeApi { public ResponseSpec fakePropertyEnumIntegerSerializeWithResponseSpec(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws WebClientResponseException { return fakePropertyEnumIntegerSerializeRequestCreation(outerObjectWithEnumProperty); } + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec testAdditionalPropertiesReferenceRequestCreation(Map requestBody) throws WebClientResponseException { + Object postBody = requestBody; + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new WebClientResponseException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/additionalProperties-reference", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testAdditionalPropertiesReference(Map requestBody) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testAdditionalPropertiesReferenceRequestCreation(requestBody).bodyToMono(localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testAdditionalPropertiesReferenceRequestCreation(requestBody).toEntity(localVarReturnType); + } + + /** + * test referenced additionalProperties + * + *

200 - successful operation + * @param requestBody request body + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec testAdditionalPropertiesReferenceWithResponseSpec(Map requestBody) throws WebClientResponseException { + return testAdditionalPropertiesReferenceRequestCreation(requestBody); + } /** * * For this test, the body has to be a binary file. diff --git a/samples/client/petstore/javascript-apollo/README.md b/samples/client/petstore/javascript-apollo/README.md index 96969380ac2..cc9221bf465 100644 --- a/samples/client/petstore/javascript-apollo/README.md +++ b/samples/client/petstore/javascript-apollo/README.md @@ -129,6 +129,7 @@ Class | Method | HTTP request | Description *OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | +*OpenApiPetstore.FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *OpenApiPetstore.FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | *OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/javascript-apollo/docs/FakeApi.md b/samples/client/petstore/javascript-apollo/docs/FakeApi.md index b67ae97ad0d..140ff85a048 100644 --- a/samples/client/petstore/javascript-apollo/docs/FakeApi.md +++ b/samples/client/petstore/javascript-apollo/docs/FakeApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description [**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 | @@ -347,6 +348,51 @@ No authorization required - **Accept**: */* +## testAdditionalPropertiesReference + +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example + +```javascript +import OpenApiPetstore from 'open_api_petstore'; + +let apiInstance = new OpenApiPetstore.FakeApi(); +let requestBody = {key: null}; // {String: Object} | request body +apiInstance.testAdditionalPropertiesReference(requestBody, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully.'); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**{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 + + ## testBodyWithBinary > testBodyWithBinary(body) diff --git a/samples/client/petstore/javascript-apollo/src/api/FakeApi.js b/samples/client/petstore/javascript-apollo/src/api/FakeApi.js index 3cd15037199..1699e697ffa 100644 --- a/samples/client/petstore/javascript-apollo/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-apollo/src/api/FakeApi.js @@ -279,6 +279,42 @@ export default class FakeApi extends ApiClient { ); } + /** + * test referenced additionalProperties + * + * @param {Object.} requestBody request body + * @param requestInit Dynamic configuration. @see {@link https://github.com/apollographql/apollo-server/pull/1277} + * @return {Promise} + */ + async testAdditionalPropertiesReference(requestBody, requestInit) { + let postBody = requestBody; + // verify the required parameter 'requestBody' is set + if (requestBody === undefined || requestBody === null) { + throw new Error("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + 'User-Agent': 'OpenAPI-Generator/1.0.0/Javascript', + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = ['application/json']; + let accepts = []; + let returnType = null; + + return this.callApi( + '/fake/additionalProperties-reference', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, requestInit + ); + } + /** * For this test, the body has to be a binary file. * @param {File} body image to upload diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md index f3aec1c96bf..8b628d8ea90 100644 --- a/samples/client/petstore/javascript-es6/README.md +++ b/samples/client/petstore/javascript-es6/README.md @@ -129,6 +129,7 @@ Class | Method | HTTP request | Description *OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | +*OpenApiPetstore.FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *OpenApiPetstore.FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | *OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/javascript-es6/docs/FakeApi.md b/samples/client/petstore/javascript-es6/docs/FakeApi.md index f1995011445..6ed67beb69f 100644 --- a/samples/client/petstore/javascript-es6/docs/FakeApi.md +++ b/samples/client/petstore/javascript-es6/docs/FakeApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description [**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 | @@ -347,6 +348,51 @@ No authorization required - **Accept**: */* +## testAdditionalPropertiesReference + +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example + +```javascript +import OpenApiPetstore from 'open_api_petstore'; + +let apiInstance = new OpenApiPetstore.FakeApi(); +let requestBody = {key: null}; // {String: Object} | request body +apiInstance.testAdditionalPropertiesReference(requestBody, (error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully.'); + } +}); +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**{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 + + ## testBodyWithBinary > testBodyWithBinary(body) diff --git a/samples/client/petstore/javascript-es6/src/api/FakeApi.js b/samples/client/petstore/javascript-es6/src/api/FakeApi.js index 4d5bcd0b826..c47f7247b7b 100644 --- a/samples/client/petstore/javascript-es6/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-es6/src/api/FakeApi.js @@ -321,6 +321,47 @@ export default class FakeApi { ); } + /** + * Callback function to receive the result of the testAdditionalPropertiesReference operation. + * @callback module:api/FakeApi~testAdditionalPropertiesReferenceCallback + * @param {String} error Error message, if any. + * @param data This operation does not return a value. + * @param {String} response The complete HTTP response. + */ + + /** + * test referenced additionalProperties + * + * @param {Object.} requestBody request body + * @param {module:api/FakeApi~testAdditionalPropertiesReferenceCallback} callback The callback function, accepting three arguments: error, data, response + */ + testAdditionalPropertiesReference(requestBody, callback) { + let postBody = requestBody; + // verify the required parameter 'requestBody' is set + if (requestBody === undefined || requestBody === null) { + throw new Error("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = ['application/json']; + let accepts = []; + let returnType = null; + return this.apiClient.callApi( + '/fake/additionalProperties-reference', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + /** * Callback function to receive the result of the testBodyWithBinary operation. * @callback module:api/FakeApi~testBodyWithBinaryCallback diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md index cbe9da562f0..b538c6edc33 100644 --- a/samples/client/petstore/javascript-promise-es6/README.md +++ b/samples/client/petstore/javascript-promise-es6/README.md @@ -127,6 +127,7 @@ Class | Method | HTTP request | Description *OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | +*OpenApiPetstore.FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *OpenApiPetstore.FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | *OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md index 91964dffaa7..c04cb9b9057 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description [**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 | @@ -340,6 +341,50 @@ No authorization required - **Accept**: */* +## testAdditionalPropertiesReference + +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example + +```javascript +import OpenApiPetstore from 'open_api_petstore'; + +let apiInstance = new OpenApiPetstore.FakeApi(); +let requestBody = {key: null}; // {String: Object} | request body +apiInstance.testAdditionalPropertiesReference(requestBody).then(() => { + console.log('API called successfully.'); +}, (error) => { + console.error(error); +}); + +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**{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 + + ## testBodyWithBinary > testBodyWithBinary(body) diff --git a/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js b/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js index 15a2f60eb1d..67f8f1b2d28 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js @@ -357,6 +357,53 @@ export default class FakeApi { } + /** + * test referenced additionalProperties + * + * @param {Object.} requestBody request body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response + */ + testAdditionalPropertiesReferenceWithHttpInfo(requestBody) { + let postBody = requestBody; + // verify the required parameter 'requestBody' is set + if (requestBody === undefined || requestBody === null) { + throw new Error("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = ['application/json']; + let accepts = []; + let returnType = null; + return this.apiClient.callApi( + '/fake/additionalProperties-reference', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null + ); + } + + /** + * test referenced additionalProperties + * + * @param {Object.} requestBody request body + * @return {Promise} a {@link https://www.promisejs.org/|Promise} + */ + testAdditionalPropertiesReference(requestBody) { + return this.testAdditionalPropertiesReferenceWithHttpInfo(requestBody) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + /** * For this test, the body has to be a binary file. * @param {File} body image to upload diff --git a/samples/client/petstore/k6/script.js b/samples/client/petstore/k6/script.js index 7f8034633c2..d2f55a29dae 100644 --- a/samples/client/petstore/k6/script.js +++ b/samples/client/petstore/k6/script.js @@ -409,6 +409,20 @@ export default function() { } }); + group("/fake/additionalProperties-reference", () => { + + // Request No. 1: testAdditionalPropertiesReference + { + let url = BASE_URL + `/fake/additionalProperties-reference`; + let params = {headers: {"Content-Type": "application/json", "Accept": "application/json"}}; + let request = http.post(url, params); + + check(request, { + "successful operation": (r) => r.status === 200 + }); + } + }); + group("/pet/findByStatus", () => { let status = 'TODO_EDIT_THE_STATUS'; // specify value as there is no example value for this parameter in OpenAPI spec diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 6658f7e9469..414d9bfa2bb 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -398,6 +398,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +*FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index fb3661a71a4..41591b813c3 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -17,6 +17,7 @@ Method | HTTP request | Description [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +[**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | @@ -392,6 +393,51 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_additional_properties_reference** +> test_additional_properties_reference(request_body => $request_body) + +test referenced additionalProperties + + + +### Example +```perl +use Data::Dumper; +use WWW::OpenAPIClient::FakeApi; +my $api_instance = WWW::OpenAPIClient::FakeApi->new( +); + +my $request_body = WWW::OpenAPIClient::Object::HASH[string,AnyType]->new(); # HASH[string,AnyType] | request body + +eval { + $api_instance->test_additional_properties_reference(request_body => $request_body); +}; +if ($@) { + warn "Exception when calling FakeApi->test_additional_properties_reference: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**HASH[string,AnyType]**](AnyType.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_body_with_binary** > test_body_with_binary(body => $body) diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm index 376b9fdd2c5..1353b6f5b5a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm @@ -534,6 +534,67 @@ sub fake_property_enum_integer_serialize { return $_response_object; } +# +# test_additional_properties_reference +# +# test referenced additionalProperties +# +# @param HASH[string,AnyType] $request_body request body (required) +{ + my $params = { + 'request_body' => { + data_type => 'HASH[string,AnyType]', + description => 'request body', + required => '1', + }, + }; + __PACKAGE__->method_documentation->{ 'test_additional_properties_reference' } = { + summary => 'test referenced additionalProperties', + params => $params, + returns => undef, + }; +} +# @return void +# +sub test_additional_properties_reference { + my ($self, %args) = @_; + + # verify the required parameter 'request_body' is set + unless (exists $args{'request_body'}) { + croak("Missing the required parameter 'request_body' when calling test_additional_properties_reference"); + } + + # parse inputs + my $_resource_path = '/fake/additionalProperties-reference'; + + my $_method = 'POST'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept(); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + + my $_body_data; + # body params + if ( exists $args{'request_body'}) { + $_body_data = $args{'request_body'}; + } + + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + return; +} + # # test_body_with_binary # diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md index 9fd66c9b427..1f0bcb99bbb 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md @@ -81,6 +81,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +*FakeApi* | [**testAdditionalPropertiesReference**](docs/Api/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**testBodyWithBinary**](docs/Api/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | *FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | 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 3ff1c1b89d0..48800159f24 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 @@ -12,6 +12,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati | [**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 | | @@ -469,6 +470,61 @@ No authorization required [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `testAdditionalPropertiesReference()` + +```php +testAdditionalPropertiesReference($request_body) +``` + +test referenced additionalProperties + + + +### Example + +```php + | request body + +try { + $apiInstance->testAdditionalPropertiesReference($request_body); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testAdditionalPropertiesReference: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **request_body** | [**array**](../Model/mixed.md)| request body | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `testBodyWithBinary()` ```php 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 75abbfd2e8f..5adb962d170 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 @@ -96,6 +96,9 @@ class FakeApi 'fakePropertyEnumIntegerSerialize' => [ 'application/json', ], + 'testAdditionalPropertiesReference' => [ + 'application/json', + ], 'testBodyWithBinary' => [ 'image/png', ], @@ -2585,6 +2588,249 @@ class FakeApi ); } + /** + * Operation testAdditionalPropertiesReference + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] 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 void + */ + public function testAdditionalPropertiesReference( + array $request_body, + string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] + ): void + { + $this->testAdditionalPropertiesReferenceWithHttpInfo($request_body, $contentType); + } + + /** + * Operation testAdditionalPropertiesReferenceWithHttpInfo + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] 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 testAdditionalPropertiesReferenceWithHttpInfo( + array $request_body, + string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] + ): array + { + $request = $this->testAdditionalPropertiesReferenceRequest($request_body, $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(); + + 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 [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation testAdditionalPropertiesReferenceAsync + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function testAdditionalPropertiesReferenceAsync( + array $request_body, + string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] + ): PromiseInterface + { + return $this->testAdditionalPropertiesReferenceAsyncWithHttpInfo($request_body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testAdditionalPropertiesReferenceAsyncWithHttpInfo + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function testAdditionalPropertiesReferenceAsyncWithHttpInfo( + $request_body, + string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->testAdditionalPropertiesReferenceRequest($request_body, $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 'testAdditionalPropertiesReference' + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testAdditionalPropertiesReferenceRequest( + $request_body, + string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] + ): Request + { + + // verify the required parameter 'request_body' is set + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $request_body when calling testAdditionalPropertiesReference' + ); + } + + + $resourcePath = '/fake/additionalProperties-reference'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($request_body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $request_body; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation testBodyWithBinary * diff --git a/samples/client/petstore/php/OpenAPIClient-php/README.md b/samples/client/petstore/php/OpenAPIClient-php/README.md index 8a10479d27a..91218feed66 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php/OpenAPIClient-php/README.md @@ -83,6 +83,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | *FakeApi* | [**getParameterNameMapping**](docs/Api/FakeApi.md#getparameternamemapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*FakeApi* | [**testAdditionalPropertiesReference**](docs/Api/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**testBodyWithBinary**](docs/Api/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | *FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md index 2b5343f2b1b..7c84b0c17d5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -13,6 +13,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati | [**fakeOuterStringSerialize()**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | | [**fakePropertyEnumIntegerSerialize()**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | | | [**getParameterNameMapping()**](FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**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 | | @@ -530,6 +531,61 @@ No authorization required [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `testAdditionalPropertiesReference()` + +```php +testAdditionalPropertiesReference($request_body) +``` + +test referenced additionalProperties + + + +### Example + +```php + | request body + +try { + $apiInstance->testAdditionalPropertiesReference($request_body); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testAdditionalPropertiesReference: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **request_body** | [**array**](../Model/mixed.md)| request body | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `testBodyWithBinary()` ```php 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 f500b6cbadd..f4cf34537d8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -99,6 +99,9 @@ class FakeApi 'getParameterNameMapping' => [ 'application/json', ], + 'testAdditionalPropertiesReference' => [ + 'application/json', + ], 'testBodyWithBinary' => [ 'image/png', ], @@ -2764,6 +2767,234 @@ class FakeApi ); } + /** + * Operation testAdditionalPropertiesReference + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] 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 void + */ + public function testAdditionalPropertiesReference($request_body, string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0]) + { + $this->testAdditionalPropertiesReferenceWithHttpInfo($request_body, $contentType); + } + + /** + * Operation testAdditionalPropertiesReferenceWithHttpInfo + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] 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 null, HTTP status code, HTTP response headers (array of strings) + */ + public function testAdditionalPropertiesReferenceWithHttpInfo($request_body, string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0]) + { + $request = $this->testAdditionalPropertiesReferenceRequest($request_body, $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(); + + 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 [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation testAdditionalPropertiesReferenceAsync + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testAdditionalPropertiesReferenceAsync($request_body, string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0]) + { + return $this->testAdditionalPropertiesReferenceAsyncWithHttpInfo($request_body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testAdditionalPropertiesReferenceAsyncWithHttpInfo + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testAdditionalPropertiesReferenceAsyncWithHttpInfo($request_body, string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0]) + { + $returnType = ''; + $request = $this->testAdditionalPropertiesReferenceRequest($request_body, $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 'testAdditionalPropertiesReference' + * + * @param array $request_body request body (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAdditionalPropertiesReference'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testAdditionalPropertiesReferenceRequest($request_body, string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0]) + { + + // verify the required parameter 'request_body' is set + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling testAdditionalPropertiesReference' + ); + } + + + $resourcePath = '/fake/additionalProperties-reference'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($request_body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $request_body; + } + } elseif (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( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation testBodyWithBinary * diff --git a/samples/client/petstore/php/psr-18/README.md b/samples/client/petstore/php/psr-18/README.md index f2d87528621..f386b2788bf 100644 --- a/samples/client/petstore/php/psr-18/README.md +++ b/samples/client/petstore/php/psr-18/README.md @@ -94,6 +94,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | *FakeApi* | [**getParameterNameMapping**](docs/Api/FakeApi.md#getparameternamemapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*FakeApi* | [**testAdditionalPropertiesReference**](docs/Api/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**testBodyWithBinary**](docs/Api/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | *FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md b/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md index e7b93904d5b..db072f39718 100644 --- a/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md @@ -13,6 +13,7 @@ Method | HTTP request | Description [**fakeOuterStringSerialize()**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**fakePropertyEnumIntegerSerialize()**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | [**getParameterNameMapping()**](FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +[**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 | @@ -530,6 +531,61 @@ No authorization required [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `testAdditionalPropertiesReference()` + +```php +testAdditionalPropertiesReference($request_body) +``` + +test referenced additionalProperties + + + +### Example + +```php + | request body + +try { + $apiInstance->testAdditionalPropertiesReference($request_body); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testAdditionalPropertiesReference: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**array**](../Model/mixed.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `testBodyWithBinary()` ```php 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 aa6ee162332..55c4bcd2462 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php @@ -2387,6 +2387,218 @@ class FakeApi return $this->createRequest('GET', $uri, $headers, $httpBody); } + /** + * Operation testAdditionalPropertiesReference + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function testAdditionalPropertiesReference($request_body) + { + $this->testAdditionalPropertiesReferenceWithHttpInfo($request_body); + } + + /** + * Operation testAdditionalPropertiesReferenceWithHttpInfo + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function testAdditionalPropertiesReferenceWithHttpInfo($request_body) + { + $request = $this->testAdditionalPropertiesReferenceRequest($request_body); + + 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(); + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation testAdditionalPropertiesReferenceAsync + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * + * @throws \InvalidArgumentException + * @return Promise + */ + public function testAdditionalPropertiesReferenceAsync($request_body) + { + return $this->testAdditionalPropertiesReferenceAsyncWithHttpInfo($request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testAdditionalPropertiesReferenceAsyncWithHttpInfo + * + * test referenced additionalProperties + * + * @param array $request_body request body (required) + * + * @throws \InvalidArgumentException + * @return Promise + */ + public function testAdditionalPropertiesReferenceAsyncWithHttpInfo($request_body) + { + $returnType = ''; + $request = $this->testAdditionalPropertiesReferenceRequest($request_body); + + return $this->httpAsyncClient->sendAsyncRequest($request) + ->then( + function ($response) use ($returnType) { + return [null, $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 'testAdditionalPropertiesReference' + * + * @param array $request_body request body (required) + * + * @throws \InvalidArgumentException + * @return RequestInterface + */ + public function testAdditionalPropertiesReferenceRequest($request_body) + { + // verify the required parameter 'request_body' is set + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling testAdditionalPropertiesReference' + ); + } + + $resourcePath = '/fake/additionalProperties-reference'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = null; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $request_body; + } + } elseif (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 ($headers['Content-Type'] === 'application/json') { + $httpBody = json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = Query::build($formParams); + } + } + + + $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 testBodyWithBinary * diff --git a/samples/client/petstore/powershell/README.md b/samples/client/petstore/powershell/README.md index e02ad9f8eb5..d2cc11fce52 100644 --- a/samples/client/petstore/powershell/README.md +++ b/samples/client/petstore/powershell/README.md @@ -63,6 +63,7 @@ Class | Method | HTTP request | Description *PSFakeApi* | [**Invoke-PSFakeOuterNumberSerialize**](docs/PSFakeApi.md#Invoke-PSFakeOuterNumberSerialize) | **POST** /fake/outer/number | *PSFakeApi* | [**Invoke-PSFakeOuterStringSerialize**](docs/PSFakeApi.md#Invoke-PSFakeOuterStringSerialize) | **POST** /fake/outer/string | *PSFakeApi* | [**Get-PSArrayOfEnums**](docs/PSFakeApi.md#Get-PSArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums +*PSFakeApi* | [**Test-PSAdditionalPropertiesReference**](docs/PSFakeApi.md#Test-PSAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *PSFakeApi* | [**Test-PSBodyWithFileSchema**](docs/PSFakeApi.md#Test-PSBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *PSFakeApi* | [**Test-PSBodyWithQueryParams**](docs/PSFakeApi.md#Test-PSBodyWithQueryParams) | **PUT** /fake/body-with-query-params | *PSFakeApi* | [**Test-PSClientModel**](docs/PSFakeApi.md#Test-PSClientModel) | **PATCH** /fake | To test ""client"" model diff --git a/samples/client/petstore/powershell/docs/PSFakeApi.md b/samples/client/petstore/powershell/docs/PSFakeApi.md index cfa337e3447..7b199fd9e02 100644 --- a/samples/client/petstore/powershell/docs/PSFakeApi.md +++ b/samples/client/petstore/powershell/docs/PSFakeApi.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**Invoke-PSFakeOuterNumberSerialize**](PSFakeApi.md#Invoke-PSFakeOuterNumberSerialize) | **POST** /fake/outer/number | [**Invoke-PSFakeOuterStringSerialize**](PSFakeApi.md#Invoke-PSFakeOuterStringSerialize) | **POST** /fake/outer/string | [**Get-PSArrayOfEnums**](PSFakeApi.md#Get-PSArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums +[**Test-PSAdditionalPropertiesReference**](PSFakeApi.md#Test-PSAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [**Test-PSBodyWithFileSchema**](PSFakeApi.md#Test-PSBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**Test-PSBodyWithQueryParams**](PSFakeApi.md#Test-PSBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**Test-PSClientModel**](PSFakeApi.md#Test-PSClientModel) | **PATCH** /fake | To test ""client"" model @@ -262,6 +263,49 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **Test-PSAdditionalPropertiesReference** +> void Test-PSAdditionalPropertiesReference
+>         [-RequestBody]
+ +test referenced additionalProperties + + + +### Example +```powershell +$RequestBody = @{ key_example = } # System.Collections.Hashtable | request body + +# test referenced additionalProperties +try { + $Result = Test-PSAdditionalPropertiesReference -RequestBody $RequestBody +} catch { + Write-Host ("Exception occurred when calling Test-PSAdditionalPropertiesReference: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **RequestBody** | [**System.Collections.Hashtable**](AnyType.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **Test-PSBodyWithFileSchema** > void Test-PSBodyWithFileSchema
diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 index 33edac7ec1b..c68a87293df 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSFakeApi.ps1 @@ -430,6 +430,81 @@ function Get-PSArrayOfEnums { <# .SYNOPSIS +test referenced additionalProperties + +.DESCRIPTION + +No description available. + +.PARAMETER RequestBody +request body + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +None +#> +function Test-PSAdditionalPropertiesReference { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [System.Collections.Hashtable] + ${RequestBody}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-PSAdditionalPropertiesReference' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-PSConfiguration + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('application/json') + + $LocalVarUri = '/fake/additionalProperties-reference' + + if (!$RequestBody) { + throw "Error! The required parameter `RequestBody` missing when calling testAdditionalPropertiesReference." + } + + $LocalVarBodyParameter = $RequestBody | ConvertTo-Json -Depth 100 + + $LocalVarResult = Invoke-PSApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + No summary available. .DESCRIPTION diff --git a/samples/client/petstore/ruby-autoload/README.md b/samples/client/petstore/ruby-autoload/README.md index 2eec0459c1e..8556b62fc36 100644 --- a/samples/client/petstore/ruby-autoload/README.md +++ b/samples/client/petstore/ruby-autoload/README.md @@ -85,6 +85,7 @@ Class | Method | HTTP request | Description *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +*Petstore::FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/ruby-autoload/docs/FakeApi.md b/samples/client/petstore/ruby-autoload/docs/FakeApi.md index f43e4402cf1..bb3486f585a 100644 --- a/samples/client/petstore/ruby-autoload/docs/FakeApi.md +++ b/samples/client/petstore/ruby-autoload/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | | | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | | | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | | +| [**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | | | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | | | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | | @@ -544,6 +545,69 @@ No authorization required - **Accept**: */* +## test_additional_properties_reference + +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new +request_body = { key: 3.56} # Hash | request body + +begin + # test referenced additionalProperties + api_instance.test_additional_properties_reference(request_body) +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference: #{e}" +end +``` + +#### Using the test_additional_properties_reference_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> test_additional_properties_reference_with_http_info(request_body) + +```ruby +begin + # test referenced additionalProperties + data, status_code, headers = api_instance.test_additional_properties_reference_with_http_info(request_body) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_body** | [**Hash<String, Object>**](Object.md) | request body | | + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + ## test_body_with_binary > test_body_with_binary(body) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb index b71c57c0298..68efaa01be7 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb @@ -513,6 +513,72 @@ module Petstore return data, status_code, headers end + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [nil] + def test_additional_properties_reference(request_body, opts = {}) + test_additional_properties_reference_with_http_info(request_body, opts) + nil + end + + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def test_additional_properties_reference_with_http_info(request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.test_additional_properties_reference ...' + end + # verify the required parameter 'request_body' is set + if @api_client.config.client_side_validation && request_body.nil? + fail ArgumentError, "Missing the required parameter 'request_body' when calling FakeApi.test_additional_properties_reference" + end + # resource path + local_var_path = '/fake/additionalProperties-reference' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(request_body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FakeApi.test_additional_properties_reference", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # For this test, the body has to be a binary file. # @param body [File] image to upload # @param [Hash] opts the optional parameters diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index 2eec0459c1e..8556b62fc36 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -85,6 +85,7 @@ Class | Method | HTTP request | Description *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +*Petstore::FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/ruby-faraday/docs/FakeApi.md b/samples/client/petstore/ruby-faraday/docs/FakeApi.md index f43e4402cf1..bb3486f585a 100644 --- a/samples/client/petstore/ruby-faraday/docs/FakeApi.md +++ b/samples/client/petstore/ruby-faraday/docs/FakeApi.md @@ -12,6 +12,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | | | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | | | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | | +| [**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | | | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | | | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | | @@ -544,6 +545,69 @@ No authorization required - **Accept**: */* +## test_additional_properties_reference + +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new +request_body = { key: 3.56} # Hash | request body + +begin + # test referenced additionalProperties + api_instance.test_additional_properties_reference(request_body) +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference: #{e}" +end +``` + +#### Using the test_additional_properties_reference_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> test_additional_properties_reference_with_http_info(request_body) + +```ruby +begin + # test referenced additionalProperties + data, status_code, headers = api_instance.test_additional_properties_reference_with_http_info(request_body) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_body** | [**Hash<String, Object>**](Object.md) | request body | | + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + ## test_body_with_binary > test_body_with_binary(body) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index b71c57c0298..68efaa01be7 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -513,6 +513,72 @@ module Petstore return data, status_code, headers end + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [nil] + def test_additional_properties_reference(request_body, opts = {}) + test_additional_properties_reference_with_http_info(request_body, opts) + nil + end + + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def test_additional_properties_reference_with_http_info(request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.test_additional_properties_reference ...' + end + # verify the required parameter 'request_body' is set + if @api_client.config.client_side_validation && request_body.nil? + fail ArgumentError, "Missing the required parameter 'request_body' when calling FakeApi.test_additional_properties_reference" + end + # resource path + local_var_path = '/fake/additionalProperties-reference' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(request_body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FakeApi.test_additional_properties_reference", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # For this test, the body has to be a binary file. # @param body [File] image to upload # @param [Hash] opts the optional parameters diff --git a/samples/client/petstore/ruby-httpx/README.md b/samples/client/petstore/ruby-httpx/README.md index 219e3ef720f..534bd931faa 100644 --- a/samples/client/petstore/ruby-httpx/README.md +++ b/samples/client/petstore/ruby-httpx/README.md @@ -86,6 +86,7 @@ Class | Method | HTTP request | Description *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | *Petstore::FakeApi* | [**get_parameter_name_mapping**](docs/FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*Petstore::FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/ruby-httpx/docs/FakeApi.md b/samples/client/petstore/ruby-httpx/docs/FakeApi.md index 2519c0fdfed..b61148721ca 100644 --- a/samples/client/petstore/ruby-httpx/docs/FakeApi.md +++ b/samples/client/petstore/ruby-httpx/docs/FakeApi.md @@ -13,6 +13,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | | | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | | | [**get_parameter_name_mapping**](FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | | | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | | | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | | @@ -611,6 +612,69 @@ No authorization required - **Accept**: Not defined +## test_additional_properties_reference + +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new +request_body = { key: 3.56} # Hash | request body + +begin + # test referenced additionalProperties + api_instance.test_additional_properties_reference(request_body) +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference: #{e}" +end +``` + +#### Using the test_additional_properties_reference_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> test_additional_properties_reference_with_http_info(request_body) + +```ruby +begin + # test referenced additionalProperties + data, status_code, headers = api_instance.test_additional_properties_reference_with_http_info(request_body) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_body** | [**Hash<String, Object>**](Object.md) | request body | | + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + ## test_body_with_binary > test_body_with_binary(body) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb index 5cb4dec7ba0..064496fe435 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/api/fake_api.rb @@ -594,6 +594,72 @@ module Petstore return data, status_code, headers end + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [nil] + def test_additional_properties_reference(request_body, opts = {}) + test_additional_properties_reference_with_http_info(request_body, opts) + nil + end + + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def test_additional_properties_reference_with_http_info(request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.test_additional_properties_reference ...' + end + # verify the required parameter 'request_body' is set + if @api_client.config.client_side_validation && request_body.nil? + fail ArgumentError, "Missing the required parameter 'request_body' when calling FakeApi.test_additional_properties_reference" + end + # resource path + local_var_path = '/fake/additionalProperties-reference' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(request_body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FakeApi.test_additional_properties_reference", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # For this test, the body has to be a binary file. # @param body [File] image to upload # @param [Hash] opts the optional parameters diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 219e3ef720f..534bd931faa 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -86,6 +86,7 @@ Class | Method | HTTP request | Description *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | *Petstore::FakeApi* | [**get_parameter_name_mapping**](docs/FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*Petstore::FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *Petstore::FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index 5785290cf7b..f3594ca3fb9 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -13,6 +13,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | | | [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | | | [**get_parameter_name_mapping**](FakeApi.md#get_parameter_name_mapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | | | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | | | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | | @@ -611,6 +612,69 @@ No authorization required - **Accept**: Not defined +## test_additional_properties_reference + +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new +request_body = { key: 3.56} # Hash | request body + +begin + # test referenced additionalProperties + api_instance.test_additional_properties_reference(request_body) +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference: #{e}" +end +``` + +#### Using the test_additional_properties_reference_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> test_additional_properties_reference_with_http_info(request_body) + +```ruby +begin + # test referenced additionalProperties + data, status_code, headers = api_instance.test_additional_properties_reference_with_http_info(request_body) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->test_additional_properties_reference_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_body** | [**Hash<String, Object>**](Object.md) | request body | | + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + ## test_body_with_binary > test_body_with_binary(body) diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index b5656af01aa..b26b4b23943 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -594,6 +594,72 @@ module Petstore return data, status_code, headers end + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [nil] + def test_additional_properties_reference(request_body, opts = {}) + test_additional_properties_reference_with_http_info(request_body, opts) + nil + end + + # test referenced additionalProperties + # + # @param request_body [Hash] request body + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def test_additional_properties_reference_with_http_info(request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.test_additional_properties_reference ...' + end + # verify the required parameter 'request_body' is set + if @api_client.config.client_side_validation && request_body.nil? + fail ArgumentError, "Missing the required parameter 'request_body' when calling FakeApi.test_additional_properties_reference" + end + # resource path + local_var_path = '/fake/additionalProperties-reference' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(request_body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FakeApi.test_additional_properties_reference", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#test_additional_properties_reference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # For this test, the body has to be a binary file. # @param body [File] image to upload # @param [Hash] opts the optional parameters diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts index 795071edc3c..227d1498851 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -2101,6 +2101,42 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testAdditionalPropertiesReference: async (requestBody: { [key: string]: any; }, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('testAdditionalPropertiesReference', 'requestBody', requestBody) + const localVarPath = `/fake/additionalProperties-reference`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass @@ -2745,6 +2781,19 @@ export const FakeApiFp = function(configuration?: Configuration) { const operationBasePath = operationServerMap['FakeApi.getArrayOfEnums']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testAdditionalPropertiesReference(requestBody, options); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = operationServerMap['FakeApi.testAdditionalPropertiesReference']?.[index]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); + }, /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass @@ -2967,6 +3016,16 @@ export const FakeApiFactory = function (configuration?: Configuration, basePath? getArrayOfEnums(options?: any): AxiosPromise> { return localVarFp.getArrayOfEnums(options).then((request) => request(axios, basePath)); }, + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: any): AxiosPromise { + return localVarFp.testAdditionalPropertiesReference(requestBody, options).then((request) => request(axios, basePath)); + }, /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass @@ -3171,6 +3230,18 @@ export class FakeApi extends BaseAPI { return FakeApiFp(this.configuration).getArrayOfEnums(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig) { + return FakeApiFp(this.configuration).testAdditionalPropertiesReference(requestBody, options).then((request) => request(this.axios, this.basePath)); + } + /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts index cbfc7da19ad..42f7689e610 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -1725,6 +1725,42 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testAdditionalPropertiesReference: async (requestBody: { [key: string]: any; }, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('testAdditionalPropertiesReference', 'requestBody', requestBody) + const localVarPath = `/fake/additionalProperties-reference`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass @@ -2401,6 +2437,19 @@ export const FakeApiFp = function(configuration?: Configuration) { const operationBasePath = operationServerMap['FakeApi.fakeOuterStringSerialize']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testAdditionalPropertiesReference(requestBody, options); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = operationServerMap['FakeApi.testAdditionalPropertiesReference']?.[index]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); + }, /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass @@ -2627,6 +2676,16 @@ export const FakeApiFactory = function (configuration?: Configuration, basePath? fakeOuterStringSerialize(body?: string, options?: any): AxiosPromise { return localVarFp.fakeOuterStringSerialize(body, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: any): AxiosPromise { + return localVarFp.testAdditionalPropertiesReference(requestBody, options).then((request) => request(axios, basePath)); + }, /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass @@ -2830,6 +2889,18 @@ export class FakeApi extends BaseAPI { return FakeApiFp(this.configuration).fakeOuterStringSerialize(body, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary test referenced additionalProperties + * @param {{ [key: string]: any; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testAdditionalPropertiesReference(requestBody: { [key: string]: any; }, options?: RawAxiosRequestConfig) { + return FakeApiFp(this.configuration).testAdditionalPropertiesReference(requestBody, options).then((request) => request(this.axios, this.basePath)); + } + /** * For this test, the body for this request much reference a schema named `File`. * @param {FileSchemaTestClass} fileSchemaTestClass diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts index 68ae3752e33..974f7a5ded7 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts @@ -78,6 +78,10 @@ export interface FakePropertyEnumIntegerSerializeRequest { outerObjectWithEnumProperty: OuterObjectWithEnumProperty; } +export interface TestAdditionalPropertiesReferenceRequest { + requestBody: { [key: string]: any; }; +} + export interface TestBodyWithBinaryRequest { body: Blob | null; } @@ -418,6 +422,40 @@ export class FakeApi extends runtime.BaseAPI { return await response.value(); } + /** + * + * test referenced additionalProperties + */ + async testAdditionalPropertiesReferenceRaw(requestParameters: TestAdditionalPropertiesReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) { + throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testAdditionalPropertiesReference.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request({ + path: `/fake/additionalProperties-reference`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: requestParameters.requestBody, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * + * test referenced additionalProperties + */ + async testAdditionalPropertiesReference(requestParameters: TestAdditionalPropertiesReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.testAdditionalPropertiesReferenceRaw(requestParameters, initOverrides); + } + /** * For this test, the body has to be a binary file. */ diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRef.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRef.md index 949695f4d36..cab0e7e5738 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRef.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRef.md @@ -8,6 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] **href** | **String** | Hyperlink reference | [optional] **id** | **String** | unique identifier | [optional] **atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md index 9dafa2d6b22..f88727e11aa 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md @@ -8,11 +8,16 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**href** | **String** | Hyperlink reference | [optional] **id** | **String** | unique identifier | +**barPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] +**foo** | [**FooRefOrValue**](FooRefOrValue.md) | | [optional] +**href** | **String** | Hyperlink reference | [optional] **atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] **atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] **atType** | **String** | When sub-classing, this defines the sub-class Extensible name | +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] [[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/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRef.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRef.md index 68104b22729..bfa62bd4f54 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRef.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRef.md @@ -9,6 +9,8 @@ import 'package:openapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **foorefPropA** | **String** | | [optional] +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] **href** | **String** | Hyperlink reference | [optional] **id** | **String** | unique identifier | [optional] **atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md index 35e9fd114e1..9bc8dec1057 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md @@ -8,11 +8,16 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**fooPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] **href** | **String** | Hyperlink reference | [optional] **id** | **String** | unique identifier | [optional] **atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] **atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] **atType** | **String** | When sub-classing, this defines the sub-class Extensible name | +**foorefPropA** | **String** | | [optional] +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] [[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/dart-dio/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md index e1d8434c077..4e3800773dc 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md @@ -9,6 +9,7 @@ import 'package:openapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **toppings** | **String** | | [optional] +**pizzaSize** | **num** | | [optional] **href** | **String** | Hyperlink reference | [optional] **id** | **String** | unique identifier | [optional] **atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart index 2b9d2727a44..98f0724b35d 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart @@ -12,6 +12,8 @@ part 'bar_ref.g.dart'; /// BarRef /// /// Properties: +/// * [name] - Name of the related entity. +/// * [atReferredType] - The actual type of the target instance when needed for disambiguation. /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart index 4af61384ab7..f880cb55795 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart @@ -3,6 +3,7 @@ // // ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; import 'package:openapi/src/model/bar_ref.dart'; import 'package:openapi/src/model/bar.dart'; import 'package:built_value/built_value.dart'; @@ -14,11 +15,16 @@ part 'bar_ref_or_value.g.dart'; /// BarRefOrValue /// /// Properties: -/// * [href] - Hyperlink reference /// * [id] - unique identifier +/// * [barPropA] +/// * [fooPropB] +/// * [foo] +/// * [href] - Hyperlink reference /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships /// * [atBaseType] - When sub-classing, this defines the super-class /// * [atType] - When sub-classing, this defines the sub-class Extensible name +/// * [name] - Name of the related entity. +/// * [atReferredType] - The actual type of the target instance when needed for disambiguation. @BuiltValue() abstract class BarRefOrValue implements Built { /// One Of [Bar], [BarRef] diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart index 1f77d990f0e..3f032ee8e08 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart @@ -13,6 +13,8 @@ part 'foo_ref.g.dart'; /// /// Properties: /// * [foorefPropA] +/// * [name] - Name of the related entity. +/// * [atReferredType] - The actual type of the target instance when needed for disambiguation. /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart index af3e4875d9d..d8164c5b907 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart @@ -14,11 +14,16 @@ part 'foo_ref_or_value.g.dart'; /// FooRefOrValue /// /// Properties: +/// * [fooPropA] +/// * [fooPropB] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships /// * [atBaseType] - When sub-classing, this defines the super-class /// * [atType] - When sub-classing, this defines the sub-class Extensible name +/// * [foorefPropA] +/// * [name] - Name of the related entity. +/// * [atReferredType] - The actual type of the target instance when needed for disambiguation. @BuiltValue() abstract class FooRefOrValue implements Built { /// One Of [Foo], [FooRef] diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart index 673052cc8fc..73a2295df9b 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart +++ b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart @@ -13,6 +13,7 @@ part 'pizza_speziale.g.dart'; /// /// Properties: /// * [toppings] +/// * [pizzaSize] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md index e5b72ea2f53..026fcf4caea 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md @@ -75,6 +75,7 @@ Class | Method | HTTP request | Description [*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[*FakeApi*](doc/FakeApi.md) | [**testAdditionalPropertiesReference**](doc/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [*FakeApi*](doc/FakeApi.md) | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | [*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md index 4150c48f581..d3921e831aa 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md @@ -17,6 +17,7 @@ Method | HTTP request | Description [**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 | @@ -366,6 +367,48 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final Map requestBody = Object; // Map | request body + +try { + api.testAdditionalPropertiesReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testAdditionalPropertiesReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, Object>**](Object.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **testBodyWithBinary** > testBodyWithBinary(body) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart index 8d73ba41291..01709c06c5b 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart @@ -692,6 +692,71 @@ _responseData = rawData == null ? null : deserialize> testAdditionalPropertiesReference({ + required Map requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/additionalProperties-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(requestBody); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + /// testBodyWithBinary /// For this test, the body has to be a binary file. /// diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index 0e1527c3417..b1810ac23cf 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -74,6 +74,7 @@ Class | Method | HTTP request | Description [*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[*FakeApi*](doc/FakeApi.md) | [**testAdditionalPropertiesReference**](doc/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [*FakeApi*](doc/FakeApi.md) | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | [*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md index d0ea016b30a..70492f2658c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md @@ -17,6 +17,7 @@ Method | HTTP request | Description [**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 | @@ -366,6 +367,48 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final BuiltMap requestBody = Object; // BuiltMap | request body + +try { + api.testAdditionalPropertiesReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testAdditionalPropertiesReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**BuiltMap<String, JsonObject>**](JsonObject.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **testBodyWithBinary** > testBodyWithBinary(body) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart index eeceedf3192..ff1fe20d363 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -9,6 +9,7 @@ import 'package:dio/dio.dart'; import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; import 'package:openapi/src/api_util.dart'; import 'package:openapi/src/model/child_with_nullable.dart'; import 'package:openapi/src/model/date.dart'; @@ -724,6 +725,73 @@ class FakeApi { ); } + /// test referenced additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testAdditionalPropertiesReference({ + required BuiltMap requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/additionalProperties-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(BuiltMap, [FullType(String), FullType(JsonObject)]); + _bodyData = _serializers.serialize(requestBody, specifiedType: _type); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + /// testBodyWithBinary /// For this test, the body has to be a binary file. /// diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart index 483a35e9277..98ec8cd5dfc 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart @@ -140,6 +140,10 @@ Serializers serializers = (_$serializers.toBuilder() const FullType(BuiltList, [FullType(Pet)]), () => ListBuilder(), ) + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + () => MapBuilder(), + ) ..addBuilderFactory( const FullType(BuiltMap, [FullType(String), FullType(int)]), () => MapBuilder(), diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md index 5b27fc4cd9e..9fd780b4e21 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -68,6 +68,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +*FakeApi* | [**testAdditionalPropertiesReference**](doc//FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**testBodyWithBinary**](doc//FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | *FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md index 129189d8ce1..f20a9ec0642 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md @@ -17,6 +17,7 @@ Method | HTTP request | Description [**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 | @@ -366,6 +367,48 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final requestBody = Map(); // Map | request body + +try { + api_instance.testAdditionalPropertiesReference(requestBody); +} catch (e) { + print('Exception when calling FakeApi->testAdditionalPropertiesReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map**](Object.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **testBodyWithBinary** > testBodyWithBinary(body) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index 50ff096df27..207fc6ddaf9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -440,6 +440,56 @@ class FakeApi { return null; } + /// test referenced additionalProperties + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody,) async { + // ignore: prefer_const_declarations + final path = r'/fake/additionalProperties-reference'; + + // ignore: prefer_final_locals + Object? postBody = requestBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test referenced additionalProperties + /// + /// + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testAdditionalPropertiesReference(Map requestBody,) async { + final response = await testAdditionalPropertiesReferenceWithHttpInfo(requestBody,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + /// For this test, the body has to be a binary file. /// /// Note: This method returns the HTTP [Response]. diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index d7b549125d9..209ef6366a0 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -86,6 +86,7 @@ Class | Method | HTTP request | Description *FakeAPI* | [**FakeOuterNumberSerialize**](docs/FakeAPI.md#fakeouternumberserialize) | **Post** /fake/outer/number | *FakeAPI* | [**FakeOuterStringSerialize**](docs/FakeAPI.md#fakeouterstringserialize) | **Post** /fake/outer/string | *FakeAPI* | [**GetParameterNameMapping**](docs/FakeAPI.md#getparameternamemapping) | **Get** /fake/parameter-name-mapping | parameter name mapping test +*FakeAPI* | [**TestAdditionalPropertiesReference**](docs/FakeAPI.md#testadditionalpropertiesreference) | **Post** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml index f008fd5193a..f41ffaf5079 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -906,6 +906,23 @@ paths: summary: test json serialization of form data tags: - fake + /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 /fake/inline-additionalProperties: post: description: "" @@ -1764,6 +1781,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go index c8653dc4916..afb4a610251 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go @@ -103,6 +103,19 @@ type FakeAPI interface { // GetParameterNameMappingExecute executes the request GetParameterNameMappingExecute(r ApiGetParameterNameMappingRequest) (*http.Response, error) + /* + TestAdditionalPropertiesReference test referenced additionalProperties + + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestAdditionalPropertiesReferenceRequest + */ + TestAdditionalPropertiesReference(ctx context.Context) ApiTestAdditionalPropertiesReferenceRequest + + // TestAdditionalPropertiesReferenceExecute executes the request + TestAdditionalPropertiesReferenceExecute(r ApiTestAdditionalPropertiesReferenceRequest) (*http.Response, error) + /* TestBodyWithFileSchema Method for TestBodyWithFileSchema @@ -924,6 +937,106 @@ func (a *FakeAPIService) GetParameterNameMappingExecute(r ApiGetParameterNameMap return localVarHTTPResponse, nil } +type ApiTestAdditionalPropertiesReferenceRequest struct { + ctx context.Context + ApiService FakeAPI + requestBody *map[string]interface{} +} + +// request body +func (r ApiTestAdditionalPropertiesReferenceRequest) RequestBody(requestBody map[string]interface{}) ApiTestAdditionalPropertiesReferenceRequest { + r.requestBody = &requestBody + return r +} + +func (r ApiTestAdditionalPropertiesReferenceRequest) Execute() (*http.Response, error) { + return r.ApiService.TestAdditionalPropertiesReferenceExecute(r) +} + +/* +TestAdditionalPropertiesReference test referenced additionalProperties + + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestAdditionalPropertiesReferenceRequest +*/ +func (a *FakeAPIService) TestAdditionalPropertiesReference(ctx context.Context) ApiTestAdditionalPropertiesReferenceRequest { + return ApiTestAdditionalPropertiesReferenceRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *FakeAPIService) TestAdditionalPropertiesReferenceExecute(r ApiTestAdditionalPropertiesReferenceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeAPIService.TestAdditionalPropertiesReference") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/additionalProperties-reference" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.requestBody == nil { + return nil, reportError("requestBody is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.requestBody + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + type ApiTestBodyWithFileSchemaRequest struct { ctx context.Context ApiService FakeAPI diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeAPI.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeAPI.md index 50894e0d8d1..a8b1f40e9d0 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeAPI.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeAPI.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**FakeOuterNumberSerialize**](FakeAPI.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number | [**FakeOuterStringSerialize**](FakeAPI.md#FakeOuterStringSerialize) | **Post** /fake/outer/string | [**GetParameterNameMapping**](FakeAPI.md#GetParameterNameMapping) | **Get** /fake/parameter-name-mapping | parameter name mapping test +[**TestAdditionalPropertiesReference**](FakeAPI.md#TestAdditionalPropertiesReference) | **Post** /fake/additionalProperties-reference | test referenced additionalProperties [**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 @@ -416,6 +417,70 @@ No authorization required [[Back to README]](../README.md) +## TestAdditionalPropertiesReference + +> TestAdditionalPropertiesReference(ctx).RequestBody(requestBody).Execute() + +test referenced additionalProperties + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + requestBody := map[string]interface{}{"key": interface{}(123)} // map[string]interface{} | request body + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.FakeAPI.TestAdditionalPropertiesReference(context.Background()).RequestBody(requestBody).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeAPI.TestAdditionalPropertiesReference``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestAdditionalPropertiesReferenceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | **map[string]interface{}** | request body | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## TestBodyWithFileSchema > TestBodyWithFileSchema(ctx).FileSchemaTestClass(fileSchemaTestClass).Execute() diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/README.md b/samples/openapi3/client/petstore/java/jersey2-java8/README.md index 15d325d63ac..f29fdc67461 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/README.md @@ -146,6 +146,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *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 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml index 2dcf21ae0b3..814354567b0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml @@ -937,6 +937,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1760,6 +1779,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md index 83f469863c9..55a9c935065 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | | [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | | [**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 | @@ -402,6 +403,70 @@ No authorization required | **200** | Got named array of enums | - | +## 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.model.*; +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>**| 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 | - | + + ## testBodyWithFileSchema > testBodyWithFileSchema(fileSchemaTestClass) diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index be2aa6952f0..93ac0bd8b56 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -268,6 +268,45 @@ public class FakeApi { new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, null, localVarReturnType, false); } + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testAdditionalPropertiesReference(Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody) throws ApiException { + // Check required parameters + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference"); + } + + String localVarAccept = apiClient.selectHeaderAccept(); + String localVarContentType = apiClient.selectHeaderContentType("application/json"); + return apiClient.invokeAPI("FakeApi.testAdditionalPropertiesReference", "/fake/additionalProperties-reference", "POST", new ArrayList<>(), requestBody, + new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType, + null, null, false); + } /** * * For this test, the body for this request much reference a schema named `File`. diff --git a/samples/openapi3/client/petstore/python-aiohttp/README.md b/samples/openapi3/client/petstore/python-aiohttp/README.md index 66dc3dd4d2b..152c97aa232 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-aiohttp/README.md @@ -98,6 +98,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_ref_enum_string**](docs/FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string *FakeApi* | [**fake_return_list_of_objects**](docs/FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects *FakeApi* | [**fake_uuid_example**](docs/FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +*FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md index 8a41aed5f77..18ecc40967d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md @@ -16,6 +16,7 @@ Method | HTTP request | Description [**fake_ref_enum_string**](FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string [**fake_return_list_of_objects**](FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects [**fake_uuid_example**](FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +[**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | @@ -874,6 +875,73 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_additional_properties_reference** +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Example + + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + request_body = None # Dict[str, object] | request body + + try: + # test referenced additionalProperties + await api_instance.test_additional_properties_reference(request_body) + except Exception as e: + print("Exception when calling FakeApi->test_additional_properties_reference: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**Dict[str, object]**](object.md)| request body | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_body_with_binary** > test_body_with_binary(body) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py index 1ab7a9407e1..3573e87fa70 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py @@ -3176,6 +3176,270 @@ class FakeApi: + @validate_call + async def test_additional_properties_reference( + self, + request_body: Annotated[Dict[str, Any], Field(description="request body")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """test referenced additionalProperties + + + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_additional_properties_reference_serialize( + request_body=request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def test_additional_properties_reference_with_http_info( + self, + request_body: Annotated[Dict[str, Any], Field(description="request body")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """test referenced additionalProperties + + + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_additional_properties_reference_serialize( + request_body=request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def test_additional_properties_reference_without_preload_content( + self, + request_body: Annotated[Dict[str, Any], Field(description="request body")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """test referenced additionalProperties + + + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_additional_properties_reference_serialize( + request_body=request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _test_additional_properties_reference_serialize( + self, + request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if request_body is not None: + _body_params = request_body + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/fake/additionalProperties-reference', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call async def test_body_with_binary( self, 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 260e4534708..1fce8fd01d1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md @@ -99,6 +99,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_ref_enum_string**](docs/FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string *FakeApi* | [**fake_return_list_of_objects**](docs/FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects *FakeApi* | [**fake_uuid_example**](docs/FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +*FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md index cd55f60c70e..7f9563a2ec4 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md @@ -16,6 +16,7 @@ Method | HTTP request | Description [**fake_ref_enum_string**](FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string [**fake_return_list_of_objects**](FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects [**fake_uuid_example**](FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +[**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | @@ -862,6 +863,70 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_additional_properties_reference** +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + request_body = None # Dict[str, object] | request body + + try: + # test referenced additionalProperties + await api_instance.test_additional_properties_reference(request_body) + except Exception as e: + print("Exception when calling FakeApi->test_additional_properties_reference: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**Dict[str, object]**](object.md)| request body | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_body_with_binary** > test_body_with_binary(body) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py index 61aa92e7815..39615b9e807 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py @@ -1548,6 +1548,131 @@ class FakeApi: collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + async def test_additional_properties_reference(self, request_body : Annotated[Dict[str, Any], Field(..., description="request body")], **kwargs) -> None: # noqa: E501 + """test referenced additionalProperties # noqa: E501 + + # noqa: E501 + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_additional_properties_reference_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_additional_properties_reference_with_http_info(request_body, **kwargs) # noqa: E501 + + @validate_arguments + async def test_additional_properties_reference_with_http_info(self, request_body : Annotated[Dict[str, Any], Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 + """test referenced additionalProperties # noqa: E501 + + # noqa: E501 + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'request_body' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_additional_properties_reference" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['request_body'] is not None: + _body_params = _params['request_body'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/additionalProperties-reference', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments async def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501 """test_body_with_binary # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index 10ed9cb0688..be2a4c20fcf 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -99,6 +99,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_ref_enum_string**](docs/FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string *FakeApi* | [**fake_return_list_of_objects**](docs/FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects *FakeApi* | [**fake_uuid_example**](docs/FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +*FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md index a55370f56c8..1612ebbd072 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md @@ -16,6 +16,7 @@ Method | HTTP request | Description [**fake_ref_enum_string**](FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string [**fake_return_list_of_objects**](FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects [**fake_uuid_example**](FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +[**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | @@ -862,6 +863,70 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_additional_properties_reference** +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + request_body = None # Dict[str, object] | request body + + try: + # test referenced additionalProperties + api_instance.test_additional_properties_reference(request_body) + except Exception as e: + print("Exception when calling FakeApi->test_additional_properties_reference: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**Dict[str, object]**](object.md)| request body | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_body_with_binary** > test_body_with_binary(body) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py index 291418ce5d4..debba27e4f7 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py @@ -1739,6 +1739,147 @@ class FakeApi: collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def test_additional_properties_reference(self, request_body : Annotated[Dict[str, Any], Field(..., description="request body")], **kwargs) -> None: # noqa: E501 + """test referenced additionalProperties # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_additional_properties_reference(request_body, async_req=True) + >>> result = thread.get() + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_additional_properties_reference_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_additional_properties_reference_with_http_info(request_body, **kwargs) # noqa: E501 + + @validate_arguments + def test_additional_properties_reference_with_http_info(self, request_body : Annotated[Dict[str, Any], Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 + """test referenced additionalProperties # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_additional_properties_reference_with_http_info(request_body, async_req=True) + >>> result = thread.get() + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'request_body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_additional_properties_reference" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['request_body'] is not None: + _body_params = _params['request_body'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/additionalProperties-reference', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501 """test_body_with_binary # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index fa96a49cf95..49e0f07c837 100755 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -98,6 +98,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_ref_enum_string**](docs/FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string *FakeApi* | [**fake_return_list_of_objects**](docs/FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects *FakeApi* | [**fake_uuid_example**](docs/FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +*FakeApi* | [**test_additional_properties_reference**](docs/FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties *FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index 25167ead18e..6d2a5f431dd 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -16,6 +16,7 @@ Method | HTTP request | Description [**fake_ref_enum_string**](FakeApi.md#fake_ref_enum_string) | **GET** /fake/ref_enum_string | test ref to enum string [**fake_return_list_of_objects**](FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects [**fake_uuid_example**](FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +[**test_additional_properties_reference**](FakeApi.md#test_additional_properties_reference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties [**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | @@ -874,6 +875,73 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_additional_properties_reference** +> test_additional_properties_reference(request_body) + +test referenced additionalProperties + + + +### Example + + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + request_body = None # Dict[str, object] | request body + + try: + # test referenced additionalProperties + api_instance.test_additional_properties_reference(request_body) + except Exception as e: + print("Exception when calling FakeApi->test_additional_properties_reference: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**Dict[str, object]**](object.md)| request body | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_body_with_binary** > test_body_with_binary(body) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index e58fc71034b..00f591cb36c 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -3176,6 +3176,270 @@ class FakeApi: + @validate_call + def test_additional_properties_reference( + self, + request_body: Annotated[Dict[str, Any], Field(description="request body")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """test referenced additionalProperties + + + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_additional_properties_reference_serialize( + request_body=request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def test_additional_properties_reference_with_http_info( + self, + request_body: Annotated[Dict[str, Any], Field(description="request body")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """test referenced additionalProperties + + + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_additional_properties_reference_serialize( + request_body=request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def test_additional_properties_reference_without_preload_content( + self, + request_body: Annotated[Dict[str, Any], Field(description="request body")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """test referenced additionalProperties + + + + :param request_body: request body (required) + :type request_body: Dict[str, object] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._test_additional_properties_reference_serialize( + request_body=request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _test_additional_properties_reference_serialize( + self, + request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if request_body is not None: + _body_params = request_body + + + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/fake/additionalProperties-reference', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def test_body_with_binary( self, diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java index 151f8f04441..78ae32a3fb1 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.openapitools.model.Bar; import org.openapitools.model.BarRef; +import org.openapitools.model.FooRefOrValue; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; import javax.validation.Valid; diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java index d80898c9391..b4687b46c01 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java @@ -7,8 +7,8 @@ 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 org.openapitools.model.Pizza; import java.math.BigDecimal; +import org.openapitools.model.Pizza; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; import javax.validation.Valid; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp index 7a848afb633..ae12d48df31 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp @@ -1042,6 +1042,121 @@ std::string FakePropertyEnum_intResource::extractFormParamsFromBody(const std::s } return ""; } +FakeAdditionalProperties_referenceResource::FakeAdditionalProperties_referenceResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/fake/additionalProperties-reference"); + this->set_method_handler("POST", + std::bind(&FakeAdditionalProperties_referenceResource::handler_POST_internal, this, + std::placeholders::_1)); +} + +std::pair FakeAdditionalProperties_referenceResource::handleFakeApiException(const FakeApiException& e) +{ + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair FakeAdditionalProperties_referenceResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair FakeAdditionalProperties_referenceResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void FakeAdditionalProperties_referenceResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void FakeAdditionalProperties_referenceResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, std::multimap& responseHeaders) +{ + responseHeaders.insert(std::make_pair("Connection", "close")); + session->close(status, result, responseHeaders); +} + +void FakeAdditionalProperties_referenceResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void FakeAdditionalProperties_referenceResource::handler_POST_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + // body params or form params here from the body content string + std::string bodyContent = extractBodyContent(session); + std::map requestBody; // TODO + + int status_code = 500; + std::string result = ""; + + try { + status_code = + handler_POST(requestBody); + } + catch(const FakeApiException& e) { + std::tie(status_code, result) = handleFakeApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + std::multimap< std::string, std::string > responseHeaders {}; + static const std::vector contentTypes{ + "application/json" + }; + static const std::string acceptTypes{ + "application/json, " + }; + + if (status_code == 200) { + responseHeaders.insert(std::make_pair("Content-Type", selectPreferredContentType(contentTypes))); + if (!acceptTypes.empty()) { + responseHeaders.insert(std::make_pair("Accept", acceptTypes)); + } + + returnResponse(session, 200, result.empty() ? "{}" : result, responseHeaders); + return; + } + defaultSessionClose(session, status_code, result); + + +} + + +int FakeAdditionalProperties_referenceResource::handler_POST( + std::map & requestBody) +{ + return handler_POST_func(requestBody); +} + + +std::string FakeAdditionalProperties_referenceResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} + +std::string FakeAdditionalProperties_referenceResource::extractFormParamsFromBody(const std::string& paramName, const std::string& body) { + const auto uri = restbed::Uri("urlencoded?" + body, true); + const auto params = uri.get_query_parameters(); + const auto result = params.find(paramName); + if (result != params.cend()) { + return result->second; + } + return ""; +} FakeBody_with_binaryResource::FakeBody_with_binaryResource(const std::string& context /* = "/v2" */) { this->set_path(context + "/fake/body-with-binary"); @@ -2370,6 +2485,12 @@ std::shared_ptr FakeApi::getFake } return m_spFakePropertyEnum_intResource; } +std::shared_ptr FakeApi::getFakeAdditionalProperties_referenceResource() { + if (!m_spFakeAdditionalProperties_referenceResource) { + setResource(std::make_shared()); + } + return m_spFakeAdditionalProperties_referenceResource; +} std::shared_ptr FakeApi::getFakeBody_with_binaryResource() { if (!m_spFakeBody_with_binaryResource) { setResource(std::make_shared()); @@ -2456,6 +2577,10 @@ void FakeApi::setResource(std::shared_ptrpublish(m_spFakePropertyEnum_intResource); } +void FakeApi::setResource(std::shared_ptr resource) { + m_spFakeAdditionalProperties_referenceResource = resource; + m_service->publish(m_spFakeAdditionalProperties_referenceResource); +} void FakeApi::setResource(std::shared_ptr resource) { m_spFakeBody_with_binaryResource = resource; m_service->publish(m_spFakeBody_with_binaryResource); @@ -2524,6 +2649,10 @@ void FakeApi::setFakeApiFakePropertyEnum_intResource(std::shared_ptrpublish(m_spFakePropertyEnum_intResource); } +void FakeApi::setFakeApiFakeAdditionalProperties_referenceResource(std::shared_ptr spFakeAdditionalProperties_referenceResource) { + m_spFakeAdditionalProperties_referenceResource = spFakeAdditionalProperties_referenceResource; + m_service->publish(m_spFakeAdditionalProperties_referenceResource); +} void FakeApi::setFakeApiFakeBody_with_binaryResource(std::shared_ptr spFakeBody_with_binaryResource) { m_spFakeBody_with_binaryResource = spFakeBody_with_binaryResource; m_service->publish(m_spFakeBody_with_binaryResource); @@ -2587,6 +2716,9 @@ void FakeApi::publishDefaultResources() { if (!m_spFakePropertyEnum_intResource) { setResource(std::make_shared()); } + if (!m_spFakeAdditionalProperties_referenceResource) { + setResource(std::make_shared()); + } if (!m_spFakeBody_with_binaryResource) { setResource(std::make_shared()); } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h index 8f2fa4be8e8..cce6d9bce99 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h @@ -31,6 +31,7 @@ #include #include +#include "AnyType.h" #include "ChildWithNullable.h" #include "Client.h" #include "EnumClass.h" @@ -542,6 +543,68 @@ protected: OuterObjectWithEnumProperty & outerObjectWithEnumProperty); +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + virtual std::string extractFormParamsFromBody(const std::string& paramName, const std::string& body); + + virtual std::pair handleFakeApiException(const FakeApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, std::multimap& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); + +private: + void handler_POST_internal(const std::shared_ptr session); +}; + +/// +/// test referenced additionalProperties +/// +/// +/// +/// +class FakeAdditionalProperties_referenceResource: public restbed::Resource +{ +public: + FakeAdditionalProperties_referenceResource(const std::string& context = "/v2"); + virtual ~FakeAdditionalProperties_referenceResource() = default; + + FakeAdditionalProperties_referenceResource( + const FakeAdditionalProperties_referenceResource& other) = default; // copy constructor + FakeAdditionalProperties_referenceResource(FakeAdditionalProperties_referenceResource&& other) noexcept = default; // move constructor + + FakeAdditionalProperties_referenceResource& operator=(const FakeAdditionalProperties_referenceResource& other) = default; // copy assignment + FakeAdditionalProperties_referenceResource& operator=(FakeAdditionalProperties_referenceResource&& other) noexcept = default; // move assignment + + ///////////////////////////////////////////////////// + // Set these to implement the server functionality // + ///////////////////////////////////////////////////// + std::function & requestBody)> handler_POST_func = + [](std::map &) -> int + { throw FakeApiException(501, "Not implemented"); }; + + +protected: + ////////////////////////////////////////////////////////// + // As an alternative to setting the `std::function`s // + // override these to implement the server functionality // + ////////////////////////////////////////////////////////// + + virtual int handler_POST( + std::map & requestBody); + + protected: ////////////////////////////////////// // Override these for customization // @@ -1158,6 +1221,7 @@ using FakeApiFakeOuterCompositeResource [[deprecated]] = FakeApiResources::FakeO using FakeApiFakeOuterNumberResource [[deprecated]] = FakeApiResources::FakeOuterNumberResource; using FakeApiFakeOuterStringResource [[deprecated]] = FakeApiResources::FakeOuterStringResource; using FakeApiFakePropertyEnum_intResource [[deprecated]] = FakeApiResources::FakePropertyEnum_intResource; +using FakeApiFakeAdditionalProperties_referenceResource [[deprecated]] = FakeApiResources::FakeAdditionalProperties_referenceResource; using FakeApiFakeBody_with_binaryResource [[deprecated]] = FakeApiResources::FakeBody_with_binaryResource; using FakeApiFakeBody_with_file_schemaResource [[deprecated]] = FakeApiResources::FakeBody_with_file_schemaResource; using FakeApiFakeBody_with_query_paramsResource [[deprecated]] = FakeApiResources::FakeBody_with_query_paramsResource; @@ -1185,6 +1249,7 @@ public: std::shared_ptr getFakeOuterNumberResource(); std::shared_ptr getFakeOuterStringResource(); std::shared_ptr getFakePropertyEnum_intResource(); + std::shared_ptr getFakeAdditionalProperties_referenceResource(); std::shared_ptr getFakeBody_with_binaryResource(); std::shared_ptr getFakeBody_with_file_schemaResource(); std::shared_ptr getFakeBody_with_query_paramsResource(); @@ -1203,6 +1268,7 @@ public: void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); + void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); @@ -1229,6 +1295,8 @@ public: [[deprecated("use setResource()")]] virtual void setFakeApiFakePropertyEnum_intResource(std::shared_ptr spFakeApiFakePropertyEnum_intResource); [[deprecated("use setResource()")]] + virtual void setFakeApiFakeAdditionalProperties_referenceResource(std::shared_ptr spFakeApiFakeAdditionalProperties_referenceResource); + [[deprecated("use setResource()")]] virtual void setFakeApiFakeBody_with_binaryResource(std::shared_ptr spFakeApiFakeBody_with_binaryResource); [[deprecated("use setResource()")]] virtual void setFakeApiFakeBody_with_file_schemaResource(std::shared_ptr spFakeApiFakeBody_with_file_schemaResource); @@ -1260,6 +1328,7 @@ protected: std::shared_ptr m_spFakeOuterNumberResource; std::shared_ptr m_spFakeOuterStringResource; std::shared_ptr m_spFakePropertyEnum_intResource; + std::shared_ptr m_spFakeAdditionalProperties_referenceResource; std::shared_ptr m_spFakeBody_with_binaryResource; std::shared_ptr m_spFakeBody_with_file_schemaResource; std::shared_ptr m_spFakeBody_with_query_paramsResource; diff --git a/samples/server/petstore/go-gin-api-server/go.sum b/samples/server/petstore/go-gin-api-server/go.sum index bfad1c04dee..5a6c9b3832c 100644 --- a/samples/server/petstore/go-gin-api-server/go.sum +++ b/samples/server/petstore/go-gin-api-server/go.sum @@ -1,16 +1,19 @@ github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA= github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= +github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= @@ -18,8 +21,10 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= +github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -28,18 +33,23 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= @@ -53,26 +63,37 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/samples/server/petstore/java-helidon-server/mp/README.md b/samples/server/petstore/java-helidon-server/mp/README.md index 443dc6d1341..420f8ddd67b 100644 --- a/samples/server/petstore/java-helidon-server/mp/README.md +++ b/samples/server/petstore/java-helidon-server/mp/README.md @@ -21,6 +21,7 @@ curl -X POST http://petstore.swagger.io:80/v2/outer/composite curl -X POST http://petstore.swagger.io:80/v2/outer/number curl -X POST http://petstore.swagger.io:80/v2/outer/string curl -X POST http://petstore.swagger.io:80/v2/property/enum-int +curl -X POST http://petstore.swagger.io:80/v2/additionalProperties-reference curl -X PUT http://petstore.swagger.io:80/v2/body-with-binary curl -X PUT http://petstore.swagger.io:80/v2/body-with-file-schema curl -X PUT http://petstore.swagger.io:80/v2/body-with-query-params diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java index 3a4f094c8a6..320ff2d6350 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java @@ -87,6 +87,11 @@ public interface FakeService { @Produces({ "*/*" }) OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty); + @POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + void testAdditionalPropertiesReference(@Valid @NotNull Map requestBody); + @PUT @Path("/body-with-binary") @Consumes({ "image/png" }) diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java index 93c2e32bc75..a9b10d16ad8 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java @@ -110,6 +110,12 @@ public class FakeServiceImpl implements FakeService { return result; } + @POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + public void testAdditionalPropertiesReference(@Valid @NotNull Map requestBody) { + } + @PUT @Path("/body-with-binary") @Consumes({ "image/png" }) diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml index efc990069c1..ee46890b2b5 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/server/petstore/java-helidon-server/se/README.md b/samples/server/petstore/java-helidon-server/se/README.md index 182694aed7a..9d1d931646d 100644 --- a/samples/server/petstore/java-helidon-server/se/README.md +++ b/samples/server/petstore/java-helidon-server/se/README.md @@ -21,6 +21,7 @@ curl -X POST http://petstore.swagger.io:80/v2/fake/outer/composite curl -X POST http://petstore.swagger.io:80/v2/fake/outer/number curl -X POST http://petstore.swagger.io:80/v2/fake/outer/string curl -X POST http://petstore.swagger.io:80/v2/fake/property/enum-int +curl -X POST http://petstore.swagger.io:80/v2/fake/additionalProperties-reference curl -X PUT http://petstore.swagger.io:80/v2/fake/body-with-binary curl -X PUT http://petstore.swagger.io:80/v2/fake/body-with-file-schema curl -X PUT http://petstore.swagger.io:80/v2/fake/body-with-query-params diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java index 5b20a7daaf8..320cfd74d39 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java @@ -41,6 +41,7 @@ public interface FakeService extends Service { rules.post("/fake/outer/number", this::fakeOuterNumberSerialize); rules.post("/fake/outer/string", this::fakeOuterStringSerialize); rules.post("/fake/property/enum-int", Handler.create(OuterObjectWithEnumProperty.class, this::fakePropertyEnumIntegerSerialize)); + rules.post("/fake/additionalProperties-reference", this::testAdditionalPropertiesReference); rules.put("/fake/body-with-binary", this::testBodyWithBinary); rules.put("/fake/body-with-file-schema", Handler.create(FileSchemaTestClass.class, this::testBodyWithFileSchema)); rules.put("/fake/body-with-query-params", Handler.create(User.class, this::testBodyWithQueryParams)); @@ -115,6 +116,13 @@ public interface FakeService extends Service { */ void fakePropertyEnumIntegerSerialize(ServerRequest request, ServerResponse response, OuterObjectWithEnumProperty outerObjectWithEnumProperty); + /** + * POST /fake/additionalProperties-reference : test referenced additionalProperties. + * @param request the server request + * @param response the server response + */ + void testAdditionalPropertiesReference(ServerRequest request, ServerResponse response); + /** * PUT /fake/body-with-binary. * @param request the server request diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java index bed72a65934..b92126a893a 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java @@ -63,6 +63,10 @@ public class FakeServiceImpl implements FakeService { response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); } + public void testAdditionalPropertiesReference(ServerRequest request, ServerResponse response) { + response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); + } + public void testBodyWithBinary(ServerRequest request, ServerResponse response) { response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); } diff --git a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml index efc990069c1..ee46890b2b5 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml @@ -1010,6 +1010,25 @@ paths: - 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/inline-additionalProperties: post: description: "" @@ -1851,6 +1870,10 @@ components: type: string type: array type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object OuterEnum: enum: - placed diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java index 6f54b825261..e8ad376c9e0 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java @@ -167,6 +167,18 @@ public class FakeApi { throws NotFoundException { return delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, securityContext); } + @javax.ws.rs.POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + + @io.swagger.annotations.ApiOperation(value = "test referenced additionalProperties", notes = "", response = Void.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testAdditionalPropertiesReference(@ApiParam(value = "request body", required = true) @NotNull @Valid Map requestBody,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testAdditionalPropertiesReference(requestBody, securityContext); + } @javax.ws.rs.PUT @Path("/body-with-binary") @Consumes({ "image/png" }) diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java index 0da19567ccf..027b1d38e1c 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java @@ -40,6 +40,7 @@ public abstract class FakeApiService { public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,SecurityContext securityContext) throws NotFoundException; + public abstract Response testAdditionalPropertiesReference(Map requestBody,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithBinary(File body,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithQueryParams( @NotNull String query,User user,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java index d04b4ddd018..7c4cfb0c4aa 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -72,6 +72,11 @@ public class FakeApiServiceImpl extends FakeApiService { return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override + public Response testAdditionalPropertiesReference(Map requestBody, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override public Response testBodyWithBinary(File body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java index 53a95a9931b..17fd4690a99 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java @@ -175,6 +175,18 @@ public class FakeApi { return delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, securityContext); } + @jakarta.ws.rs.POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + @Operation(summary = "test referenced additionalProperties", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testAdditionalPropertiesReference(@Schema(description = "request body", required = true) @NotNull @Valid Map requestBody,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testAdditionalPropertiesReference(requestBody, securityContext); + } + @jakarta.ws.rs.PUT @Path("/body-with-binary") @Consumes({ "image/png" }) diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java index e7e7016bf65..f267dd5ff68 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java @@ -40,6 +40,7 @@ public abstract class FakeApiService { public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,SecurityContext securityContext) throws NotFoundException; + public abstract Response testAdditionalPropertiesReference(Map requestBody,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithBinary(File body,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,SecurityContext securityContext) throws NotFoundException; public abstract Response testBodyWithQueryParams( @NotNull String query,User user,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java index 904a1cf0375..a743e03067f 100644 --- a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -72,6 +72,11 @@ public class FakeApiServiceImpl extends FakeApiService { return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override + public Response testAdditionalPropertiesReference(Map requestBody, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override public Response testBodyWithBinary(File body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php index 274d5c8d24c..39ba64eab6c 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php @@ -249,6 +249,30 @@ class FakeController extends Controller return response('How about implementing fakeBigDecimalMap as a get method ?'); } + /** + * Operation testAdditionalPropertiesReference + * + * test referenced additionalProperties. + * + * + * @return Http response + */ + public function testAdditionalPropertiesReference() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + if (!isset($input['requestBody'])) { + throw new \InvalidArgumentException('Missing the required parameter $requestBody when calling testAdditionalPropertiesReference'); + } + $requestBody = $input['requestBody']; + + + return response('How about implementing testAdditionalPropertiesReference as a post method ?'); + } /** * Operation testBodyWithBinary * diff --git a/samples/server/petstore/php-laravel/lib/routes/api.php b/samples/server/petstore/php-laravel/lib/routes/api.php index 421e91bff1b..6dfbb686cec 100644 --- a/samples/server/petstore/php-laravel/lib/routes/api.php +++ b/samples/server/petstore/php-laravel/lib/routes/api.php @@ -70,6 +70,13 @@ Route::delete('/v2/fake', 'FakeController@testGroupParameters'); * Output-Formats: [*_/_*] */ Route::get('/v2/fake/BigDecimalMap', 'FakeController@fakeBigDecimalMap'); +/** + * post testAdditionalPropertiesReference + * Summary: test referenced additionalProperties + * Notes: + + */ +Route::post('/v2/fake/additionalProperties-reference', 'FakeController@testAdditionalPropertiesReference'); /** * put testBodyWithBinary * Summary: diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php index 44c5191fc3d..f1e0ec001d6 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php @@ -245,6 +245,30 @@ class FakeApi extends Controller return response('How about implementing fakeBigDecimalMap as a get method ?'); } + /** + * Operation testAdditionalPropertiesReference + * + * test referenced additionalProperties. + * + * + * @return Http response + */ + public function testAdditionalPropertiesReference() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + if (!isset($input['request_body'])) { + throw new \InvalidArgumentException('Missing the required parameter $request_body when calling testAdditionalPropertiesReference'); + } + $request_body = $input['request_body']; + + + return response('How about implementing testAdditionalPropertiesReference as a post method ?'); + } /** * Operation testBodyWithBinary * diff --git a/samples/server/petstore/php-lumen/lib/routes/web.php b/samples/server/petstore/php-lumen/lib/routes/web.php index 36105116319..59762b6f381 100644 --- a/samples/server/petstore/php-lumen/lib/routes/web.php +++ b/samples/server/petstore/php-lumen/lib/routes/web.php @@ -86,6 +86,13 @@ $router->delete('/v2/fake', 'FakeApi@testGroupParameters'); */ $router->get('/v2/fake/BigDecimalMap', 'FakeApi@fakeBigDecimalMap'); +/** + * post testAdditionalPropertiesReference + * Summary: test referenced additionalProperties + * Notes: + */ +$router->post('/v2/fake/additionalProperties-reference', 'FakeApi@testAdditionalPropertiesReference'); + /** * put testBodyWithBinary * Summary: