diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index d77ebe3e548..97d040fc95c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -90,10 +90,34 @@ public class InlineModelResolver { } for (Map.Entry pathsEntry : paths.entrySet()) { - String pathname = pathsEntry.getKey(); PathItem path = pathsEntry.getValue(); List operations = new ArrayList<>(path.readOperations()); + // use path name (e.g. /foo/bar) and HTTP verb to come up with a name + // in case operationId is not defined later in other methods + String pathname = pathsEntry.getKey(); + String name = pathname; + if (path.getDelete() != null) { + name = pathname + "_delete"; + } else if (path.getGet() != null) { + name = pathname + "_get"; + } else if (path.getHead() != null) { + name = pathname + "_head"; + } else if (path.getOptions() != null) { + name = pathname + "_options"; + } else if (path.getPatch() != null) { + name = pathname + "_patch"; + } else if (path.getPost() != null) { + name = pathname + "_post"; + } else if (path.getPut() != null) { + name = pathname + "_put"; + } else if (path.getTrace() != null) { + name = pathname + "_trace"; + } else { + // no HTTP verb defined? + //throw new RuntimeException("No HTTP verb found/detected in the inline model resolver"); + } + // Include callback operation as well for (Operation operation : path.readOperations()) { Map callbacks = operation.getCallbacks(); @@ -106,9 +130,9 @@ public class InlineModelResolver { } for (Operation operation : operations) { - flattenRequestBody(pathname, operation); - flattenParameters(pathname, operation); - flattenResponses(pathname, operation); + flattenRequestBody(name, operation); + flattenParameters(name, operation); + flattenResponses(name, operation); } } } @@ -206,7 +230,7 @@ public class InlineModelResolver { if (schema.getAdditionalProperties() != null) { if (schema.getAdditionalProperties() instanceof Schema) { Schema inner = (Schema) schema.getAdditionalProperties(); - String schemaName = resolveModelName(schema.getTitle(), modelPrefix + "_" + "_value"); + String schemaName = resolveModelName(schema.getTitle(), modelPrefix + "_value"); // Recurse to create $refs for inner models gatherInlineModels(inner, schemaName); if (isModelNeeded(inner)) { @@ -362,10 +386,10 @@ public class InlineModelResolver { /** * Flatten inline models in RequestBody * - * @param pathname target pathname + * @param modelName inline model name prefix * @param operation target operation */ - private void flattenRequestBody(String pathname, Operation operation) { + private void flattenRequestBody(String modelName, Operation operation) { RequestBody requestBody = operation.getRequestBody(); if (requestBody == null) { return; @@ -377,8 +401,8 @@ public class InlineModelResolver { requestBody = openAPI.getComponents().getRequestBodies().get(ref); } - String name = operation.getOperationId() == null ? "inline_request" : operation.getOperationId() + "_request"; - flattenContent(requestBody.getContent(), name); + flattenContent(requestBody.getContent(), + (operation.getOperationId() == null ? modelName : operation.getOperationId()) + "_request"); } /** @@ -438,10 +462,10 @@ public class InlineModelResolver { /** * Flatten inline models in ApiResponses * - * @param pathname target pathname + * @param modelName model name prefix * @param operation target operation */ - private void flattenResponses(String pathname, Operation operation) { + private void flattenResponses(String modelName, Operation operation) { ApiResponses responses = operation.getResponses(); if (responses == null) { return; @@ -450,78 +474,9 @@ public class InlineModelResolver { for (Map.Entry responsesEntry : responses.entrySet()) { String key = responsesEntry.getKey(); ApiResponse response = responsesEntry.getValue(); - if (ModelUtils.getSchemaFromResponse(response) == null) { - continue; - } - Schema property = ModelUtils.getSchemaFromResponse(response); - if (property instanceof ObjectSchema) { - ObjectSchema op = (ObjectSchema) property; - if (op.getProperties() != null && op.getProperties().size() > 0) { - String modelName = resolveModelName(op.getTitle(), "inline_response_" + key); - Schema model = modelFromProperty(openAPI, op, modelName); - String existing = matchGenerated(model); - Content content = response.getContent(); - for (MediaType mediaType : content.values()) { - if (existing != null) { - Schema schema = this.makeSchema(existing, property); - schema.setRequired(op.getRequired()); - mediaType.setSchema(schema); - } else { - modelName = addSchemas(modelName, model); - Schema schema = this.makeSchema(modelName, property); - schema.setRequired(op.getRequired()); - mediaType.setSchema(schema); - } - } - } - } else if (property instanceof ArraySchema) { - ArraySchema ap = (ArraySchema) property; - Schema inner = ap.getItems(); - if (inner instanceof ObjectSchema) { - ObjectSchema op = (ObjectSchema) inner; - if (op.getProperties() != null && op.getProperties().size() > 0) { - flattenProperties(openAPI, op.getProperties(), pathname); - String modelName = resolveModelName(op.getTitle(), - "inline_response_" + key); - Schema innerModel = modelFromProperty(openAPI, op, modelName); - String existing = matchGenerated(innerModel); - if (existing != null) { - Schema schema = this.makeSchema(existing, op); - schema.setRequired(op.getRequired()); - ap.setItems(schema); - } else { - modelName = addSchemas(modelName, innerModel); - Schema schema = this.makeSchema(modelName, op); - schema.setRequired(op.getRequired()); - ap.setItems(schema); - } - } - } - } else if (property instanceof MapSchema) { - MapSchema mp = (MapSchema) property; - Schema innerProperty = ModelUtils.getAdditionalProperties(openAPI, mp); - if (innerProperty instanceof ObjectSchema) { - ObjectSchema op = (ObjectSchema) innerProperty; - if (op.getProperties() != null && op.getProperties().size() > 0) { - flattenProperties(openAPI, op.getProperties(), pathname); - String modelName = resolveModelName(op.getTitle(), - "inline_response_" + key); - Schema innerModel = modelFromProperty(openAPI, op, modelName); - String existing = matchGenerated(innerModel); - if (existing != null) { - Schema schema = new Schema().$ref(existing); - schema.setRequired(op.getRequired()); - mp.setAdditionalProperties(schema); - } else { - modelName = addSchemas(modelName, innerModel); - Schema schema = new Schema().$ref(modelName); - schema.setRequired(op.getRequired()); - mp.setAdditionalProperties(schema); - } - } - } - } + flattenContent(response.getContent(), + (operation.getOperationId() == null ? modelName : operation.getOperationId()) + "_" + key + "_response"); } } @@ -608,12 +563,7 @@ public class InlineModelResolver { flattenComposedChildren(modelName + "_anyOf", m.getAnyOf()); flattenComposedChildren(modelName + "_oneOf", m.getOneOf()); } else if (model instanceof Schema) { - //Schema m = model; - //Map properties = m.getProperties(); - //flattenProperties(openAPI, properties, modelName); - //fixStringModel(m); gatherInlineModels(model, modelName); - } /*else if (ModelUtils.isArraySchema(model)) { ArraySchema m = (ArraySchema) model; Schema inner = m.getItems(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 412b7b95a32..e1b55ebd356 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -2356,6 +2356,7 @@ public class DefaultCodegenTest { .get("application/json") .getSchema()); Assert.assertEquals(s.getExtensions().get("x-one-of-name"), "CreateStateRequest"); + Assert.assertEquals( openAPI.getPaths() .get("/state") @@ -2364,11 +2365,13 @@ public class DefaultCodegenTest { .get("200") .getContent() .get("application/json") - .getSchema() - .getExtensions() - .get("x-one-of-name"), - "GetState200" + .getSchema().get$ref(), + "#/components/schemas/getState_200_response" ); + Schema getState200 = openAPI.getComponents().getSchemas().get("getState_200_response"); + //Assert.assertEquals(getState200, ""); + Assert.assertEquals(getState200.getExtensions().get("x-one-of-name"), "GetState200Response"); + // for the array schema, assert that a oneOf interface was added to schema map Schema items = ((ArraySchema) openAPI.getComponents().getSchemas().get("CustomOneOfArraySchema")).getItems(); Assert.assertEquals(items.get$ref(), "#/components/schemas/CustomOneOfArraySchema_inner"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java index 7523f638ff9..3ccca38b480 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java @@ -269,7 +269,7 @@ public class InlineModelResolverTest { OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/6150_model_json_inline.yaml"); new InlineModelResolver().flatten(openAPI); - Schema InlineResponse200 = openAPI.getComponents().getSchemas().get("inline_response_200"); + Schema InlineResponse200 = openAPI.getComponents().getSchemas().get("testOperation_200_response"); assertEquals("object", InlineResponse200.getType()); assertEquals("unknown", InlineResponse200.getFormat()); Schema FooBarObject = openAPI.getComponents().getSchemas().get("FooBarObject"); @@ -475,7 +475,7 @@ public class InlineModelResolverTest { assertTrue(mediaType.getSchema() instanceof ArraySchema); ArraySchema responseSchema = (ArraySchema) mediaType.getSchema(); - assertEquals("#/components/schemas/inline_response_200", responseSchema.getItems().get$ref()); + assertEquals("#/components/schemas/resolveInlineArrayResponse_200_response_inner", responseSchema.getItems().get$ref()); Schema items = ModelUtils.getReferencedSchema(openAPI, responseSchema.getItems()); assertTrue(items.getProperties().get("array_response_property") instanceof StringSchema); @@ -566,13 +566,13 @@ public class InlineModelResolverTest { Schema additionalProperties = (Schema) mediaType.getSchema().getAdditionalProperties(); assertNotNull(additionalProperties.get$ref()); - assertTrue(additionalProperties.get$ref().startsWith("#/components/schemas/inline_response_")); + assertEquals("#/components/schemas/resolveInlineMapSchemaInResponse_200_response_value", additionalProperties.get$ref()); Schema referencedSchema = ModelUtils.getReferencedSchema(openAPI, additionalProperties); Schema referencedSchemaProperty = (Schema) referencedSchema.getProperties().get("resolve_inline_map_schema_in_response_property"); assertEquals( - "#/components/schemas/_resolve_inline_map_schema_in_response_resolve_inline_map_schema_in_response_property", + "#/components/schemas/resolveInlineMapSchemaInResponse_200_response_value_resolve_inline_map_schema_in_response_property", referencedSchemaProperty.get$ref() ); assertNotNull(ModelUtils.getReferencedSchema(openAPI, referencedSchemaProperty)); 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 34ae163b2c2..2a98bbd15c0 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 @@ -517,8 +517,8 @@ public class SpringCodegenTest { generator.opts(input).generate(); JavaFileAssert.assertThat(Paths.get(outputPath + "/src/main/java/org/openapitools/api/ExampleApi.java")) - .assertMethod("exampleApiPost", "InlineRequest") - .hasParameter("inlineRequest") + .assertMethod("exampleApiPost", "ExampleApiPostRequest") + .hasParameter("exampleApiPostRequest") .assertParameterAnnotations() .containsWithNameAndAttributes("RequestBody", ImmutableMap.of("required", "false")); @@ -950,7 +950,7 @@ public class SpringCodegenTest { } @Test - public void oneOf_5381() throws IOException { + public void testOneOf5381() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); String outputPath = output.getAbsolutePath().replace('\\', '/'); @@ -988,7 +988,7 @@ public class SpringCodegenTest { } @Test - public void oneOf_allOf() throws IOException { + public void testOneOfAndAllOf() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); String outputPath = output.getAbsolutePath().replace('\\', '/'); @@ -1007,7 +1007,7 @@ public class SpringCodegenTest { DefaultGenerator generator = new DefaultGenerator(); codegen.setHateoas(true); generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); -// generator.setGeneratorPropertyDefault(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, "true"); + //generator.setGeneratorPropertyDefault(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, "true"); generator.setGeneratorPropertyDefault(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "false"); codegen.setUseOneOfInterfaces(true); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/SharedTypeScriptTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/SharedTypeScriptTest.java index 4d3913862e8..07f7943b3cf 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/SharedTypeScriptTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/SharedTypeScriptTest.java @@ -47,9 +47,9 @@ public class SharedTypeScriptTest { private void checkAPIFile(List files, String apiFileName) throws IOException { File apiFile = files.stream().filter(file->file.getName().contains(apiFileName)).findFirst().get(); String apiFileContent = FileUtils.readFileToString(apiFile, StandardCharsets.UTF_8); - Assert.assertTrue(!apiFileContent.contains("import { OrganizationWrapper | PersonWrapper }")); + Assert.assertTrue(!apiFileContent.contains("import { GetCustomer200Response | PersonWrapper }")); Assert.assertEquals(StringUtils.countMatches(apiFileContent,"import { PersonWrapper }"),1); - Assert.assertEquals(StringUtils.countMatches(apiFileContent,"import { OrganizationWrapper }"),1); + Assert.assertEquals(StringUtils.countMatches(apiFileContent,"import { GetCustomer200Response }"),1); } @Test diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/TypeScriptClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/TypeScriptClientCodegenTest.java index 8f87c99cb60..f5d75cc8a34 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/TypeScriptClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/TypeScriptClientCodegenTest.java @@ -56,7 +56,7 @@ public class TypeScriptClientCodegenTest { // TODO revise the commented test below as oneOf is no longer defined inline //but instead defined using $ref with the new inline model resolver in 6.x //Assert.assertEquals(operation.imports, Sets.newHashSet("Cat", "Dog")); - Assert.assertEquals(operation.imports, Sets.newHashSet("InlineRequest")); + Assert.assertEquals(operation.imports, Sets.newHashSet("PetsPatchRequest")); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java index 6251a400aeb..6ef8d716e80 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/ModelUtilsTest.java @@ -56,11 +56,12 @@ public class ModelUtilsTest { "SomeObj15", "SomeMapObj16", "MapItem16", + "p17_200_response", "SomeObj17", "SomeObj18", "Common18", "SomeObj18_allOf", - "inline_request", + "_some_p19_patch_request", "Obj19ByAge", "Obj19ByType", "SomeObj20", @@ -217,11 +218,11 @@ public class ModelUtilsTest { } @Test - public void testAliasedTypeIsNotUnaliasedIfUsedForImportMapping(){ + public void testAliasedTypeIsNotUnaliasedIfUsedForImportMapping() { Schema emailSchema = new Schema().$ref("#/components/schemas/Email").type("string"); StringSchema stringSchema = new StringSchema(); HashMap importMappings = new HashMap<>(); - importMappings.put("Email","foo.bar.Email"); + importMappings.put("Email", "foo.bar.Email"); OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("Email", stringSchema); diff --git a/modules/openapi-generator/src/test/resources/2_0/issue_9086_expected.yaml b/modules/openapi-generator/src/test/resources/2_0/issue_9086_expected.yaml index cce682ee053..120df701d7c 100644 --- a/modules/openapi-generator/src/test/resources/2_0/issue_9086_expected.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/issue_9086_expected.yaml @@ -1,40 +1,44 @@ openapi: 3.0.1 info: - title: 'Buggy Api' - version: '1.0' + title: Buggy Api + version: "1.0" +servers: + - url: / paths: /foo/bar: post: responses: - '200': - description: ok + "200": content: '*/*': schema: - $ref: '#/components/schemas/inline_response_200' - + $ref: '#/components/schemas/_foo_bar_post_200_response' + description: ok /foo/bar2: post: responses: - '200': - description: ok + "200": content: '*/*': schema: $ref: '#/components/schemas/bar2' + description: ok components: schemas: bar2: - type: object - example: { n: 4.56 } + example: + "n": 4.56 properties: - n: - type: number + "n": example: 4.56 - inline_response_200: - type: object - example: { n: 1.23 } - properties: - n: type: number + type: object + _foo_bar_post_200_response: + example: + "n": 1.23 + properties: + "n": example: 1.23 + type: number + type: object +x-original-swagger-version: "2.0" \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml b/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml index a97ed080fcf..97bf4bb663f 100644 --- a/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml @@ -17,11 +17,13 @@ paths: oneOf: - $ref: '#/components/schemas/ObjA' - $ref: '#/components/schemas/ObjB' + - $ref: '#/components/schemas/ObjD' discriminator: propertyName: realtype mapping: a-type: '#/components/schemas/ObjA' b-type: '#/components/schemas/ObjB' + b-type: '#/components/schemas/ObjD' post: operationId: createState requestBody: @@ -87,4 +89,11 @@ components: realtype: type: string state: + type: string + ObjD: + type: object + properties: + realtype: + type: string + color: type: string \ No newline at end of file diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES index 72c57beb6cf..4636f1cc227 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES @@ -37,6 +37,7 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -44,7 +45,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/List.md docs/Mammal.md @@ -144,6 +144,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -151,7 +152,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md index 7c9507fb610..3976379da17 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md @@ -178,6 +178,7 @@ Class | Method | HTTP request | Description - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.Foo](docs/Foo.md) + - [Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.Fruit](docs/Fruit.md) - [Model.FruitReq](docs/FruitReq.md) @@ -185,7 +186,6 @@ Class | Method | HTTP request | Description - [Model.GrandparentAnimal](docs/GrandparentAnimal.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HealthCheckResult](docs/HealthCheckResult.md) - - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) - [Model.Mammal](docs/Mammal.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/DefaultApi.md index 6f5de6b6851..e966d3bef49 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..dde9b9729b9 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs index af9619134ea..ff7ce75367b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -31,8 +31,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - InlineResponseDefault FooGet(int operationIndex = 0); + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(int operationIndex = 0); /// /// @@ -42,8 +42,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - ApiResponse FooGetWithHttpInfo(int operationIndex = 0); + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(int operationIndex = 0); #endregion Synchronous Operations } @@ -62,8 +62,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -74,8 +74,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -201,10 +201,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - public InlineResponseDefault FooGet(int operationIndex = 0) + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet(int operationIndex = 0) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); return localVarResponse.Data; } @@ -213,8 +213,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -244,7 +244,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); @@ -263,10 +263,10 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } @@ -276,8 +276,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..121fba3414f --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,154 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + [DataContract(Name = "_foo_get_default_response")] + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public FooGetDefaultResponse(Foo _string = default(Foo)) + { + this._String = _string; + if (this.String != null) + { + this._flagString = true; + } + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets String + /// + [DataMember(Name = "string", EmitDefaultValue = false)] + public Foo String + { + get{ return _String;} + set + { + _String = value; + _flagString = true; + } + } + private Foo _String; + private bool _flagString; + + /// + /// Returns false as String should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeString() + { + return _flagString; + } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES index e19a38918ec..9a99c9d18bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES @@ -40,6 +40,7 @@ docs/models/EquilateralTriangle.md docs/models/File.md docs/models/FileSchemaTestClass.md docs/models/Foo.md +docs/models/FooGetDefaultResponse.md docs/models/FormatTest.md docs/models/Fruit.md docs/models/FruitReq.md @@ -47,7 +48,6 @@ docs/models/GmFruit.md docs/models/GrandparentAnimal.md docs/models/HasOnlyReadOnly.md docs/models/HealthCheckResult.md -docs/models/InlineResponseDefault.md docs/models/IsoscelesTriangle.md docs/models/List.md docs/models/Mammal.md @@ -146,6 +146,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -153,7 +154,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/DefaultApi.md index 345af7fa914..66361e2693e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/FooGetDefaultResponse.md new file mode 100644 index 00000000000..47e50daca3e --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs index e24605070a9..4053933356e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -36,8 +36,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task<ApiResponse<InlineResponseDefault?>> - Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null); + /// Task<ApiResponse<FooGetDefaultResponse?>> + Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null); /// /// @@ -47,8 +47,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of ApiResponse<InlineResponseDefault> - Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null); + /// Task of ApiResponse<FooGetDefaultResponse> + Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null); /// /// @@ -57,8 +57,8 @@ namespace Org.OpenAPITools.Api /// /// /// Cancellation Token to cancel the request. - /// Task of ApiResponse<InlineResponseDefault?> - Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null); + /// Task of ApiResponse<FooGetDefaultResponse?> + Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null); } @@ -136,10 +136,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> - public async Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> + public async Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null) { - ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); if (result.Content == null) throw new ApiException(result.ReasonPhrase, result.StatusCode, result.RawContent); @@ -152,10 +152,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> - public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> + public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null) { - ApiResponse? result = null; + ApiResponse? result = null; try { result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); @@ -174,8 +174,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> where T : - public async Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> where T : + public async Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null) { try { @@ -217,10 +217,10 @@ namespace Org.OpenAPITools.Api } } - ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Content = JsonSerializer.Deserialize(apiResponse.RawContent, _jsonSerializerOptions); + apiResponse.Content = JsonSerializer.Deserialize(apiResponse.RawContent, _jsonSerializerOptions); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..5cd966c64a6 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,121 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string + public FooGetDefaultResponse(Foo? _string = default) + { + String = _string; + } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public Foo? String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES index e19a38918ec..9a99c9d18bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES @@ -40,6 +40,7 @@ docs/models/EquilateralTriangle.md docs/models/File.md docs/models/FileSchemaTestClass.md docs/models/Foo.md +docs/models/FooGetDefaultResponse.md docs/models/FormatTest.md docs/models/Fruit.md docs/models/FruitReq.md @@ -47,7 +48,6 @@ docs/models/GmFruit.md docs/models/GrandparentAnimal.md docs/models/HasOnlyReadOnly.md docs/models/HealthCheckResult.md -docs/models/InlineResponseDefault.md docs/models/IsoscelesTriangle.md docs/models/List.md docs/models/Mammal.md @@ -146,6 +146,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -153,7 +154,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/DefaultApi.md index 345af7fa914..66361e2693e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/FooGetDefaultResponse.md new file mode 100644 index 00000000000..47e50daca3e --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs index 33dbb5aeebc..298db3820bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -34,8 +34,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task<ApiResponse<InlineResponseDefault>> - Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null); + /// Task<ApiResponse<FooGetDefaultResponse>> + Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null); /// /// @@ -45,8 +45,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of ApiResponse<InlineResponseDefault> - Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null); } + /// Task of ApiResponse<FooGetDefaultResponse> + Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null); } /// /// Represents a collection of functions to interact with the API endpoints @@ -122,10 +122,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> - public async Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> + public async Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null) { - ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); if (result.Content == null) throw new ApiException(result.ReasonPhrase, result.StatusCode, result.RawContent); @@ -138,10 +138,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> - public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> + public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null) { - ApiResponse result = null; + ApiResponse result = null; try { result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); @@ -160,8 +160,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> where T : - public async Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> where T : + public async Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null) { try { @@ -203,10 +203,10 @@ namespace Org.OpenAPITools.Api } } - ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Content = JsonSerializer.Deserialize(apiResponse.RawContent, _jsonSerializerOptions); + apiResponse.Content = JsonSerializer.Deserialize(apiResponse.RawContent, _jsonSerializerOptions); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..e32cb9257e5 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,119 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string + public FooGetDefaultResponse(Foo _string = default) + { + String = _string; + } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public Foo String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES index e19a38918ec..9a99c9d18bc 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES @@ -40,6 +40,7 @@ docs/models/EquilateralTriangle.md docs/models/File.md docs/models/FileSchemaTestClass.md docs/models/Foo.md +docs/models/FooGetDefaultResponse.md docs/models/FormatTest.md docs/models/Fruit.md docs/models/FruitReq.md @@ -47,7 +48,6 @@ docs/models/GmFruit.md docs/models/GrandparentAnimal.md docs/models/HasOnlyReadOnly.md docs/models/HealthCheckResult.md -docs/models/InlineResponseDefault.md docs/models/IsoscelesTriangle.md docs/models/List.md docs/models/Mammal.md @@ -146,6 +146,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -153,7 +154,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/DefaultApi.md index 345af7fa914..66361e2693e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/FooGetDefaultResponse.md new file mode 100644 index 00000000000..47e50daca3e --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs index f7675836cf0..914b104ae8c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -34,8 +34,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task<ApiResponse<InlineResponseDefault>> - Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null); + /// Task<ApiResponse<FooGetDefaultResponse>> + Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null); /// /// @@ -45,8 +45,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of ApiResponse<InlineResponseDefault> - Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null); } + /// Task of ApiResponse<FooGetDefaultResponse> + Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null); } /// /// Represents a collection of functions to interact with the API endpoints @@ -122,10 +122,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> - public async Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> + public async Task FooGetAsync(System.Threading.CancellationToken? cancellationToken = null) { - ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + ApiResponse result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); if (result.Content == null) throw new ApiException(result.ReasonPhrase, result.StatusCode, result.RawContent); @@ -138,10 +138,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> - public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> + public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken? cancellationToken = null) { - ApiResponse result = null; + ApiResponse result = null; try { result = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); @@ -160,8 +160,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// <> where T : - public async Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null) + /// <> where T : + public async Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken? cancellationToken = null) { try { @@ -203,10 +203,10 @@ namespace Org.OpenAPITools.Api } } - ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); + ApiResponse apiResponse = new ApiResponse(responseMessage, responseContent); if (apiResponse.IsSuccessStatusCode) - apiResponse.Content = JsonSerializer.Deserialize(apiResponse.RawContent, _jsonSerializerOptions); + apiResponse.Content = JsonSerializer.Deserialize(apiResponse.RawContent, _jsonSerializerOptions); return apiResponse; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..e32cb9257e5 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,119 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string + public FooGetDefaultResponse(Foo _string = default) + { + String = _string; + } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public Foo String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; set; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES index b43cb6126ec..3b9f8295454 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/.openapi-generator/FILES @@ -37,6 +37,7 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -44,7 +45,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/List.md docs/Mammal.md @@ -144,6 +144,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -151,7 +152,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md index 336d0b69ce0..842d37e4bb0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md @@ -203,6 +203,7 @@ Class | Method | HTTP request | Description - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.Foo](docs/Foo.md) + - [Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.Fruit](docs/Fruit.md) - [Model.FruitReq](docs/FruitReq.md) @@ -210,7 +211,6 @@ Class | Method | HTTP request | Description - [Model.GrandparentAnimal](docs/GrandparentAnimal.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HealthCheckResult](docs/HealthCheckResult.md) - - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) - [Model.Mammal](docs/Mammal.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/DefaultApi.md index ec724183283..b991ca1ec5d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -37,7 +37,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -56,7 +56,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..dde9b9729b9 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs index 98522225025..186eb266e6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -31,8 +31,8 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// InlineResponseDefault - InlineResponseDefault FooGet(); + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(); /// /// @@ -41,8 +41,8 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// ApiResponse of InlineResponseDefault - ApiResponse FooGetWithHttpInfo(); + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(); #endregion Synchronous Operations } @@ -60,8 +60,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - System.Threading.Tasks.Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -71,8 +71,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -290,10 +290,10 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// InlineResponseDefault - public InlineResponseDefault FooGet() + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet() { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); return localVarResponse.Data; } @@ -301,8 +301,8 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// ApiResponse of InlineResponseDefault - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo() + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo() { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -323,7 +323,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { @@ -339,10 +339,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - public async System.Threading.Tasks.Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } @@ -351,8 +351,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -376,7 +376,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..7cb14a9934b --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Org.OpenAPITools.Client.FileParameter; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + [DataContract(Name = "_foo_get_default_response")] + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public FooGetDefaultResponse(Foo _string = default(Foo)) + { + this.String = _string; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets String + /// + [DataMember(Name = "string", EmitDefaultValue = false)] + public Foo String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES index 72c57beb6cf..4636f1cc227 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/.openapi-generator/FILES @@ -37,6 +37,7 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -44,7 +45,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/List.md docs/Mammal.md @@ -144,6 +144,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -151,7 +152,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md index dd3f6f9e520..11321e113a8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md @@ -190,6 +190,7 @@ Class | Method | HTTP request | Description - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.Foo](docs/Foo.md) + - [Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.Fruit](docs/Fruit.md) - [Model.FruitReq](docs/FruitReq.md) @@ -197,7 +198,6 @@ Class | Method | HTTP request | Description - [Model.GrandparentAnimal](docs/GrandparentAnimal.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HealthCheckResult](docs/HealthCheckResult.md) - - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) - [Model.Mammal](docs/Mammal.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/DefaultApi.md index 6f5de6b6851..e966d3bef49 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..dde9b9729b9 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/DefaultApi.cs index af9619134ea..ff7ce75367b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -31,8 +31,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - InlineResponseDefault FooGet(int operationIndex = 0); + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(int operationIndex = 0); /// /// @@ -42,8 +42,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - ApiResponse FooGetWithHttpInfo(int operationIndex = 0); + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(int operationIndex = 0); #endregion Synchronous Operations } @@ -62,8 +62,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -74,8 +74,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -201,10 +201,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - public InlineResponseDefault FooGet(int operationIndex = 0) + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet(int operationIndex = 0) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); return localVarResponse.Data; } @@ -213,8 +213,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -244,7 +244,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); @@ -263,10 +263,10 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } @@ -276,8 +276,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..259e5e626df --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,132 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + [DataContract(Name = "_foo_get_default_response")] + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public FooGetDefaultResponse(Foo _string = default(Foo)) + { + this.String = _string; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets String + /// + [DataMember(Name = "string", EmitDefaultValue = false)] + public Foo String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES index 72c57beb6cf..4636f1cc227 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/.openapi-generator/FILES @@ -37,6 +37,7 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -44,7 +45,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/List.md docs/Mammal.md @@ -144,6 +144,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -151,7 +152,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md index dd3f6f9e520..11321e113a8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md @@ -190,6 +190,7 @@ Class | Method | HTTP request | Description - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.Foo](docs/Foo.md) + - [Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.Fruit](docs/Fruit.md) - [Model.FruitReq](docs/FruitReq.md) @@ -197,7 +198,6 @@ Class | Method | HTTP request | Description - [Model.GrandparentAnimal](docs/GrandparentAnimal.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HealthCheckResult](docs/HealthCheckResult.md) - - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) - [Model.Mammal](docs/Mammal.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/DefaultApi.md index 6f5de6b6851..e966d3bef49 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..dde9b9729b9 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/DefaultApi.cs index af9619134ea..ff7ce75367b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -31,8 +31,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - InlineResponseDefault FooGet(int operationIndex = 0); + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(int operationIndex = 0); /// /// @@ -42,8 +42,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - ApiResponse FooGetWithHttpInfo(int operationIndex = 0); + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(int operationIndex = 0); #endregion Synchronous Operations } @@ -62,8 +62,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -74,8 +74,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -201,10 +201,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - public InlineResponseDefault FooGet(int operationIndex = 0) + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet(int operationIndex = 0) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); return localVarResponse.Data; } @@ -213,8 +213,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -244,7 +244,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); @@ -263,10 +263,10 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } @@ -276,8 +276,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..259e5e626df --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,132 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + [DataContract(Name = "_foo_get_default_response")] + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public FooGetDefaultResponse(Foo _string = default(Foo)) + { + this.String = _string; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets String + /// + [DataMember(Name = "string", EmitDefaultValue = false)] + public Foo String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES index ea091f5fa4e..274c950fa87 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/.openapi-generator/FILES @@ -37,6 +37,7 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -44,7 +45,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/List.md docs/Mammal.md @@ -143,6 +143,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -150,7 +151,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md index 7c9507fb610..3976379da17 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md @@ -178,6 +178,7 @@ Class | Method | HTTP request | Description - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.Foo](docs/Foo.md) + - [Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.Fruit](docs/Fruit.md) - [Model.FruitReq](docs/FruitReq.md) @@ -185,7 +186,6 @@ Class | Method | HTTP request | Description - [Model.GrandparentAnimal](docs/GrandparentAnimal.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HealthCheckResult](docs/HealthCheckResult.md) - - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) - [Model.Mammal](docs/Mammal.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/DefaultApi.md index 6f5de6b6851..e966d3bef49 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..dde9b9729b9 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs index af9619134ea..ff7ce75367b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -31,8 +31,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - InlineResponseDefault FooGet(int operationIndex = 0); + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(int operationIndex = 0); /// /// @@ -42,8 +42,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - ApiResponse FooGetWithHttpInfo(int operationIndex = 0); + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(int operationIndex = 0); #endregion Synchronous Operations } @@ -62,8 +62,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -74,8 +74,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -201,10 +201,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - public InlineResponseDefault FooGet(int operationIndex = 0) + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet(int operationIndex = 0) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); return localVarResponse.Data; } @@ -213,8 +213,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -244,7 +244,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); @@ -263,10 +263,10 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } @@ -276,8 +276,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..259e5e626df --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,132 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + [DataContract(Name = "_foo_get_default_response")] + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public FooGetDefaultResponse(Foo _string = default(Foo)) + { + this.String = _string; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets String + /// + [DataMember(Name = "string", EmitDefaultValue = false)] + public Foo String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES index ea091f5fa4e..274c950fa87 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/.openapi-generator/FILES @@ -37,6 +37,7 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -44,7 +45,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/List.md docs/Mammal.md @@ -143,6 +143,7 @@ src/Org.OpenAPITools/Model/EquilateralTriangle.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/Fruit.cs src/Org.OpenAPITools/Model/FruitReq.cs @@ -150,7 +151,6 @@ src/Org.OpenAPITools/Model/GmFruit.cs src/Org.OpenAPITools/Model/GrandparentAnimal.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/IsoscelesTriangle.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md index dd3f6f9e520..11321e113a8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md @@ -190,6 +190,7 @@ Class | Method | HTTP request | Description - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.Foo](docs/Foo.md) + - [Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.Fruit](docs/Fruit.md) - [Model.FruitReq](docs/FruitReq.md) @@ -197,7 +198,6 @@ Class | Method | HTTP request | Description - [Model.GrandparentAnimal](docs/GrandparentAnimal.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HealthCheckResult](docs/HealthCheckResult.md) - - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Model.List](docs/List.md) - [Model.Mammal](docs/Mammal.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/DefaultApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/DefaultApi.md index 6f5de6b6851..e966d3bef49 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/DefaultApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/DefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **FooGet** -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -33,7 +33,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..dde9b9729b9 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..0154d528418 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/DefaultApi.cs index af9619134ea..ff7ce75367b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -31,8 +31,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - InlineResponseDefault FooGet(int operationIndex = 0); + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(int operationIndex = 0); /// /// @@ -42,8 +42,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - ApiResponse FooGetWithHttpInfo(int operationIndex = 0); + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(int operationIndex = 0); #endregion Synchronous Operations } @@ -62,8 +62,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -74,8 +74,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -201,10 +201,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// InlineResponseDefault - public InlineResponseDefault FooGet(int operationIndex = 0) + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet(int operationIndex = 0) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); return localVarResponse.Data; } @@ -213,8 +213,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Index associated with the operation. - /// ApiResponse of InlineResponseDefault - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -244,7 +244,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); @@ -263,10 +263,10 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of InlineResponseDefault - public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } @@ -276,8 +276,8 @@ namespace Org.OpenAPITools.Api /// Thrown when fails to make API call /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (InlineResponseDefault) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..4766548c4a5 --- /dev/null +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,120 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + [DataContract(Name = "_foo_get_default_response")] + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public FooGetDefaultResponse(Foo _string = default(Foo)) + { + this.String = _string; + } + + /// + /// Gets or Sets String + /// + [DataMember(Name = "string", EmitDefaultValue = false)] + public Foo String { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as FooGetDefaultResponse).AreEqual; + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + { + hashCode = (hashCode * 59) + this.String.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES index 748620a28b0..f55c7b183ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES @@ -29,10 +29,10 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -99,10 +99,10 @@ src/Org.OpenAPITools/Model/EnumTest.cs src/Org.OpenAPITools/Model/File.cs src/Org.OpenAPITools/Model/FileSchemaTestClass.cs src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs src/Org.OpenAPITools/Model/FormatTest.cs src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/InlineResponseDefault.cs src/Org.OpenAPITools/Model/List.cs src/Org.OpenAPITools/Model/MapTest.cs src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md index 9b31b8cb9f5..4d4be89ffbc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient/README.md @@ -171,10 +171,10 @@ Class | Method | HTTP request | Description - [Model.File](docs/File.md) - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.Foo](docs/Foo.md) + - [Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.HealthCheckResult](docs/HealthCheckResult.md) - - [Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [Model.List](docs/List.md) - [Model.MapTest](docs/MapTest.md) - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md index 5feca30d1de..9056e73f389 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/DefaultApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## FooGet -> InlineResponseDefault FooGet () +> FooGetDefaultResponse FooGet () @@ -34,7 +34,7 @@ namespace Example try { - InlineResponseDefault result = apiInstance.FooGet(); + FooGetDefaultResponse result = apiInstance.FooGet(); Debug.WriteLine(result); } catch (ApiException e) @@ -54,7 +54,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp/OpenAPIClient/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..019437c8582 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [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/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 00000000000..70d142f0272 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -0,0 +1,79 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Test] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsInstanceOf" FooGetDefaultResponse + //Assert.IsInstanceOf(typeof(FooGetDefaultResponse), instance); + } + + + /// + /// Test the property 'String' + /// + [Test] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs index d21b15afeeb..2d581727e8d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -32,8 +32,8 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// InlineResponseDefault - InlineResponseDefault FooGet (); + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet (); /// /// @@ -42,8 +42,8 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// ApiResponse of InlineResponseDefault - ApiResponse FooGetWithHttpInfo (); + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo (); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -54,8 +54,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel request (optional) - /// Task of InlineResponseDefault - System.Threading.Tasks.Task FooGetAsync (CancellationToken cancellationToken = default(CancellationToken)); + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync (CancellationToken cancellationToken = default(CancellationToken)); /// /// @@ -65,8 +65,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel request (optional) - /// Task of ApiResponse (InlineResponseDefault) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync (CancellationToken cancellationToken = default(CancellationToken)); + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync (CancellationToken cancellationToken = default(CancellationToken)); #endregion Asynchronous Operations } @@ -182,10 +182,10 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// InlineResponseDefault - public InlineResponseDefault FooGet () + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet () { - ApiResponse localVarResponse = FooGetWithHttpInfo(); + ApiResponse localVarResponse = FooGetWithHttpInfo(); return localVarResponse.Data; } @@ -193,8 +193,8 @@ namespace Org.OpenAPITools.Api /// /// /// Thrown when fails to make API call - /// ApiResponse of InlineResponseDefault - public ApiResponse FooGetWithHttpInfo () + /// ApiResponse of FooGetDefaultResponse + public ApiResponse FooGetWithHttpInfo () { var localVarPath = "/foo"; @@ -233,9 +233,9 @@ namespace Org.OpenAPITools.Api if (exception != null) throw exception; } - return new ApiResponse(localVarStatusCode, + return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + (FooGetDefaultResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(FooGetDefaultResponse))); } /// @@ -243,10 +243,10 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel request (optional) - /// Task of InlineResponseDefault - public async System.Threading.Tasks.Task FooGetAsync (CancellationToken cancellationToken = default(CancellationToken)) + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync (CancellationToken cancellationToken = default(CancellationToken)) { - ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(cancellationToken); + ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(cancellationToken); return localVarResponse.Data; } @@ -256,8 +256,8 @@ namespace Org.OpenAPITools.Api /// /// Thrown when fails to make API call /// Cancellation Token to cancel request (optional) - /// Task of ApiResponse (InlineResponseDefault) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync (CancellationToken cancellationToken = default(CancellationToken)) + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync (CancellationToken cancellationToken = default(CancellationToken)) { var localVarPath = "/foo"; @@ -296,9 +296,9 @@ namespace Org.OpenAPITools.Api if (exception != null) throw exception; } - return new ApiResponse(localVarStatusCode, + return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), - (InlineResponseDefault) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponseDefault))); + (FooGetDefaultResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(FooGetDefaultResponse))); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 00000000000..f816bd93917 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + [DataContract] + public partial class FooGetDefaultResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _string. + public FooGetDefaultResponse(Foo _string = default(Foo)) + { + this.String = _string; + } + + /// + /// Gets or Sets String + /// + [DataMember(Name="string", EmitDefaultValue=false)] + public Foo String { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FooGetDefaultResponse); + } + + /// + /// Returns true if FooGetDefaultResponse instances are equal + /// + /// Instance of FooGetDefaultResponse to be compared + /// Boolean + public bool Equals(FooGetDefaultResponse input) + { + if (input == null) + return false; + + return + ( + this.String == input.String || + (this.String != null && + this.String.Equals(input.String)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/elixir/.openapi-generator/FILES b/samples/client/petstore/elixir/.openapi-generator/FILES index 22d942b9d92..9f21ec0f85f 100644 --- a/samples/client/petstore/elixir/.openapi-generator/FILES +++ b/samples/client/petstore/elixir/.openapi-generator/FILES @@ -10,6 +10,7 @@ lib/openapi_petstore/api/store.ex lib/openapi_petstore/api/user.ex lib/openapi_petstore/connection.ex lib/openapi_petstore/deserializer.ex +lib/openapi_petstore/model/_foo_get_default_response.ex lib/openapi_petstore/model/_special_model_name_.ex lib/openapi_petstore/model/additional_properties_class.ex lib/openapi_petstore/model/all_of_with_single_ref.ex @@ -36,7 +37,6 @@ lib/openapi_petstore/model/foo.ex lib/openapi_petstore/model/format_test.ex lib/openapi_petstore/model/has_only_read_only.ex lib/openapi_petstore/model/health_check_result.ex -lib/openapi_petstore/model/inline_response_default.ex lib/openapi_petstore/model/list.ex lib/openapi_petstore/model/map_test.ex lib/openapi_petstore/model/mixed_properties_and_additional_properties_class.ex diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex index ca006e293d0..6432938ee00 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/default.ex @@ -19,10 +19,10 @@ defmodule OpenapiPetstore.Api.Default do - opts (KeywordList): [optional] Optional parameters ## Returns - {:ok, OpenapiPetstore.Model.InlineResponseDefault.t} on success + {:ok, OpenapiPetstore.Model.FooGetDefaultResponse.t} on success {:error, Tesla.Env.t} on failure """ - @spec foo_get(Tesla.Env.client, keyword()) :: {:ok, OpenapiPetstore.Model.InlineResponseDefault.t} | {:error, Tesla.Env.t} + @spec foo_get(Tesla.Env.client, keyword()) :: {:ok, OpenapiPetstore.Model.FooGetDefaultResponse.t} | {:error, Tesla.Env.t} def foo_get(connection, _opts \\ []) do %{} |> method(:get) @@ -30,7 +30,7 @@ defmodule OpenapiPetstore.Api.Default do |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> evaluate_response([ - { :default, %OpenapiPetstore.Model.InlineResponseDefault{}} + { :default, %OpenapiPetstore.Model.FooGetDefaultResponse{}} ]) end end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/_foo_get_default_response.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/_foo_get_default_response.ex new file mode 100644 index 00000000000..5ad08d621fe --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/_foo_get_default_response.ex @@ -0,0 +1,27 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.FooGetDefaultResponse do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :"string" + ] + + @type t :: %__MODULE__{ + :"string" => OpenapiPetstore.Model.Foo.t | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.FooGetDefaultResponse do + import OpenapiPetstore.Deserializer + def decode(value, options) do + value + |> deserialize(:"string", :struct, OpenapiPetstore.Model.Foo, options) + end +end + diff --git a/samples/client/petstore/java/feign/.openapi-generator/FILES b/samples/client/petstore/java/feign/.openapi-generator/FILES index 9a92bb872d5..1e8d11e21e9 100644 --- a/samples/client/petstore/java/feign/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign/.openapi-generator/FILES @@ -60,10 +60,10 @@ src/main/java/org/openapitools/client/model/EnumTest.java src/main/java/org/openapitools/client/model/File.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java src/main/java/org/openapitools/client/model/FormatTest.java src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java src/main/java/org/openapitools/client/model/HealthCheckResult.java -src/main/java/org/openapitools/client/model/InlineResponseDefault.java src/main/java/org/openapitools/client/model/MapTest.java src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java src/main/java/org/openapitools/client/model/Model200Response.java diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 32235895732..ccf94d1ff50 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -48,7 +48,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: response x-accepts: application/json /pet: @@ -1969,7 +1969,7 @@ components: - user title: SingleRefType type: string - inline_response_default: + _foo_get_default_response: example: string: bar: bar diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java index 2b69f9144ec..b7dcf72b864 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -4,7 +4,7 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; import org.openapitools.client.model.ApiResponse; -import org.openapitools.client.model.InlineResponseDefault; +import org.openapitools.client.model.FooGetDefaultResponse; import java.util.ArrayList; import java.util.HashMap; @@ -19,13 +19,13 @@ public interface DefaultApi extends ApiClient.Api { /** * * - * @return InlineResponseDefault + * @return FooGetDefaultResponse */ @RequestLine("GET /foo") @Headers({ "Accept: application/json", }) - InlineResponseDefault fooGet(); + FooGetDefaultResponse fooGet(); /** * @@ -37,7 +37,7 @@ public interface DefaultApi extends ApiClient.Api { @Headers({ "Accept: application/json", }) - ApiResponse fooGetWithHttpInfo(); + ApiResponse fooGetWithHttpInfo(); } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 00000000000..0c2f4bdc6c7 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,109 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FooGetDefaultResponse + */ +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@JsonTypeName("_foo_get_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(Foo string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 00000000000..740f9a6c6d1 --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for FooGetDefaultResponse + */ +class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/jersey3/.openapi-generator/FILES b/samples/client/petstore/java/jersey3/.openapi-generator/FILES index d9a7d4789da..9f9129b99e5 100644 --- a/samples/client/petstore/java/jersey3/.openapi-generator/FILES +++ b/samples/client/petstore/java/jersey3/.openapi-generator/FILES @@ -39,6 +39,7 @@ docs/FakeApi.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -46,7 +47,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/Mammal.md docs/MapTest.md @@ -153,6 +153,7 @@ src/main/java/org/openapitools/client/model/EnumTest.java src/main/java/org/openapitools/client/model/EquilateralTriangle.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java src/main/java/org/openapitools/client/model/FormatTest.java src/main/java/org/openapitools/client/model/Fruit.java src/main/java/org/openapitools/client/model/FruitReq.java @@ -160,7 +161,6 @@ src/main/java/org/openapitools/client/model/GmFruit.java src/main/java/org/openapitools/client/model/GrandparentAnimal.java src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java src/main/java/org/openapitools/client/model/HealthCheckResult.java -src/main/java/org/openapitools/client/model/InlineResponseDefault.java src/main/java/org/openapitools/client/model/IsoscelesTriangle.java src/main/java/org/openapitools/client/model/Mammal.java src/main/java/org/openapitools/client/model/MapTest.java diff --git a/samples/client/petstore/java/jersey3/README.md b/samples/client/petstore/java/jersey3/README.md index a03601a1c49..dc3e68ec42f 100644 --- a/samples/client/petstore/java/jersey3/README.md +++ b/samples/client/petstore/java/jersey3/README.md @@ -186,6 +186,7 @@ Class | Method | HTTP request | Description - [EquilateralTriangle](docs/EquilateralTriangle.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [FormatTest](docs/FormatTest.md) - [Fruit](docs/Fruit.md) - [FruitReq](docs/FruitReq.md) @@ -193,7 +194,6 @@ Class | Method | HTTP request | Description - [GrandparentAnimal](docs/GrandparentAnimal.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - - [InlineResponseDefault](docs/InlineResponseDefault.md) - [IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) diff --git a/samples/client/petstore/java/jersey3/api/openapi.yaml b/samples/client/petstore/java/jersey3/api/openapi.yaml index dad28120951..1db8f0a9d1a 100644 --- a/samples/client/petstore/java/jersey3/api/openapi.yaml +++ b/samples/client/petstore/java/jersey3/api/openapi.yaml @@ -48,7 +48,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: response x-accepts: application/json /pet: @@ -2136,7 +2136,7 @@ components: $ref: '#/components/schemas/Bar' type: array type: object - inline_response_default: + _foo_get_default_response: example: string: bar: bar diff --git a/samples/client/petstore/java/jersey3/docs/DefaultApi.md b/samples/client/petstore/java/jersey3/docs/DefaultApi.md index 00a8ac2ac24..f4502a6aa62 100644 --- a/samples/client/petstore/java/jersey3/docs/DefaultApi.md +++ b/samples/client/petstore/java/jersey3/docs/DefaultApi.md @@ -10,7 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* ## fooGet -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -31,7 +31,7 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); try { - InlineResponseDefault result = apiInstance.fooGet(); + FooGetDefaultResponse result = apiInstance.fooGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#fooGet"); @@ -50,7 +50,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/java/jersey3/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/jersey3/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..ff3d7a3a56c --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java index 90712d51e58..e9b2ade6895 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -8,7 +8,7 @@ import org.openapitools.client.Pair; import jakarta.ws.rs.core.GenericType; -import org.openapitools.client.model.InlineResponseDefault; +import org.openapitools.client.model.FooGetDefaultResponse; import java.util.ArrayList; import java.util.HashMap; @@ -48,7 +48,7 @@ public class DefaultApi { /** * * - * @return InlineResponseDefault + * @return FooGetDefaultResponse * @throws ApiException if fails to make API call * @http.response.details @@ -56,14 +56,14 @@ public class DefaultApi {
0 response -
*/ - public InlineResponseDefault fooGet() throws ApiException { + public FooGetDefaultResponse fooGet() throws ApiException { return fooGetWithHttpInfo().getData(); } /** * * - * @return ApiResponse<InlineResponseDefault> + * @return ApiResponse<FooGetDefaultResponse> * @throws ApiException if fails to make API call * @http.response.details @@ -71,7 +71,7 @@ public class DefaultApi {
0 response -
*/ - public ApiResponse fooGetWithHttpInfo() throws ApiException { + public ApiResponse fooGetWithHttpInfo() throws ApiException { Object localVarPostBody = null; // create path and map variables @@ -99,7 +99,7 @@ public class DefaultApi { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; + GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 00000000000..a9b969457f8 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * FooGetDefaultResponse + */ +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@JsonTypeName("_foo_get_default_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @jakarta.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(Foo string) { + this.string = string; + } + + + /** + * Return true if this _foo_get_default_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 00000000000..9b92839a55c --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES index e658d2912c5..06aaf5fb56d 100644 --- a/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES @@ -40,6 +40,7 @@ docs/FakeApi.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -47,7 +48,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/Mammal.md docs/MapTest.md @@ -159,6 +159,7 @@ src/main/java/org/openapitools/client/model/EnumTest.java src/main/java/org/openapitools/client/model/EquilateralTriangle.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java src/main/java/org/openapitools/client/model/FormatTest.java src/main/java/org/openapitools/client/model/Fruit.java src/main/java/org/openapitools/client/model/FruitReq.java @@ -166,7 +167,6 @@ src/main/java/org/openapitools/client/model/GmFruit.java src/main/java/org/openapitools/client/model/GrandparentAnimal.java src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java src/main/java/org/openapitools/client/model/HealthCheckResult.java -src/main/java/org/openapitools/client/model/InlineResponseDefault.java src/main/java/org/openapitools/client/model/IsoscelesTriangle.java src/main/java/org/openapitools/client/model/Mammal.java src/main/java/org/openapitools/client/model/MapTest.java diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index bbf2cf62c27..c39f6782592 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -187,6 +187,7 @@ Class | Method | HTTP request | Description - [EquilateralTriangle](docs/EquilateralTriangle.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [FormatTest](docs/FormatTest.md) - [Fruit](docs/Fruit.md) - [FruitReq](docs/FruitReq.md) @@ -194,7 +195,6 @@ Class | Method | HTTP request | Description - [GrandparentAnimal](docs/GrandparentAnimal.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - - [InlineResponseDefault](docs/InlineResponseDefault.md) - [IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) diff --git a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml index fa3377440eb..d6e01b68040 100644 --- a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml @@ -48,7 +48,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: response x-accepts: application/json /pet: @@ -2186,7 +2186,7 @@ components: required: - name type: object - inline_response_default: + _foo_get_default_response: example: string: bar: bar diff --git a/samples/client/petstore/java/okhttp-gson/docs/DefaultApi.md b/samples/client/petstore/java/okhttp-gson/docs/DefaultApi.md index d9693a7ff10..0fa939a2081 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/DefaultApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* # **fooGet** -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -29,7 +29,7 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); try { - InlineResponseDefault result = apiInstance.fooGet(); + FooGetDefaultResponse result = apiInstance.fooGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#fooGet"); @@ -47,7 +47,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/java/okhttp-gson/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/okhttp-gson/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..ff3d7a3a56c --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index c8edc9f949c..92b5eaf1899 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -249,13 +249,13 @@ public class JSON { .registerTypeAdapterFactory(new org.openapitools.client.model.EquilateralTriangle.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.FileSchemaTestClass.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.Foo.CustomTypeAdapterFactory()) + .registerTypeAdapterFactory(new org.openapitools.client.model.FooGetDefaultResponse.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.FormatTest.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.Fruit.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.FruitReq.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.GmFruit.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.HasOnlyReadOnly.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.HealthCheckResult.CustomTypeAdapterFactory()) - .registerTypeAdapterFactory(new org.openapitools.client.model.InlineResponseDefault.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.IsoscelesTriangle.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.Mammal.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new org.openapitools.client.model.MapTest.CustomTypeAdapterFactory()) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/DefaultApi.java index b5e9d2f95ff..c7f201d8b65 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -27,7 +27,7 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; -import org.openapitools.client.model.InlineResponseDefault; +import org.openapitools.client.model.FooGetDefaultResponse; import java.lang.reflect.Type; import java.util.ArrayList; @@ -141,7 +141,7 @@ public class DefaultApi { /** * * - * @return InlineResponseDefault + * @return FooGetDefaultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -149,15 +149,15 @@ public class DefaultApi {
0 response -
*/ - public InlineResponseDefault fooGet() throws ApiException { - ApiResponse localVarResp = fooGetWithHttpInfo(); + public FooGetDefaultResponse fooGet() throws ApiException { + ApiResponse localVarResp = fooGetWithHttpInfo(); return localVarResp.getData(); } /** * * - * @return ApiResponse<InlineResponseDefault> + * @return ApiResponse<FooGetDefaultResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -165,9 +165,9 @@ public class DefaultApi {
0 response -
*/ - public ApiResponse fooGetWithHttpInfo() throws ApiException { + public ApiResponse fooGetWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = fooGetValidateBeforeCall(null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -183,10 +183,10 @@ public class DefaultApi { 0 response - */ - public okhttp3.Call fooGetAsync(final ApiCallback _callback) throws ApiException { + public okhttp3.Call fooGetAsync(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = fooGetValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 00000000000..30333d90f12 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,275 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.Foo; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FooGetDefaultResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FooGetDefaultResponse { + public static final String SERIALIZED_NAME_STRING = "string"; + @SerializedName(SERIALIZED_NAME_STRING) + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(Foo string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Foo getString() { + return string; + } + + + public void setString(Foo string) { + this.string = string; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + */ + public FooGetDefaultResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string)&& + Objects.equals(this.additionalProperties, fooGetDefaultResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(string, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("string"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to FooGetDefaultResponse + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (FooGetDefaultResponse.openapiRequiredFields.isEmpty()) { + return; + } else { // has required fields + throw new IllegalArgumentException(String.format("The required field(s) %s in FooGetDefaultResponse is not found in the empty JSON string", FooGetDefaultResponse.openapiRequiredFields.toString())); + } + } + // validate the optional field `string` + if (jsonObj.getAsJsonObject("string") != null) { + Foo.validateJsonObject(jsonObj.getAsJsonObject("string")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FooGetDefaultResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FooGetDefaultResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FooGetDefaultResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FooGetDefaultResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FooGetDefaultResponse read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + FooGetDefaultResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else { // non-primitive type + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FooGetDefaultResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of FooGetDefaultResponse + * @throws IOException if the JSON string is invalid with respect to FooGetDefaultResponse + */ + public static FooGetDefaultResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FooGetDefaultResponse.class); + } + + /** + * Convert an instance of FooGetDefaultResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/DefaultApiTest.java index 6ef597933ac..2672798d71d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/DefaultApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -14,9 +14,9 @@ package org.openapitools.client.api; import org.openapitools.client.ApiException; -import org.openapitools.client.model.InlineResponseDefault; -import org.junit.jupiter.api.Test; +import org.openapitools.client.model.FooGetDefaultResponse; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.HashMap; @@ -31,19 +31,13 @@ public class DefaultApiTest { private final DefaultApi api = new DefaultApi(); - /** - * - * - * - * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void fooGetTest() throws ApiException { - InlineResponseDefault response = api.fooGet(); + FooGetDefaultResponse response = api.fooGet(); // TODO: test validations } - + } diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 00000000000..7b0494a2894 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.Foo; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/webclient/.openapi-generator/FILES b/samples/client/petstore/java/webclient/.openapi-generator/FILES index 178024019af..bc9e24cb1f9 100644 --- a/samples/client/petstore/java/webclient/.openapi-generator/FILES +++ b/samples/client/petstore/java/webclient/.openapi-generator/FILES @@ -29,10 +29,10 @@ docs/FakeApi.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md docs/Model200Response.md @@ -108,10 +108,10 @@ src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java src/main/java/org/openapitools/client/model/FormatTest.java src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java src/main/java/org/openapitools/client/model/HealthCheckResult.java -src/main/java/org/openapitools/client/model/InlineResponseDefault.java src/main/java/org/openapitools/client/model/MapTest.java src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java src/main/java/org/openapitools/client/model/Model200Response.java diff --git a/samples/client/petstore/java/webclient/README.md b/samples/client/petstore/java/webclient/README.md index fe3c7ecf3ac..c184d5d4186 100644 --- a/samples/client/petstore/java/webclient/README.md +++ b/samples/client/petstore/java/webclient/README.md @@ -178,10 +178,10 @@ Class | Method | HTTP request | Description - [EnumTest](docs/EnumTest.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [FormatTest](docs/FormatTest.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - - [InlineResponseDefault](docs/InlineResponseDefault.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model200Response.md) diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 32235895732..ccf94d1ff50 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -48,7 +48,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: response x-accepts: application/json /pet: @@ -1969,7 +1969,7 @@ components: - user title: SingleRefType type: string - inline_response_default: + _foo_get_default_response: example: string: bar: bar diff --git a/samples/client/petstore/java/webclient/docs/DefaultApi.md b/samples/client/petstore/java/webclient/docs/DefaultApi.md index c85b8aa9061..2c56e1f90e5 100644 --- a/samples/client/petstore/java/webclient/docs/DefaultApi.md +++ b/samples/client/petstore/java/webclient/docs/DefaultApi.md @@ -10,7 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* ## fooGet -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -31,7 +31,7 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); try { - InlineResponseDefault result = apiInstance.fooGet(); + FooGetDefaultResponse result = apiInstance.fooGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#fooGet"); @@ -50,7 +50,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/java/webclient/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/webclient/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..ff3d7a3a56c --- /dev/null +++ b/samples/client/petstore/java/webclient/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/DefaultApi.java index 8bb798ec071..4579b415e47 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -2,7 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; -import org.openapitools.client.model.InlineResponseDefault; +import org.openapitools.client.model.FooGetDefaultResponse; import java.util.HashMap; import java.util.List; @@ -50,7 +50,7 @@ public class DefaultApi { * * *

0 - response - * @return InlineResponseDefault + * @return FooGetDefaultResponse * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ private ResponseSpec fooGetRequestCreation() throws WebClientResponseException { @@ -72,7 +72,7 @@ public class DefaultApi { String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/foo", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } @@ -80,16 +80,16 @@ public class DefaultApi { * * *

0 - response - * @return InlineResponseDefault + * @return FooGetDefaultResponse * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono fooGet() throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + public Mono fooGet() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return fooGetRequestCreation().bodyToMono(localVarReturnType); } - public Mono> fooGetWithHttpInfo() throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + public Mono> fooGetWithHttpInfo() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return fooGetRequestCreation().toEntity(localVarReturnType); } } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 00000000000..0c2f4bdc6c7 --- /dev/null +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,109 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FooGetDefaultResponse + */ +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@JsonTypeName("_foo_get_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(Foo string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java index 0c75a4d8d4f..bc3c03eac1f 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -13,7 +13,7 @@ package org.openapitools.client.api; -import org.openapitools.client.model.InlineResponseDefault; +import org.openapitools.client.model.FooGetDefaultResponse; import org.junit.Test; import org.junit.Ignore; @@ -39,7 +39,7 @@ public class DefaultApiTest { */ @Test public void fooGetTest() { - InlineResponseDefault response = api.fooGet().block(); + FooGetDefaultResponse response = api.fooGet().block(); // TODO: test validations } diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 00000000000..5ed96c1248f --- /dev/null +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/javascript-es6/.openapi-generator/FILES b/samples/client/petstore/javascript-es6/.openapi-generator/FILES index 3e7946d76cc..0440bb2716c 100644 --- a/samples/client/petstore/javascript-es6/.openapi-generator/FILES +++ b/samples/client/petstore/javascript-es6/.openapi-generator/FILES @@ -27,10 +27,10 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -88,10 +88,10 @@ src/model/EnumTest.js src/model/File.js src/model/FileSchemaTestClass.js src/model/Foo.js +src/model/FooGetDefaultResponse.js src/model/FormatTest.js src/model/HasOnlyReadOnly.js src/model/HealthCheckResult.js -src/model/InlineResponseDefault.js src/model/List.js src/model/MapTest.js src/model/MixedPropertiesAndAdditionalPropertiesClass.js diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md index 3cf92f17276..2f7325ceebb 100644 --- a/samples/client/petstore/javascript-es6/README.md +++ b/samples/client/petstore/javascript-es6/README.md @@ -186,10 +186,10 @@ Class | Method | HTTP request | Description - [OpenApiPetstore.File](docs/File.md) - [OpenApiPetstore.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [OpenApiPetstore.Foo](docs/Foo.md) + - [OpenApiPetstore.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [OpenApiPetstore.FormatTest](docs/FormatTest.md) - [OpenApiPetstore.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [OpenApiPetstore.HealthCheckResult](docs/HealthCheckResult.md) - - [OpenApiPetstore.InlineResponseDefault](docs/InlineResponseDefault.md) - [OpenApiPetstore.List](docs/List.md) - [OpenApiPetstore.MapTest](docs/MapTest.md) - [OpenApiPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/javascript-es6/docs/DefaultApi.md b/samples/client/petstore/javascript-es6/docs/DefaultApi.md index cf507abc2ff..d24a241f950 100644 --- a/samples/client/petstore/javascript-es6/docs/DefaultApi.md +++ b/samples/client/petstore/javascript-es6/docs/DefaultApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## fooGet -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -35,7 +35,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/javascript-es6/docs/FooGetDefaultResponse.md b/samples/client/petstore/javascript-es6/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..031b9060841 --- /dev/null +++ b/samples/client/petstore/javascript-es6/docs/FooGetDefaultResponse.md @@ -0,0 +1,9 @@ +# OpenApiPetstore.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + + diff --git a/samples/client/petstore/javascript-es6/src/api/DefaultApi.js b/samples/client/petstore/javascript-es6/src/api/DefaultApi.js index 2a586e6fc32..5409c7a6727 100644 --- a/samples/client/petstore/javascript-es6/src/api/DefaultApi.js +++ b/samples/client/petstore/javascript-es6/src/api/DefaultApi.js @@ -13,7 +13,7 @@ import ApiClient from "../ApiClient"; -import InlineResponseDefault from '../model/InlineResponseDefault'; +import FooGetDefaultResponse from '../model/FooGetDefaultResponse'; /** * Default service. @@ -38,13 +38,13 @@ export default class DefaultApi { * Callback function to receive the result of the fooGet operation. * @callback module:api/DefaultApi~fooGetCallback * @param {String} error Error message, if any. - * @param {module:model/InlineResponseDefault} data The data returned by the service call. + * @param {module:model/FooGetDefaultResponse} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * @param {module:api/DefaultApi~fooGetCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link module:model/InlineResponseDefault} + * data is of type: {@link module:model/FooGetDefaultResponse} */ fooGet(callback) { let postBody = null; @@ -61,7 +61,7 @@ export default class DefaultApi { let authNames = []; let contentTypes = []; let accepts = ['application/json']; - let returnType = InlineResponseDefault; + let returnType = FooGetDefaultResponse; return this.apiClient.callApi( '/foo', 'GET', pathParams, queryParams, headerParams, formParams, postBody, diff --git a/samples/client/petstore/javascript-es6/src/index.js b/samples/client/petstore/javascript-es6/src/index.js index 7235863ec1b..a75a817c260 100644 --- a/samples/client/petstore/javascript-es6/src/index.js +++ b/samples/client/petstore/javascript-es6/src/index.js @@ -34,10 +34,10 @@ import EnumTest from './model/EnumTest'; import File from './model/File'; import FileSchemaTestClass from './model/FileSchemaTestClass'; import Foo from './model/Foo'; +import FooGetDefaultResponse from './model/FooGetDefaultResponse'; import FormatTest from './model/FormatTest'; import HasOnlyReadOnly from './model/HasOnlyReadOnly'; import HealthCheckResult from './model/HealthCheckResult'; -import InlineResponseDefault from './model/InlineResponseDefault'; import List from './model/List'; import MapTest from './model/MapTest'; import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass'; @@ -232,6 +232,12 @@ export { */ Foo, + /** + * The FooGetDefaultResponse model constructor. + * @property {module:model/FooGetDefaultResponse} + */ + FooGetDefaultResponse, + /** * The FormatTest model constructor. * @property {module:model/FormatTest} @@ -250,12 +256,6 @@ export { */ HealthCheckResult, - /** - * The InlineResponseDefault model constructor. - * @property {module:model/InlineResponseDefault} - */ - InlineResponseDefault, - /** * The List model constructor. * @property {module:model/List} diff --git a/samples/client/petstore/javascript-es6/src/model/FooGetDefaultResponse.js b/samples/client/petstore/javascript-es6/src/model/FooGetDefaultResponse.js new file mode 100644 index 00000000000..ab3558a0415 --- /dev/null +++ b/samples/client/petstore/javascript-es6/src/model/FooGetDefaultResponse.js @@ -0,0 +1,72 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import Foo from './Foo'; + +/** + * The FooGetDefaultResponse model module. + * @module model/FooGetDefaultResponse + * @version 1.0.0 + */ +class FooGetDefaultResponse { + /** + * Constructs a new FooGetDefaultResponse. + * @alias module:model/FooGetDefaultResponse + */ + constructor() { + + FooGetDefaultResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a FooGetDefaultResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/FooGetDefaultResponse} obj Optional instance to populate. + * @return {module:model/FooGetDefaultResponse} The populated FooGetDefaultResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new FooGetDefaultResponse(); + + if (data.hasOwnProperty('string')) { + obj['string'] = Foo.constructFromObject(data['string']); + } + } + return obj; + } + + +} + +/** + * @member {module:model/Foo} string + */ +FooGetDefaultResponse.prototype['string'] = undefined; + + + + + + +export default FooGetDefaultResponse; + diff --git a/samples/client/petstore/javascript-es6/test/model/InlineResponseDefault.spec.js b/samples/client/petstore/javascript-es6/test/model/FooGetDefaultResponse.spec.js similarity index 75% rename from samples/client/petstore/javascript-es6/test/model/InlineResponseDefault.spec.js rename to samples/client/petstore/javascript-es6/test/model/FooGetDefaultResponse.spec.js index c63e306630d..64c30673805 100644 --- a/samples/client/petstore/javascript-es6/test/model/InlineResponseDefault.spec.js +++ b/samples/client/petstore/javascript-es6/test/model/FooGetDefaultResponse.spec.js @@ -28,7 +28,7 @@ var instance; beforeEach(function() { - instance = new OpenApiPetstore.InlineResponseDefault(); + instance = new OpenApiPetstore.FooGetDefaultResponse(); }); var getProperty = function(object, getter, property) { @@ -47,16 +47,16 @@ object[property] = value; } - describe('InlineResponseDefault', function() { - it('should create an instance of InlineResponseDefault', function() { - // uncomment below and update the code to test InlineResponseDefault - //var instane = new OpenApiPetstore.InlineResponseDefault(); - //expect(instance).to.be.a(OpenApiPetstore.InlineResponseDefault); + describe('FooGetDefaultResponse', function() { + it('should create an instance of FooGetDefaultResponse', function() { + // uncomment below and update the code to test FooGetDefaultResponse + //var instance = new OpenApiPetstore.FooGetDefaultResponse(); + //expect(instance).to.be.a(OpenApiPetstore.FooGetDefaultResponse); }); - it('should have the property _string (base name: "string")', function() { - // uncomment below and update the code to test the property _string - //var instance = new OpenApiPetstore.InlineResponseDefault(); + it('should have the property string (base name: "string")', function() { + // uncomment below and update the code to test the property string + //var instance = new OpenApiPetstore.FooGetDefaultResponse(); //expect(instance).to.be(); }); diff --git a/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES b/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES index 3e7946d76cc..0440bb2716c 100644 --- a/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES +++ b/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES @@ -27,10 +27,10 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -88,10 +88,10 @@ src/model/EnumTest.js src/model/File.js src/model/FileSchemaTestClass.js src/model/Foo.js +src/model/FooGetDefaultResponse.js src/model/FormatTest.js src/model/HasOnlyReadOnly.js src/model/HealthCheckResult.js -src/model/InlineResponseDefault.js src/model/List.js src/model/MapTest.js src/model/MixedPropertiesAndAdditionalPropertiesClass.js diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md index 409d63e9a29..a968da472da 100644 --- a/samples/client/petstore/javascript-promise-es6/README.md +++ b/samples/client/petstore/javascript-promise-es6/README.md @@ -184,10 +184,10 @@ Class | Method | HTTP request | Description - [OpenApiPetstore.File](docs/File.md) - [OpenApiPetstore.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [OpenApiPetstore.Foo](docs/Foo.md) + - [OpenApiPetstore.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [OpenApiPetstore.FormatTest](docs/FormatTest.md) - [OpenApiPetstore.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [OpenApiPetstore.HealthCheckResult](docs/HealthCheckResult.md) - - [OpenApiPetstore.InlineResponseDefault](docs/InlineResponseDefault.md) - [OpenApiPetstore.List](docs/List.md) - [OpenApiPetstore.MapTest](docs/MapTest.md) - [OpenApiPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/javascript-promise-es6/docs/DefaultApi.md b/samples/client/petstore/javascript-promise-es6/docs/DefaultApi.md index d9dc50faa2e..b6421036953 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/DefaultApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/DefaultApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## fooGet -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -34,7 +34,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/javascript-promise-es6/docs/FooGetDefaultResponse.md b/samples/client/petstore/javascript-promise-es6/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..031b9060841 --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/docs/FooGetDefaultResponse.md @@ -0,0 +1,9 @@ +# OpenApiPetstore.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + + diff --git a/samples/client/petstore/javascript-promise-es6/src/api/DefaultApi.js b/samples/client/petstore/javascript-promise-es6/src/api/DefaultApi.js index 54b31db8d09..ad141e35afa 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/DefaultApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/DefaultApi.js @@ -13,7 +13,7 @@ import ApiClient from "../ApiClient"; -import InlineResponseDefault from '../model/InlineResponseDefault'; +import FooGetDefaultResponse from '../model/FooGetDefaultResponse'; /** * Default service. @@ -36,7 +36,7 @@ export default class DefaultApi { /** - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponseDefault} and HTTP response + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/FooGetDefaultResponse} and HTTP response */ fooGetWithHttpInfo() { let postBody = null; @@ -53,7 +53,7 @@ export default class DefaultApi { let authNames = []; let contentTypes = []; let accepts = ['application/json']; - let returnType = InlineResponseDefault; + let returnType = FooGetDefaultResponse; return this.apiClient.callApi( '/foo', 'GET', pathParams, queryParams, headerParams, formParams, postBody, @@ -62,7 +62,7 @@ export default class DefaultApi { } /** - * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponseDefault} + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/FooGetDefaultResponse} */ fooGet() { return this.fooGetWithHttpInfo() diff --git a/samples/client/petstore/javascript-promise-es6/src/index.js b/samples/client/petstore/javascript-promise-es6/src/index.js index 7235863ec1b..a75a817c260 100644 --- a/samples/client/petstore/javascript-promise-es6/src/index.js +++ b/samples/client/petstore/javascript-promise-es6/src/index.js @@ -34,10 +34,10 @@ import EnumTest from './model/EnumTest'; import File from './model/File'; import FileSchemaTestClass from './model/FileSchemaTestClass'; import Foo from './model/Foo'; +import FooGetDefaultResponse from './model/FooGetDefaultResponse'; import FormatTest from './model/FormatTest'; import HasOnlyReadOnly from './model/HasOnlyReadOnly'; import HealthCheckResult from './model/HealthCheckResult'; -import InlineResponseDefault from './model/InlineResponseDefault'; import List from './model/List'; import MapTest from './model/MapTest'; import MixedPropertiesAndAdditionalPropertiesClass from './model/MixedPropertiesAndAdditionalPropertiesClass'; @@ -232,6 +232,12 @@ export { */ Foo, + /** + * The FooGetDefaultResponse model constructor. + * @property {module:model/FooGetDefaultResponse} + */ + FooGetDefaultResponse, + /** * The FormatTest model constructor. * @property {module:model/FormatTest} @@ -250,12 +256,6 @@ export { */ HealthCheckResult, - /** - * The InlineResponseDefault model constructor. - * @property {module:model/InlineResponseDefault} - */ - InlineResponseDefault, - /** * The List model constructor. * @property {module:model/List} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/FooGetDefaultResponse.js b/samples/client/petstore/javascript-promise-es6/src/model/FooGetDefaultResponse.js new file mode 100644 index 00000000000..ab3558a0415 --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/src/model/FooGetDefaultResponse.js @@ -0,0 +1,72 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import Foo from './Foo'; + +/** + * The FooGetDefaultResponse model module. + * @module model/FooGetDefaultResponse + * @version 1.0.0 + */ +class FooGetDefaultResponse { + /** + * Constructs a new FooGetDefaultResponse. + * @alias module:model/FooGetDefaultResponse + */ + constructor() { + + FooGetDefaultResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a FooGetDefaultResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/FooGetDefaultResponse} obj Optional instance to populate. + * @return {module:model/FooGetDefaultResponse} The populated FooGetDefaultResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new FooGetDefaultResponse(); + + if (data.hasOwnProperty('string')) { + obj['string'] = Foo.constructFromObject(data['string']); + } + } + return obj; + } + + +} + +/** + * @member {module:model/Foo} string + */ +FooGetDefaultResponse.prototype['string'] = undefined; + + + + + + +export default FooGetDefaultResponse; + diff --git a/samples/client/petstore/javascript-promise-es6/test/model/InlineResponseDefault.spec.js b/samples/client/petstore/javascript-promise-es6/test/model/FooGetDefaultResponse.spec.js similarity index 75% rename from samples/client/petstore/javascript-promise-es6/test/model/InlineResponseDefault.spec.js rename to samples/client/petstore/javascript-promise-es6/test/model/FooGetDefaultResponse.spec.js index c63e306630d..64c30673805 100644 --- a/samples/client/petstore/javascript-promise-es6/test/model/InlineResponseDefault.spec.js +++ b/samples/client/petstore/javascript-promise-es6/test/model/FooGetDefaultResponse.spec.js @@ -28,7 +28,7 @@ var instance; beforeEach(function() { - instance = new OpenApiPetstore.InlineResponseDefault(); + instance = new OpenApiPetstore.FooGetDefaultResponse(); }); var getProperty = function(object, getter, property) { @@ -47,16 +47,16 @@ object[property] = value; } - describe('InlineResponseDefault', function() { - it('should create an instance of InlineResponseDefault', function() { - // uncomment below and update the code to test InlineResponseDefault - //var instane = new OpenApiPetstore.InlineResponseDefault(); - //expect(instance).to.be.a(OpenApiPetstore.InlineResponseDefault); + describe('FooGetDefaultResponse', function() { + it('should create an instance of FooGetDefaultResponse', function() { + // uncomment below and update the code to test FooGetDefaultResponse + //var instance = new OpenApiPetstore.FooGetDefaultResponse(); + //expect(instance).to.be.a(OpenApiPetstore.FooGetDefaultResponse); }); - it('should have the property _string (base name: "string")', function() { - // uncomment below and update the code to test the property _string - //var instance = new OpenApiPetstore.InlineResponseDefault(); + it('should have the property string (base name: "string")', function() { + // uncomment below and update the code to test the property string + //var instance = new OpenApiPetstore.FooGetDefaultResponse(); //expect(instance).to.be(); }); diff --git a/samples/client/petstore/perl/.openapi-generator/FILES b/samples/client/petstore/perl/.openapi-generator/FILES index 838d176f103..73f05fa4007 100644 --- a/samples/client/petstore/perl/.openapi-generator/FILES +++ b/samples/client/petstore/perl/.openapi-generator/FILES @@ -28,10 +28,10 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -87,10 +87,10 @@ lib/WWW/OpenAPIClient/Object/EnumTest.pm lib/WWW/OpenAPIClient/Object/File.pm lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm lib/WWW/OpenAPIClient/Object/Foo.pm +lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm lib/WWW/OpenAPIClient/Object/FormatTest.pm lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm -lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm lib/WWW/OpenAPIClient/Object/List.pm lib/WWW/OpenAPIClient/Object/MapTest.pm lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 6d6bf7fccd9..6dbce48497d 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -264,10 +264,10 @@ use WWW::OpenAPIClient::Object::EnumTest; use WWW::OpenAPIClient::Object::File; use WWW::OpenAPIClient::Object::FileSchemaTestClass; use WWW::OpenAPIClient::Object::Foo; +use WWW::OpenAPIClient::Object::FooGetDefaultResponse; use WWW::OpenAPIClient::Object::FormatTest; use WWW::OpenAPIClient::Object::HasOnlyReadOnly; use WWW::OpenAPIClient::Object::HealthCheckResult; -use WWW::OpenAPIClient::Object::InlineResponseDefault; use WWW::OpenAPIClient::Object::List; use WWW::OpenAPIClient::Object::MapTest; use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass; @@ -332,10 +332,10 @@ use WWW::OpenAPIClient::Object::EnumTest; use WWW::OpenAPIClient::Object::File; use WWW::OpenAPIClient::Object::FileSchemaTestClass; use WWW::OpenAPIClient::Object::Foo; +use WWW::OpenAPIClient::Object::FooGetDefaultResponse; use WWW::OpenAPIClient::Object::FormatTest; use WWW::OpenAPIClient::Object::HasOnlyReadOnly; use WWW::OpenAPIClient::Object::HealthCheckResult; -use WWW::OpenAPIClient::Object::InlineResponseDefault; use WWW::OpenAPIClient::Object::List; use WWW::OpenAPIClient::Object::MapTest; use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass; @@ -450,10 +450,10 @@ Class | Method | HTTP request | Description - [WWW::OpenAPIClient::Object::File](docs/File.md) - [WWW::OpenAPIClient::Object::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [WWW::OpenAPIClient::Object::Foo](docs/Foo.md) + - [WWW::OpenAPIClient::Object::FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [WWW::OpenAPIClient::Object::FormatTest](docs/FormatTest.md) - [WWW::OpenAPIClient::Object::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [WWW::OpenAPIClient::Object::HealthCheckResult](docs/HealthCheckResult.md) - - [WWW::OpenAPIClient::Object::InlineResponseDefault](docs/InlineResponseDefault.md) - [WWW::OpenAPIClient::Object::List](docs/List.md) - [WWW::OpenAPIClient::Object::MapTest](docs/MapTest.md) - [WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/perl/docs/DefaultApi.md b/samples/client/petstore/perl/docs/DefaultApi.md index c7ad7536631..d93ff81b604 100644 --- a/samples/client/petstore/perl/docs/DefaultApi.md +++ b/samples/client/petstore/perl/docs/DefaultApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **foo_get** -> InlineResponseDefault foo_get() +> FooGetDefaultResponse foo_get() @@ -39,7 +39,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/perl/docs/FooGetDefaultResponse.md b/samples/client/petstore/perl/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..b2af475a9ea --- /dev/null +++ b/samples/client/petstore/perl/docs/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::FooGetDefaultResponse + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::FooGetDefaultResponse; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [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/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm index 83256b8931f..b70e03588e4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm @@ -59,10 +59,10 @@ sub new { __PACKAGE__->method_documentation->{ 'foo_get' } = { summary => '', params => $params, - returns => 'InlineResponseDefault', + returns => 'FooGetDefaultResponse', }; } -# @return InlineResponseDefault +# @return FooGetDefaultResponse # sub foo_get { my ($self, %args) = @_; @@ -93,7 +93,7 @@ sub foo_get { if (!$response) { return; } - my $_response_object = $self->{api_client}->deserialize('InlineResponseDefault', $response); + my $_response_object = $self->{api_client}->deserialize('FooGetDefaultResponse', $response); return $_response_object; } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm new file mode 100644 index 00000000000..55ef2490ba9 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm @@ -0,0 +1,184 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::FooGetDefaultResponse; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use WWW::OpenAPIClient::Object::Foo; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + +__PACKAGE__->class_documentation({description => '', + class => 'FooGetDefaultResponse', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'string' => { + datatype => 'Foo', + base_name => 'string', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'string' => 'Foo' +} ); + +__PACKAGE__->attribute_map( { + 'string' => 'string' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/t/FooGetDefaultResponseTest.t b/samples/client/petstore/perl/t/FooGetDefaultResponseTest.t new file mode 100644 index 00000000000..407f118a09f --- /dev/null +++ b/samples/client/petstore/perl/t/FooGetDefaultResponseTest.t @@ -0,0 +1,34 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::FooGetDefaultResponse'); + +# uncomment below and update the test +#my $instance = WWW::OpenAPIClient::Object::FooGetDefaultResponse->new(); +# +#isa_ok($instance, 'WWW::OpenAPIClient::Object::FooGetDefaultResponse'); + diff --git a/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES b/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES index 789b9f71e58..da556bb1e43 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES +++ b/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES @@ -32,10 +32,10 @@ docs/Model/EnumTest.md docs/Model/File.md docs/Model/FileSchemaTestClass.md docs/Model/Foo.md +docs/Model/FooGetDefaultResponse.md docs/Model/FormatTest.md docs/Model/HasOnlyReadOnly.md docs/Model/HealthCheckResult.md -docs/Model/InlineResponseDefault.md docs/Model/MapTest.md docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md docs/Model/Model200Response.md @@ -91,10 +91,10 @@ lib/Model/EnumTest.php lib/Model/File.php lib/Model/FileSchemaTestClass.php lib/Model/Foo.php +lib/Model/FooGetDefaultResponse.php lib/Model/FormatTest.php lib/Model/HasOnlyReadOnly.php lib/Model/HealthCheckResult.php -lib/Model/InlineResponseDefault.php lib/Model/MapTest.php lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php lib/Model/Model200Response.php diff --git a/samples/client/petstore/php/OpenAPIClient-php/README.md b/samples/client/petstore/php/OpenAPIClient-php/README.md index d59fd1a9875..f414f31e68e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php/OpenAPIClient-php/README.md @@ -138,10 +138,10 @@ Class | Method | HTTP request | Description - [File](docs/Model/File.md) - [FileSchemaTestClass](docs/Model/FileSchemaTestClass.md) - [Foo](docs/Model/Foo.md) +- [FooGetDefaultResponse](docs/Model/FooGetDefaultResponse.md) - [FormatTest](docs/Model/FormatTest.md) - [HasOnlyReadOnly](docs/Model/HasOnlyReadOnly.md) - [HealthCheckResult](docs/Model/HealthCheckResult.md) -- [InlineResponseDefault](docs/Model/InlineResponseDefault.md) - [MapTest](docs/Model/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model/Model200Response.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md index 020bf4d8fb8..6de004c507f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/DefaultApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## `fooGet()` ```php -fooGet(): \OpenAPI\Client\Model\InlineResponseDefault +fooGet(): \OpenAPI\Client\Model\FooGetDefaultResponse ``` @@ -43,7 +43,7 @@ This endpoint does not need any parameter. ### Return type -[**\OpenAPI\Client\Model\InlineResponseDefault**](../Model/InlineResponseDefault.md) +[**\OpenAPI\Client\Model\FooGetDefaultResponse**](../Model/FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/FooGetDefaultResponse.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/FooGetDefaultResponse.md new file mode 100644 index 00000000000..2e3ee6f6830 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/FooGetDefaultResponse.md @@ -0,0 +1,9 @@ +# # FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**\OpenAPI\Client\Model\Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index 0fe55677acf..e7bb5466969 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -121,7 +121,7 @@ class DefaultApi * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\InlineResponseDefault + * @return \OpenAPI\Client\Model\FooGetDefaultResponse */ public function fooGet() { @@ -135,7 +135,7 @@ class DefaultApi * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\InlineResponseDefault, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\FooGetDefaultResponse, HTTP status code, HTTP response headers (array of strings) */ public function fooGetWithHttpInfo() { @@ -178,23 +178,23 @@ class DefaultApi switch($statusCode) { default: - if ('\OpenAPI\Client\Model\InlineResponseDefault' === '\SplFileObject') { + if ('\OpenAPI\Client\Model\FooGetDefaultResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\InlineResponseDefault' !== 'string') { + if ('\OpenAPI\Client\Model\FooGetDefaultResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InlineResponseDefault', []), + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\FooGetDefaultResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\OpenAPI\Client\Model\InlineResponseDefault'; + $returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -215,7 +215,7 @@ class DefaultApi default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\OpenAPI\Client\Model\InlineResponseDefault', + '\OpenAPI\Client\Model\FooGetDefaultResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -251,7 +251,7 @@ class DefaultApi */ public function fooGetAsyncWithHttpInfo() { - $returnType = '\OpenAPI\Client\Model\InlineResponseDefault'; + $returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse'; $request = $this->fooGetRequest(); return $this->client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FooGetDefaultResponse.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FooGetDefaultResponse.php new file mode 100644 index 00000000000..3746ab940f3 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FooGetDefaultResponse.php @@ -0,0 +1,322 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_foo_get_default_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'string' => '\OpenAPI\Client\Model\Foo' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'string' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'string' => 'string' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'string' => 'setString' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'string' => 'getString' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['string'] = $data['string'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets string + * + * @return \OpenAPI\Client\Model\Foo|null + */ + public function getString() + { + return $this->container['string']; + } + + /** + * Sets string + * + * @param \OpenAPI\Client\Model\Foo|null $string string + * + * @return self + */ + public function setString($string) + { + $this->container['string'] = $string; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/OpenAPIClient-php/test/Model/FooGetDefaultResponseTest.php b/samples/client/petstore/php/OpenAPIClient-php/test/Model/FooGetDefaultResponseTest.php new file mode 100644 index 00000000000..b7e0e6e21fc --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/test/Model/FooGetDefaultResponseTest.php @@ -0,0 +1,90 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "string" + */ + public function testPropertyString() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/samples/client/petstore/powershell/.openapi-generator/FILES b/samples/client/petstore/powershell/.openapi-generator/FILES index a23fa36f7ee..f6ca4bc67ce 100644 --- a/samples/client/petstore/powershell/.openapi-generator/FILES +++ b/samples/client/petstore/powershell/.openapi-generator/FILES @@ -31,6 +31,7 @@ docs/EquilateralTriangle.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -38,7 +39,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/List.md docs/Mammal.md @@ -116,6 +116,7 @@ src/PSPetstore/Model/EquilateralTriangle.ps1 src/PSPetstore/Model/File.ps1 src/PSPetstore/Model/FileSchemaTestClass.ps1 src/PSPetstore/Model/Foo.ps1 +src/PSPetstore/Model/FooGetDefaultResponse.ps1 src/PSPetstore/Model/FormatTest.ps1 src/PSPetstore/Model/Fruit.ps1 src/PSPetstore/Model/FruitReq.ps1 @@ -123,7 +124,6 @@ src/PSPetstore/Model/GmFruit.ps1 src/PSPetstore/Model/GrandparentAnimal.ps1 src/PSPetstore/Model/HasOnlyReadOnly.ps1 src/PSPetstore/Model/HealthCheckResult.ps1 -src/PSPetstore/Model/InlineResponseDefault.ps1 src/PSPetstore/Model/IsoscelesTriangle.ps1 src/PSPetstore/Model/List.ps1 src/PSPetstore/Model/Mammal.ps1 diff --git a/samples/client/petstore/powershell/README.md b/samples/client/petstore/powershell/README.md index f62e510dd22..624961c0052 100644 --- a/samples/client/petstore/powershell/README.md +++ b/samples/client/petstore/powershell/README.md @@ -127,6 +127,7 @@ Class | Method | HTTP request | Description - [PSPetstore/Model.File](docs/File.md) - [PSPetstore/Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [PSPetstore/Model.Foo](docs/Foo.md) + - [PSPetstore/Model.FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [PSPetstore/Model.FormatTest](docs/FormatTest.md) - [PSPetstore/Model.Fruit](docs/Fruit.md) - [PSPetstore/Model.FruitReq](docs/FruitReq.md) @@ -134,7 +135,6 @@ Class | Method | HTTP request | Description - [PSPetstore/Model.GrandparentAnimal](docs/GrandparentAnimal.md) - [PSPetstore/Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [PSPetstore/Model.HealthCheckResult](docs/HealthCheckResult.md) - - [PSPetstore/Model.InlineResponseDefault](docs/InlineResponseDefault.md) - [PSPetstore/Model.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [PSPetstore/Model.List](docs/List.md) - [PSPetstore/Model.Mammal](docs/Mammal.md) diff --git a/samples/client/petstore/powershell/docs/FooGetDefaultResponse.md b/samples/client/petstore/powershell/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..f09cf34ba05 --- /dev/null +++ b/samples/client/petstore/powershell/docs/FooGetDefaultResponse.md @@ -0,0 +1,21 @@ +# FooGetDefaultResponse +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +## Examples + +- Prepare the resource +```powershell +$FooGetDefaultResponse = Initialize-PSPetstoreFooGetDefaultResponse -String null +``` + +- Convert the resource to JSON +```powershell +$FooGetDefaultResponse | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/powershell/docs/PSDefaultApi.md b/samples/client/petstore/powershell/docs/PSDefaultApi.md index 9c10aff593b..bdcbdbc4443 100644 --- a/samples/client/petstore/powershell/docs/PSDefaultApi.md +++ b/samples/client/petstore/powershell/docs/PSDefaultApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **Invoke-PSFooGet** -> InlineResponseDefault Invoke-PSFooGet
+> FooGetDefaultResponse Invoke-PSFooGet
@@ -29,7 +29,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) (PSCustomObject) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) (PSCustomObject) ### Authorization diff --git a/samples/client/petstore/powershell/src/PSPetstore/Api/PSDefaultApi.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Api/PSDefaultApi.ps1 index 9153f38bcc3..66a971b0bbd 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Api/PSDefaultApi.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Api/PSDefaultApi.ps1 @@ -20,7 +20,7 @@ A switch when turned on will return a hash table of Response, StatusCode and Hea .OUTPUTS -InlineResponseDefault +FooGetDefaultResponse #> function Invoke-PSFooGet { [CmdletBinding()] @@ -57,7 +57,7 @@ function Invoke-PSFooGet { -QueryParameters $LocalVarQueryParameters ` -FormParameters $LocalVarFormParameters ` -CookieParameters $LocalVarCookieParameters ` - -ReturnType "InlineResponseDefault" ` + -ReturnType "FooGetDefaultResponse" ` -IsBodyNullable $false if ($WithHttpInfo.IsPresent) { diff --git a/samples/client/petstore/powershell/src/PSPetstore/Model/FooGetDefaultResponse.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Model/FooGetDefaultResponse.ps1 new file mode 100644 index 00000000000..112ec693815 --- /dev/null +++ b/samples/client/petstore/powershell/src/PSPetstore/Model/FooGetDefaultResponse.ps1 @@ -0,0 +1,97 @@ +# +# OpenAPI Petstore +# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER String +No description available. +.OUTPUTS + +FooGetDefaultResponse +#> + +function Initialize-PSFooGetDefaultResponse { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [PSCustomObject] + ${String} + ) + + Process { + 'Creating PSCustomObject: PSPetstore => PSFooGetDefaultResponse' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "string" = ${String} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to FooGetDefaultResponse + +.DESCRIPTION + +Convert from JSON to FooGetDefaultResponse + +.PARAMETER Json + +Json object + +.OUTPUTS + +FooGetDefaultResponse +#> +function ConvertFrom-PSJsonToFooGetDefaultResponse { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSPetstore => PSFooGetDefaultResponse' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in PSFooGetDefaultResponse + $AllProperties = ("string") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "string"))) { #optional property not found + $String = $null + } else { + $String = $JsonParameters.PSobject.Properties["string"].value + } + + $PSO = [PSCustomObject]@{ + "string" = ${String} + } + + return $PSO + } + +} + diff --git a/samples/client/petstore/powershell/tests/Model/FooGetDefaultResponse.Tests.ps1 b/samples/client/petstore/powershell/tests/Model/FooGetDefaultResponse.Tests.ps1 new file mode 100644 index 00000000000..625047184df --- /dev/null +++ b/samples/client/petstore/powershell/tests/Model/FooGetDefaultResponse.Tests.ps1 @@ -0,0 +1,17 @@ +# +# OpenAPI Petstore +# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \ +# Version: 1.0.0 +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSPetstore' -name 'PSFooGetDefaultResponse' { + Context 'PSFooGetDefaultResponse' { + It 'Initialize-PSFooGetDefaultResponse' { + # a simple test to create an object + #$NewObject = Initialize-PSFooGetDefaultResponse -String "TEST_VALUE" + #$NewObject | Should -BeOfType FooGetDefaultResponse + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES index 754556bc311..4745216bb71 100644 --- a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES +++ b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES @@ -31,10 +31,10 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -94,10 +94,10 @@ lib/petstore/models/enum_test.rb lib/petstore/models/file.rb lib/petstore/models/file_schema_test_class.rb lib/petstore/models/foo.rb +lib/petstore/models/foo_get_default_response.rb lib/petstore/models/format_test.rb lib/petstore/models/has_only_read_only.rb lib/petstore/models/health_check_result.rb -lib/petstore/models/inline_response_default.rb lib/petstore/models/list.rb lib/petstore/models/map_test.rb lib/petstore/models/mixed_properties_and_additional_properties_class.rb diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index 9eaef0f4384..bd15c2fd793 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -142,10 +142,10 @@ Class | Method | HTTP request | Description - [Petstore::File](docs/File.md) - [Petstore::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Petstore::Foo](docs/Foo.md) + - [Petstore::FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Petstore::FormatTest](docs/FormatTest.md) - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Petstore::HealthCheckResult](docs/HealthCheckResult.md) - - [Petstore::InlineResponseDefault](docs/InlineResponseDefault.md) - [Petstore::List](docs/List.md) - [Petstore::MapTest](docs/MapTest.md) - [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/ruby-faraday/docs/DefaultApi.md b/samples/client/petstore/ruby-faraday/docs/DefaultApi.md index e53f6a6971b..86925bb7c88 100644 --- a/samples/client/petstore/ruby-faraday/docs/DefaultApi.md +++ b/samples/client/petstore/ruby-faraday/docs/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* ## foo_get -> foo_get +> foo_get @@ -34,7 +34,7 @@ end This returns an Array which contains the response data, status code and headers. -> , Integer, Hash)> foo_get_with_http_info +> , Integer, Hash)> foo_get_with_http_info ```ruby begin @@ -42,7 +42,7 @@ begin data, status_code, headers = api_instance.foo_get_with_http_info p status_code # => 2xx p headers # => { ... } - p data # => + p data # => rescue Petstore::ApiError => e puts "Error when calling DefaultApi->foo_get_with_http_info: #{e}" end @@ -54,7 +54,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/ruby-faraday/docs/FooGetDefaultResponse.md b/samples/client/petstore/ruby-faraday/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..915e059d924 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/FooGetDefaultResponse.md @@ -0,0 +1,18 @@ +# Petstore::FooGetDefaultResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **string** | [**Foo**](Foo.md) | | [optional] | + +## Example + +```ruby +require 'petstore' + +instance = Petstore::FooGetDefaultResponse.new( + string: null +) +``` + diff --git a/samples/client/petstore/ruby-faraday/lib/petstore.rb b/samples/client/petstore/ruby-faraday/lib/petstore.rb index a9c50fce10f..e611e974b49 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore.rb @@ -37,10 +37,10 @@ require 'petstore/models/enum_test' require 'petstore/models/file' require 'petstore/models/file_schema_test_class' require 'petstore/models/foo' +require 'petstore/models/foo_get_default_response' require 'petstore/models/format_test' require 'petstore/models/has_only_read_only' require 'petstore/models/health_check_result' -require 'petstore/models/inline_response_default' require 'petstore/models/list' require 'petstore/models/map_test' require 'petstore/models/mixed_properties_and_additional_properties_class' diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb index 2d2b7da307e..2d00e6603b2 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/default_api.rb @@ -20,14 +20,14 @@ module Petstore @api_client = api_client end # @param [Hash] opts the optional parameters - # @return [InlineResponseDefault] + # @return [FooGetDefaultResponse] def foo_get(opts = {}) data, _status_code, _headers = foo_get_with_http_info(opts) data end # @param [Hash] opts the optional parameters - # @return [Array<(InlineResponseDefault, Integer, Hash)>] InlineResponseDefault data, response status code and response headers + # @return [Array<(FooGetDefaultResponse, Integer, Hash)>] FooGetDefaultResponse data, response status code and response headers def foo_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.foo_get ...' @@ -50,7 +50,7 @@ module Petstore post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'InlineResponseDefault' + return_type = opts[:debug_return_type] || 'FooGetDefaultResponse' # auth_names auth_names = opts[:debug_auth_names] || [] diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/foo_get_default_response.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/foo_get_default_response.rb new file mode 100644 index 00000000000..345ff99ae44 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/foo_get_default_response.rb @@ -0,0 +1,219 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Petstore + class FooGetDefaultResponse + attr_accessor :string + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'string' => :'string' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'string' => :'Foo' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::FooGetDefaultResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'string') + self.string = attributes[:'string'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + string == o.string + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [string].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Petstore.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby-faraday/spec/models/inline_response_default_spec.rb b/samples/client/petstore/ruby-faraday/spec/models/foo_get_default_response_spec.rb similarity index 62% rename from samples/client/petstore/ruby-faraday/spec/models/inline_response_default_spec.rb rename to samples/client/petstore/ruby-faraday/spec/models/foo_get_default_response_spec.rb index 0174b9efd3b..98a41243fe1 100644 --- a/samples/client/petstore/ruby-faraday/spec/models/inline_response_default_spec.rb +++ b/samples/client/petstore/ruby-faraday/spec/models/foo_get_default_response_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 5.0.0-SNAPSHOT +OpenAPI Generator version: 6.0.0-SNAPSHOT =end @@ -14,15 +14,15 @@ require 'spec_helper' require 'json' require 'date' -# Unit tests for Petstore::InlineResponseDefault +# Unit tests for Petstore::FooGetDefaultResponse # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate -describe Petstore::InlineResponseDefault do - let(:instance) { Petstore::InlineResponseDefault.new } +describe Petstore::FooGetDefaultResponse do + let(:instance) { Petstore::FooGetDefaultResponse.new } - describe 'test an instance of InlineResponseDefault' do - it 'should create an instance of InlineResponseDefault' do - expect(instance).to be_instance_of(Petstore::InlineResponseDefault) + describe 'test an instance of FooGetDefaultResponse' do + it 'should create an instance of FooGetDefaultResponse' do + expect(instance).to be_instance_of(Petstore::FooGetDefaultResponse) end end describe 'test attribute "string"' do diff --git a/samples/client/petstore/ruby/.openapi-generator/FILES b/samples/client/petstore/ruby/.openapi-generator/FILES index 754556bc311..4745216bb71 100644 --- a/samples/client/petstore/ruby/.openapi-generator/FILES +++ b/samples/client/petstore/ruby/.openapi-generator/FILES @@ -31,10 +31,10 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -94,10 +94,10 @@ lib/petstore/models/enum_test.rb lib/petstore/models/file.rb lib/petstore/models/file_schema_test_class.rb lib/petstore/models/foo.rb +lib/petstore/models/foo_get_default_response.rb lib/petstore/models/format_test.rb lib/petstore/models/has_only_read_only.rb lib/petstore/models/health_check_result.rb -lib/petstore/models/inline_response_default.rb lib/petstore/models/list.rb lib/petstore/models/map_test.rb lib/petstore/models/mixed_properties_and_additional_properties_class.rb diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 9eaef0f4384..bd15c2fd793 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -142,10 +142,10 @@ Class | Method | HTTP request | Description - [Petstore::File](docs/File.md) - [Petstore::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Petstore::Foo](docs/Foo.md) + - [Petstore::FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [Petstore::FormatTest](docs/FormatTest.md) - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Petstore::HealthCheckResult](docs/HealthCheckResult.md) - - [Petstore::InlineResponseDefault](docs/InlineResponseDefault.md) - [Petstore::List](docs/List.md) - [Petstore::MapTest](docs/MapTest.md) - [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/client/petstore/ruby/docs/DefaultApi.md b/samples/client/petstore/ruby/docs/DefaultApi.md index e53f6a6971b..86925bb7c88 100644 --- a/samples/client/petstore/ruby/docs/DefaultApi.md +++ b/samples/client/petstore/ruby/docs/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* ## foo_get -> foo_get +> foo_get @@ -34,7 +34,7 @@ end This returns an Array which contains the response data, status code and headers. -> , Integer, Hash)> foo_get_with_http_info +> , Integer, Hash)> foo_get_with_http_info ```ruby begin @@ -42,7 +42,7 @@ begin data, status_code, headers = api_instance.foo_get_with_http_info p status_code # => 2xx p headers # => { ... } - p data # => + p data # => rescue Petstore::ApiError => e puts "Error when calling DefaultApi->foo_get_with_http_info: #{e}" end @@ -54,7 +54,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/client/petstore/ruby/docs/FooGetDefaultResponse.md b/samples/client/petstore/ruby/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..915e059d924 --- /dev/null +++ b/samples/client/petstore/ruby/docs/FooGetDefaultResponse.md @@ -0,0 +1,18 @@ +# Petstore::FooGetDefaultResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **string** | [**Foo**](Foo.md) | | [optional] | + +## Example + +```ruby +require 'petstore' + +instance = Petstore::FooGetDefaultResponse.new( + string: null +) +``` + diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index a9c50fce10f..e611e974b49 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -37,10 +37,10 @@ require 'petstore/models/enum_test' require 'petstore/models/file' require 'petstore/models/file_schema_test_class' require 'petstore/models/foo' +require 'petstore/models/foo_get_default_response' require 'petstore/models/format_test' require 'petstore/models/has_only_read_only' require 'petstore/models/health_check_result' -require 'petstore/models/inline_response_default' require 'petstore/models/list' require 'petstore/models/map_test' require 'petstore/models/mixed_properties_and_additional_properties_class' diff --git a/samples/client/petstore/ruby/lib/petstore/api/default_api.rb b/samples/client/petstore/ruby/lib/petstore/api/default_api.rb index 2d2b7da307e..2d00e6603b2 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/default_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/default_api.rb @@ -20,14 +20,14 @@ module Petstore @api_client = api_client end # @param [Hash] opts the optional parameters - # @return [InlineResponseDefault] + # @return [FooGetDefaultResponse] def foo_get(opts = {}) data, _status_code, _headers = foo_get_with_http_info(opts) data end # @param [Hash] opts the optional parameters - # @return [Array<(InlineResponseDefault, Integer, Hash)>] InlineResponseDefault data, response status code and response headers + # @return [Array<(FooGetDefaultResponse, Integer, Hash)>] FooGetDefaultResponse data, response status code and response headers def foo_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.foo_get ...' @@ -50,7 +50,7 @@ module Petstore post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'InlineResponseDefault' + return_type = opts[:debug_return_type] || 'FooGetDefaultResponse' # auth_names auth_names = opts[:debug_auth_names] || [] diff --git a/samples/client/petstore/ruby/lib/petstore/models/foo_get_default_response.rb b/samples/client/petstore/ruby/lib/petstore/models/foo_get_default_response.rb new file mode 100644 index 00000000000..345ff99ae44 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/foo_get_default_response.rb @@ -0,0 +1,219 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Petstore + class FooGetDefaultResponse + attr_accessor :string + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'string' => :'string' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'string' => :'Foo' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::FooGetDefaultResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'string') + self.string = attributes[:'string'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + string == o.string + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [string].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Petstore.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby/spec/models/inline_response_default_spec.rb b/samples/client/petstore/ruby/spec/models/foo_get_default_response_spec.rb similarity index 62% rename from samples/client/petstore/ruby/spec/models/inline_response_default_spec.rb rename to samples/client/petstore/ruby/spec/models/foo_get_default_response_spec.rb index 0174b9efd3b..98a41243fe1 100644 --- a/samples/client/petstore/ruby/spec/models/inline_response_default_spec.rb +++ b/samples/client/petstore/ruby/spec/models/foo_get_default_response_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 5.0.0-SNAPSHOT +OpenAPI Generator version: 6.0.0-SNAPSHOT =end @@ -14,15 +14,15 @@ require 'spec_helper' require 'json' require 'date' -# Unit tests for Petstore::InlineResponseDefault +# Unit tests for Petstore::FooGetDefaultResponse # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate -describe Petstore::InlineResponseDefault do - let(:instance) { Petstore::InlineResponseDefault.new } +describe Petstore::FooGetDefaultResponse do + let(:instance) { Petstore::FooGetDefaultResponse.new } - describe 'test an instance of InlineResponseDefault' do - it 'should create an instance of InlineResponseDefault' do - expect(instance).to be_instance_of(Petstore::InlineResponseDefault) + describe 'test an instance of FooGetDefaultResponse' do + it 'should create an instance of FooGetDefaultResponse' do + expect(instance).to be_instance_of(Petstore::FooGetDefaultResponse) end end describe 'test attribute "string"' do diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts index 9b31941c69e..2d67e559471 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/api.ts @@ -117,61 +117,16 @@ export const DogAllOfBreedEnum = { export type DogAllOfBreedEnum = typeof DogAllOfBreedEnum[keyof typeof DogAllOfBreedEnum]; -/** - * @type InlineRequest - * @export - */ -export type InlineRequest = Cat | Dog | any; - /** * * @export - * @interface InlineRequest1 + * @interface FilePostRequest */ -export interface InlineRequest1 { - /** - * - * @type {number} - * @memberof InlineRequest1 - */ - 'age': number; - /** - * - * @type {string} - * @memberof InlineRequest1 - */ - 'nickname'?: string; - /** - * - * @type {string} - * @memberof InlineRequest1 - */ - 'pet_type': InlineRequest1PetTypeEnum; - /** - * - * @type {boolean} - * @memberof InlineRequest1 - */ - 'hunts'?: boolean; -} - -export const InlineRequest1PetTypeEnum = { - Cat: 'Cat', - Dog: 'Dog' -} as const; - -export type InlineRequest1PetTypeEnum = typeof InlineRequest1PetTypeEnum[keyof typeof InlineRequest1PetTypeEnum]; - -/** - * - * @export - * @interface InlineRequest2 - */ -export interface InlineRequest2 { +export interface FilePostRequest { /** * * @type {any} - * @memberof InlineRequest2 + * @memberof FilePostRequest */ 'file'?: any; } @@ -221,6 +176,51 @@ export const PetByTypePetTypeEnum = { export type PetByTypePetTypeEnum = typeof PetByTypePetTypeEnum[keyof typeof PetByTypePetTypeEnum]; +/** + * + * @export + * @interface PetsFilteredPatchRequest + */ +export interface PetsFilteredPatchRequest { + /** + * + * @type {number} + * @memberof PetsFilteredPatchRequest + */ + 'age': number; + /** + * + * @type {string} + * @memberof PetsFilteredPatchRequest + */ + 'nickname'?: string; + /** + * + * @type {string} + * @memberof PetsFilteredPatchRequest + */ + 'pet_type': PetsFilteredPatchRequestPetTypeEnum; + /** + * + * @type {boolean} + * @memberof PetsFilteredPatchRequest + */ + 'hunts'?: boolean; +} + +export const PetsFilteredPatchRequestPetTypeEnum = { + Cat: 'Cat', + Dog: 'Dog' +} as const; + +export type PetsFilteredPatchRequestPetTypeEnum = typeof PetsFilteredPatchRequestPetTypeEnum[keyof typeof PetsFilteredPatchRequestPetTypeEnum]; + +/** + * @type PetsPatchRequest + * @export + */ +export type PetsPatchRequest = Cat | Dog | any; + /** * DefaultApi - axios parameter creator @@ -230,11 +230,11 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati return { /** * - * @param {InlineRequest2} [inlineRequest2] + * @param {FilePostRequest} [filePostRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - filePost: async (inlineRequest2?: InlineRequest2, options: AxiosRequestConfig = {}): Promise => { + filePost: async (filePostRequest?: FilePostRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/file`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -254,7 +254,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(inlineRequest2, localVarRequestOptions, configuration) + localVarRequestOptions.data = serializeDataIfNeeded(filePostRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), @@ -263,11 +263,11 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati }, /** * - * @param {InlineRequest1} [inlineRequest1] + * @param {PetsFilteredPatchRequest} [petsFilteredPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - petsFilteredPatch: async (inlineRequest1?: InlineRequest1, options: AxiosRequestConfig = {}): Promise => { + petsFilteredPatch: async (petsFilteredPatchRequest?: PetsFilteredPatchRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/pets-filtered`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -287,7 +287,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(inlineRequest1, localVarRequestOptions, configuration) + localVarRequestOptions.data = serializeDataIfNeeded(petsFilteredPatchRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), @@ -296,11 +296,11 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati }, /** * - * @param {InlineRequest} [inlineRequest] + * @param {PetsPatchRequest} [petsPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - petsPatch: async (inlineRequest?: InlineRequest, options: AxiosRequestConfig = {}): Promise => { + petsPatch: async (petsPatchRequest?: PetsPatchRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/pets`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -320,7 +320,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(inlineRequest, localVarRequestOptions, configuration) + localVarRequestOptions.data = serializeDataIfNeeded(petsPatchRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), @@ -339,32 +339,32 @@ export const DefaultApiFp = function(configuration?: Configuration) { return { /** * - * @param {InlineRequest2} [inlineRequest2] + * @param {FilePostRequest} [filePostRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async filePost(inlineRequest2?: InlineRequest2, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.filePost(inlineRequest2, options); + async filePost(filePostRequest?: FilePostRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.filePost(filePostRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * - * @param {InlineRequest1} [inlineRequest1] + * @param {PetsFilteredPatchRequest} [petsFilteredPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async petsFilteredPatch(inlineRequest1?: InlineRequest1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.petsFilteredPatch(inlineRequest1, options); + async petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.petsFilteredPatch(petsFilteredPatchRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * - * @param {InlineRequest} [inlineRequest] + * @param {PetsPatchRequest} [petsPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async petsPatch(inlineRequest?: InlineRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.petsPatch(inlineRequest, options); + async petsPatch(petsPatchRequest?: PetsPatchRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.petsPatch(petsPatchRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } @@ -379,30 +379,30 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa return { /** * - * @param {InlineRequest2} [inlineRequest2] + * @param {FilePostRequest} [filePostRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - filePost(inlineRequest2?: InlineRequest2, options?: any): AxiosPromise { - return localVarFp.filePost(inlineRequest2, options).then((request) => request(axios, basePath)); + filePost(filePostRequest?: FilePostRequest, options?: any): AxiosPromise { + return localVarFp.filePost(filePostRequest, options).then((request) => request(axios, basePath)); }, /** * - * @param {InlineRequest1} [inlineRequest1] + * @param {PetsFilteredPatchRequest} [petsFilteredPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - petsFilteredPatch(inlineRequest1?: InlineRequest1, options?: any): AxiosPromise { - return localVarFp.petsFilteredPatch(inlineRequest1, options).then((request) => request(axios, basePath)); + petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, options?: any): AxiosPromise { + return localVarFp.petsFilteredPatch(petsFilteredPatchRequest, options).then((request) => request(axios, basePath)); }, /** * - * @param {InlineRequest} [inlineRequest] + * @param {PetsPatchRequest} [petsPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - petsPatch(inlineRequest?: InlineRequest, options?: any): AxiosPromise { - return localVarFp.petsPatch(inlineRequest, options).then((request) => request(axios, basePath)); + petsPatch(petsPatchRequest?: PetsPatchRequest, options?: any): AxiosPromise { + return localVarFp.petsPatch(petsPatchRequest, options).then((request) => request(axios, basePath)); }, }; }; @@ -416,35 +416,35 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa export class DefaultApi extends BaseAPI { /** * - * @param {InlineRequest2} [inlineRequest2] + * @param {FilePostRequest} [filePostRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DefaultApi */ - public filePost(inlineRequest2?: InlineRequest2, options?: AxiosRequestConfig) { - return DefaultApiFp(this.configuration).filePost(inlineRequest2, options).then((request) => request(this.axios, this.basePath)); + public filePost(filePostRequest?: FilePostRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).filePost(filePostRequest, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {InlineRequest1} [inlineRequest1] + * @param {PetsFilteredPatchRequest} [petsFilteredPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DefaultApi */ - public petsFilteredPatch(inlineRequest1?: InlineRequest1, options?: AxiosRequestConfig) { - return DefaultApiFp(this.configuration).petsFilteredPatch(inlineRequest1, options).then((request) => request(this.axios, this.basePath)); + public petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).petsFilteredPatch(petsFilteredPatchRequest, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {InlineRequest} [inlineRequest] + * @param {PetsPatchRequest} [petsPatchRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DefaultApi */ - public petsPatch(inlineRequest?: InlineRequest, options?: AxiosRequestConfig) { - return DefaultApiFp(this.configuration).petsPatch(inlineRequest, options).then((request) => request(this.axios, this.basePath)); + public petsPatch(petsPatchRequest?: PetsPatchRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).petsPatch(petsPatchRequest, options).then((request) => request(this.axios, this.basePath)); } } 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 84e004fa465..572cae52236 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -718,6 +718,19 @@ export interface Foo { */ 'bar'?: string; } +/** + * + * @export + * @interface FooGetDefaultResponse + */ +export interface FooGetDefaultResponse { + /** + * + * @type {Foo} + * @memberof FooGetDefaultResponse + */ + 'string'?: Foo; +} /** * * @export @@ -909,19 +922,6 @@ export interface HealthCheckResult { */ 'NullableMessage'?: string | null; } -/** - * - * @export - * @interface InlineResponseDefault - */ -export interface InlineResponseDefault { - /** - * - * @type {Foo} - * @memberof InlineResponseDefault - */ - 'string'?: Foo; -} /** * * @export @@ -1888,7 +1888,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async fooGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async fooGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.fooGet(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1907,7 +1907,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa * @param {*} [options] Override http request option. * @throws {RequiredError} */ - fooGet(options?: any): AxiosPromise { + fooGet(options?: any): AxiosPromise { return localVarFp.fooGet(options).then((request) => request(axios, basePath)); }, }; 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 48600fbd098..011278f1efe 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 @@ -504,6 +504,19 @@ export interface Foo { */ 'bar'?: string; } +/** + * + * @export + * @interface FooGetDefaultResponse + */ +export interface FooGetDefaultResponse { + /** + * + * @type {Foo} + * @memberof FooGetDefaultResponse + */ + 'string'?: Foo; +} /** * * @export @@ -670,19 +683,6 @@ export interface HealthCheckResult { */ 'NullableMessage'?: string | null; } -/** - * - * @export - * @interface InlineResponseDefault - */ -export interface InlineResponseDefault { - /** - * - * @type {Foo} - * @memberof InlineResponseDefault - */ - 'string'?: Foo; -} /** * * @export @@ -1516,7 +1516,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async fooGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async fooGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.fooGet(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1535,7 +1535,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa * @param {*} [options] Override http request option. * @throws {RequiredError} */ - fooGet(options?: any): AxiosPromise { + fooGet(options?: any): AxiosPromise { return localVarFp.fooGet(options).then((request) => request(axios, basePath)); }, }; diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES index 69fb8d2039e..3c0152db6cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES @@ -27,10 +27,10 @@ models/EnumClass.ts models/EnumTest.ts models/FileSchemaTestClass.ts models/Foo.ts +models/FooGetDefaultResponse.ts models/FormatTest.ts models/HasOnlyReadOnly.ts models/HealthCheckResult.ts -models/InlineResponseDefault.ts models/List.ts models/MapTest.ts models/MixedPropertiesAndAdditionalPropertiesClass.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts index dda7b511ee3..5ba29721705 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/DefaultApi.ts @@ -15,9 +15,9 @@ import * as runtime from '../runtime'; import { - InlineResponseDefault, - InlineResponseDefaultFromJSON, - InlineResponseDefaultToJSON, + FooGetDefaultResponse, + FooGetDefaultResponseFromJSON, + FooGetDefaultResponseToJSON, } from '../models'; /** @@ -27,7 +27,7 @@ export class DefaultApi extends runtime.BaseAPI { /** */ - async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { + async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -39,12 +39,12 @@ export class DefaultApi extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponseDefaultFromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => FooGetDefaultResponseFromJSON(jsonValue)); } /** */ - async fooGet(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { + async fooGet(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { const response = await this.fooGetRaw(initOverrides); return await response.value(); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts new file mode 100644 index 00000000000..f6c439c1a08 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts @@ -0,0 +1,63 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import { + Foo, + FooFromJSON, + FooFromJSONTyped, + FooToJSON, +} from './Foo'; + +/** + * + * @export + * @interface FooGetDefaultResponse + */ +export interface FooGetDefaultResponse { + /** + * + * @type {Foo} + * @memberof FooGetDefaultResponse + */ + string?: Foo; +} + +export function FooGetDefaultResponseFromJSON(json: any): FooGetDefaultResponse { + return FooGetDefaultResponseFromJSONTyped(json, false); +} + +export function FooGetDefaultResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FooGetDefaultResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'string': !exists(json, 'string') ? undefined : FooFromJSON(json['string']), + }; +} + +export function FooGetDefaultResponseToJSON(value?: FooGetDefaultResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'string': FooToJSON(value.string), + }; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts index aee3141e91d..7229eeb8e28 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts @@ -20,10 +20,10 @@ export * from './EnumClass'; export * from './EnumTest'; export * from './FileSchemaTestClass'; export * from './Foo'; +export * from './FooGetDefaultResponse'; export * from './FormatTest'; export * from './HasOnlyReadOnly'; export * from './HealthCheckResult'; -export * from './InlineResponseDefault'; export * from './List'; export * from './MapTest'; export * from './MixedPropertiesAndAdditionalPropertiesClass'; diff --git a/samples/client/petstore/typescript-fetch/builds/enum/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/enum/.openapi-generator/FILES index 3616189dc87..f237d91aea4 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/enum/.openapi-generator/FILES @@ -2,8 +2,7 @@ apis/DefaultApi.ts apis/index.ts index.ts models/EnumPatternObject.ts -models/FakeEnumRequestPostInlineRequest.ts -models/InlineResponse200.ts +models/FakeEnumRequestGetInline200Response.ts models/NumberEnum.ts models/StringEnum.ts models/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts index 3d55e7a55ca..f558a4af5b5 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/apis/DefaultApi.ts @@ -18,12 +18,9 @@ import { EnumPatternObject, EnumPatternObjectFromJSON, EnumPatternObjectToJSON, - FakeEnumRequestPostInlineRequest, - FakeEnumRequestPostInlineRequestFromJSON, - FakeEnumRequestPostInlineRequestToJSON, - InlineResponse200, - InlineResponse200FromJSON, - InlineResponse200ToJSON, + FakeEnumRequestGetInline200Response, + FakeEnumRequestGetInline200ResponseFromJSON, + FakeEnumRequestGetInline200ResponseToJSON, NumberEnum, NumberEnumFromJSON, NumberEnumToJSON, @@ -46,8 +43,8 @@ export interface FakeEnumRequestGetRefRequest { nullableNumberEnum?: NumberEnum | null; } -export interface FakeEnumRequestPostInlineOperationRequest { - fakeEnumRequestPostInlineRequest?: FakeEnumRequestPostInlineRequest; +export interface FakeEnumRequestPostInlineRequest { + fakeEnumRequestGetInline200Response?: FakeEnumRequestGetInline200Response; } export interface FakeEnumRequestPostRefRequest { @@ -61,7 +58,7 @@ export class DefaultApi extends runtime.BaseAPI { /** */ - async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { + async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { const queryParameters: any = {}; if (requestParameters.stringEnum !== undefined) { @@ -89,12 +86,12 @@ export class DefaultApi extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse200FromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } /** */ - async fakeEnumRequestGetInline(requestParameters: FakeEnumRequestGetInlineRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { + async fakeEnumRequestGetInline(requestParameters: FakeEnumRequestGetInlineRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { const response = await this.fakeEnumRequestGetInlineRaw(requestParameters, initOverrides); return await response.value(); } @@ -141,7 +138,7 @@ export class DefaultApi extends runtime.BaseAPI { /** */ - async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineOperationRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { + async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -153,15 +150,15 @@ export class DefaultApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: FakeEnumRequestPostInlineRequestToJSON(requestParameters.fakeEnumRequestPostInlineRequest), + body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters.fakeEnumRequestGetInline200Response), }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse200FromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } /** */ - async fakeEnumRequestPostInline(requestParameters: FakeEnumRequestPostInlineOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { + async fakeEnumRequestPostInline(requestParameters: FakeEnumRequestPostInlineRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { const response = await this.fakeEnumRequestPostInlineRaw(requestParameters, initOverrides); return await response.value(); } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts new file mode 100644 index 00000000000..34cbe964c28 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -0,0 +1,122 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Enum test + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface FakeEnumRequestGetInline200Response + */ +export interface FakeEnumRequestGetInline200Response { + /** + * + * @type {string} + * @memberof FakeEnumRequestGetInline200Response + */ + stringEnum?: FakeEnumRequestGetInline200ResponseStringEnumEnum; + /** + * + * @type {string} + * @memberof FakeEnumRequestGetInline200Response + */ + nullableStringEnum?: FakeEnumRequestGetInline200ResponseNullableStringEnumEnum; + /** + * + * @type {number} + * @memberof FakeEnumRequestGetInline200Response + */ + numberEnum?: FakeEnumRequestGetInline200ResponseNumberEnumEnum; + /** + * + * @type {number} + * @memberof FakeEnumRequestGetInline200Response + */ + nullableNumberEnum?: FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum; +} + + +/** + * @export + */ +export const FakeEnumRequestGetInline200ResponseStringEnumEnum = { + One: 'one', + Two: 'two', + Three: 'three' +} as const; +export type FakeEnumRequestGetInline200ResponseStringEnumEnum = typeof FakeEnumRequestGetInline200ResponseStringEnumEnum[keyof typeof FakeEnumRequestGetInline200ResponseStringEnumEnum]; + +/** + * @export + */ +export const FakeEnumRequestGetInline200ResponseNullableStringEnumEnum = { + One: 'one', + Two: 'two', + Three: 'three' +} as const; +export type FakeEnumRequestGetInline200ResponseNullableStringEnumEnum = typeof FakeEnumRequestGetInline200ResponseNullableStringEnumEnum[keyof typeof FakeEnumRequestGetInline200ResponseNullableStringEnumEnum]; + +/** + * @export + */ +export const FakeEnumRequestGetInline200ResponseNumberEnumEnum = { + NUMBER_1: 1, + NUMBER_2: 2, + NUMBER_3: 3 +} as const; +export type FakeEnumRequestGetInline200ResponseNumberEnumEnum = typeof FakeEnumRequestGetInline200ResponseNumberEnumEnum[keyof typeof FakeEnumRequestGetInline200ResponseNumberEnumEnum]; + +/** + * @export + */ +export const FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum = { + NUMBER_1: 1, + NUMBER_2: 2, + NUMBER_3: 3 +} as const; +export type FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum = typeof FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum[keyof typeof FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum]; + + +export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnumRequestGetInline200Response { + return FakeEnumRequestGetInline200ResponseFromJSONTyped(json, false); +} + +export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FakeEnumRequestGetInline200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'stringEnum': !exists(json, 'string-enum') ? undefined : json['string-enum'], + 'nullableStringEnum': !exists(json, 'nullable-string-enum') ? undefined : json['nullable-string-enum'], + 'numberEnum': !exists(json, 'number-enum') ? undefined : json['number-enum'], + 'nullableNumberEnum': !exists(json, 'nullable-number-enum') ? undefined : json['nullable-number-enum'], + }; +} + +export function FakeEnumRequestGetInline200ResponseToJSON(value?: FakeEnumRequestGetInline200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'string-enum': value.stringEnum, + 'nullable-string-enum': value.nullableStringEnum, + 'number-enum': value.numberEnum, + 'nullable-number-enum': value.nullableNumberEnum, + }; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/index.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/index.ts index bad4b323c7f..e63381001b6 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/index.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/index.ts @@ -1,7 +1,6 @@ /* tslint:disable */ /* eslint-disable */ export * from './EnumPatternObject'; -export * from './FakeEnumRequestPostInlineRequest'; -export * from './InlineResponse200'; +export * from './FakeEnumRequestGetInline200Response'; export * from './NumberEnum'; export * from './StringEnum'; diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/with-string-enums/.openapi-generator/FILES index 3616189dc87..f237d91aea4 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/.openapi-generator/FILES @@ -2,8 +2,7 @@ apis/DefaultApi.ts apis/index.ts index.ts models/EnumPatternObject.ts -models/FakeEnumRequestPostInlineRequest.ts -models/InlineResponse200.ts +models/FakeEnumRequestGetInline200Response.ts models/NumberEnum.ts models/StringEnum.ts models/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts index 86fe32107ac..a0b27435bf2 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/apis/DefaultApi.ts @@ -18,12 +18,9 @@ import { EnumPatternObject, EnumPatternObjectFromJSON, EnumPatternObjectToJSON, - FakeEnumRequestPostInlineRequest, - FakeEnumRequestPostInlineRequestFromJSON, - FakeEnumRequestPostInlineRequestToJSON, - InlineResponse200, - InlineResponse200FromJSON, - InlineResponse200ToJSON, + FakeEnumRequestGetInline200Response, + FakeEnumRequestGetInline200ResponseFromJSON, + FakeEnumRequestGetInline200ResponseToJSON, NumberEnum, NumberEnumFromJSON, NumberEnumToJSON, @@ -46,8 +43,8 @@ export interface FakeEnumRequestGetRefRequest { nullableNumberEnum?: NumberEnum | null; } -export interface FakeEnumRequestPostInlineOperationRequest { - fakeEnumRequestPostInlineRequest?: FakeEnumRequestPostInlineRequest; +export interface FakeEnumRequestPostInlineRequest { + fakeEnumRequestGetInline200Response?: FakeEnumRequestGetInline200Response; } export interface FakeEnumRequestPostRefRequest { @@ -61,7 +58,7 @@ export class DefaultApi extends runtime.BaseAPI { /** */ - async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { + async fakeEnumRequestGetInlineRaw(requestParameters: FakeEnumRequestGetInlineRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { const queryParameters: any = {}; if (requestParameters.stringEnum !== undefined) { @@ -89,12 +86,12 @@ export class DefaultApi extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse200FromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } /** */ - async fakeEnumRequestGetInline(requestParameters: FakeEnumRequestGetInlineRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { + async fakeEnumRequestGetInline(requestParameters: FakeEnumRequestGetInlineRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { const response = await this.fakeEnumRequestGetInlineRaw(requestParameters, initOverrides); return await response.value(); } @@ -141,7 +138,7 @@ export class DefaultApi extends runtime.BaseAPI { /** */ - async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineOperationRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { + async fakeEnumRequestPostInlineRaw(requestParameters: FakeEnumRequestPostInlineRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -153,15 +150,15 @@ export class DefaultApi extends runtime.BaseAPI { method: 'POST', headers: headerParameters, query: queryParameters, - body: FakeEnumRequestPostInlineRequestToJSON(requestParameters.fakeEnumRequestPostInlineRequest), + body: FakeEnumRequestGetInline200ResponseToJSON(requestParameters.fakeEnumRequestGetInline200Response), }, initOverrides); - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse200FromJSON(jsonValue)); + return new runtime.JSONApiResponse(response, (jsonValue) => FakeEnumRequestGetInline200ResponseFromJSON(jsonValue)); } /** */ - async fakeEnumRequestPostInline(requestParameters: FakeEnumRequestPostInlineOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { + async fakeEnumRequestPostInline(requestParameters: FakeEnumRequestPostInlineRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise { const response = await this.fakeEnumRequestPostInlineRaw(requestParameters, initOverrides); return await response.value(); } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts new file mode 100644 index 00000000000..7f67ccd698c --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts @@ -0,0 +1,118 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Enum test + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface FakeEnumRequestGetInline200Response + */ +export interface FakeEnumRequestGetInline200Response { + /** + * + * @type {string} + * @memberof FakeEnumRequestGetInline200Response + */ + stringEnum?: FakeEnumRequestGetInline200ResponseStringEnumEnum; + /** + * + * @type {string} + * @memberof FakeEnumRequestGetInline200Response + */ + nullableStringEnum?: FakeEnumRequestGetInline200ResponseNullableStringEnumEnum; + /** + * + * @type {number} + * @memberof FakeEnumRequestGetInline200Response + */ + numberEnum?: FakeEnumRequestGetInline200ResponseNumberEnumEnum; + /** + * + * @type {number} + * @memberof FakeEnumRequestGetInline200Response + */ + nullableNumberEnum?: FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum; +} + +/** +* @export +* @enum {string} +*/ +export enum FakeEnumRequestGetInline200ResponseStringEnumEnum { + One = 'one', + Two = 'two', + Three = 'three' +} +/** +* @export +* @enum {string} +*/ +export enum FakeEnumRequestGetInline200ResponseNullableStringEnumEnum { + One = 'one', + Two = 'two', + Three = 'three' +} +/** +* @export +* @enum {string} +*/ +export enum FakeEnumRequestGetInline200ResponseNumberEnumEnum { + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3 +} +/** +* @export +* @enum {string} +*/ +export enum FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum { + NUMBER_1 = 1, + NUMBER_2 = 2, + NUMBER_3 = 3 +} + + +export function FakeEnumRequestGetInline200ResponseFromJSON(json: any): FakeEnumRequestGetInline200Response { + return FakeEnumRequestGetInline200ResponseFromJSONTyped(json, false); +} + +export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FakeEnumRequestGetInline200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'stringEnum': !exists(json, 'string-enum') ? undefined : json['string-enum'], + 'nullableStringEnum': !exists(json, 'nullable-string-enum') ? undefined : json['nullable-string-enum'], + 'numberEnum': !exists(json, 'number-enum') ? undefined : json['number-enum'], + 'nullableNumberEnum': !exists(json, 'nullable-number-enum') ? undefined : json['nullable-number-enum'], + }; +} + +export function FakeEnumRequestGetInline200ResponseToJSON(value?: FakeEnumRequestGetInline200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'string-enum': value.stringEnum, + 'nullable-string-enum': value.nullableStringEnum, + 'number-enum': value.numberEnum, + 'nullable-number-enum': value.nullableNumberEnum, + }; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/index.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/index.ts index bad4b323c7f..e63381001b6 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/index.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/index.ts @@ -1,7 +1,6 @@ /* tslint:disable */ /* eslint-disable */ export * from './EnumPatternObject'; -export * from './FakeEnumRequestPostInlineRequest'; -export * from './InlineResponse200'; +export * from './FakeEnumRequestGetInline200Response'; export * from './NumberEnum'; export * from './StringEnum'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES index 85246cb6d0e..b34094eb0a2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES @@ -25,10 +25,10 @@ doc/FakeApi.md doc/FakeClassnameTags123Api.md doc/FileSchemaTestClass.md doc/Foo.md +doc/FooGetDefaultResponse.md doc/FormatTest.md doc/HasOnlyReadOnly.md doc/HealthCheckResult.md -doc/InlineResponseDefault.md doc/MapTest.md doc/MixedPropertiesAndAdditionalPropertiesClass.md doc/Model200Response.md @@ -91,10 +91,10 @@ lib/src/model/enum_arrays.dart lib/src/model/enum_test.dart lib/src/model/file_schema_test_class.dart lib/src/model/foo.dart +lib/src/model/foo_get_default_response.dart lib/src/model/format_test.dart lib/src/model/has_only_read_only.dart lib/src/model/health_check_result.dart -lib/src/model/inline_response_default.dart lib/src/model/map_test.dart lib/src/model/mixed_properties_and_additional_properties_class.dart lib/src/model/model200_response.dart 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 ab3bada585c..0f37d116722 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 @@ -128,10 +128,10 @@ Class | Method | HTTP request | Description - [EnumTest](doc/EnumTest.md) - [FileSchemaTestClass](doc/FileSchemaTestClass.md) - [Foo](doc/Foo.md) + - [FooGetDefaultResponse](doc/FooGetDefaultResponse.md) - [FormatTest](doc/FormatTest.md) - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) - [HealthCheckResult](doc/HealthCheckResult.md) - - [InlineResponseDefault](doc/InlineResponseDefault.md) - [MapTest](doc/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](doc/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](doc/Model200Response.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/DefaultApi.md index f1753b62ee8..0bfa6194188 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/DefaultApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/DefaultApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **fooGet** -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -36,7 +36,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FooGetDefaultResponse.md new file mode 100644 index 00000000000..10d0133abd9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# openapi.model.FooGetDefaultResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [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/petstore_client_lib_fake-json_serializable/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart index 8b01a3a5e72..3beabf11dfc 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart @@ -35,10 +35,10 @@ export 'package:openapi/src/model/enum_arrays.dart'; export 'package:openapi/src/model/enum_test.dart'; export 'package:openapi/src/model/file_schema_test_class.dart'; export 'package:openapi/src/model/foo.dart'; +export 'package:openapi/src/model/foo_get_default_response.dart'; export 'package:openapi/src/model/format_test.dart'; export 'package:openapi/src/model/has_only_read_only.dart'; export 'package:openapi/src/model/health_check_result.dart'; -export 'package:openapi/src/model/inline_response_default.dart'; export 'package:openapi/src/model/map_test.dart'; export 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; export 'package:openapi/src/model/model200_response.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart index 50ad37daada..7d3bfdc51c3 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/default_api.dart @@ -9,7 +9,7 @@ import 'dart:convert'; import 'package:openapi/src/deserialize.dart'; import 'package:dio/dio.dart'; -import 'package:openapi/src/model/inline_response_default.dart'; +import 'package:openapi/src/model/foo_get_default_response.dart'; class DefaultApi { @@ -28,9 +28,9 @@ class DefaultApi { /// * [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] containing a [Response] with a [InlineResponseDefault] as data + /// Returns a [Future] containing a [Response] with a [FooGetDefaultResponse] as data /// Throws [DioError] if API call or serialization fails - Future> fooGet({ + Future> fooGet({ CancelToken? cancelToken, Map? headers, Map? extra, @@ -59,10 +59,10 @@ class DefaultApi { onReceiveProgress: onReceiveProgress, ); - InlineResponseDefault _responseData; + FooGetDefaultResponse _responseData; try { -_responseData = deserialize(_response.data!, 'InlineResponseDefault', growable: true); +_responseData = deserialize(_response.data!, 'FooGetDefaultResponse', growable: true); } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, @@ -72,7 +72,7 @@ _responseData = deserialize(_respo )..stackTrace = stackTrace; } - return Response( + return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart index a93a48b22aa..5460a3d223e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart @@ -17,10 +17,10 @@ import 'package:openapi/src/model/enum_arrays.dart'; import 'package:openapi/src/model/enum_test.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_get_default_response.dart'; import 'package:openapi/src/model/format_test.dart'; import 'package:openapi/src/model/has_only_read_only.dart'; import 'package:openapi/src/model/health_check_result.dart'; -import 'package:openapi/src/model/inline_response_default.dart'; import 'package:openapi/src/model/map_test.dart'; import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; import 'package:openapi/src/model/model200_response.dart'; @@ -97,14 +97,14 @@ final _regMap = RegExp(r'^Map$'); return FileSchemaTestClass.fromJson(value as Map) as ReturnType; case 'Foo': return Foo.fromJson(value as Map) as ReturnType; + case 'FooGetDefaultResponse': + return FooGetDefaultResponse.fromJson(value as Map) as ReturnType; case 'FormatTest': return FormatTest.fromJson(value as Map) as ReturnType; case 'HasOnlyReadOnly': return HasOnlyReadOnly.fromJson(value as Map) as ReturnType; case 'HealthCheckResult': return HealthCheckResult.fromJson(value as Map) as ReturnType; - case 'InlineResponseDefault': - return InlineResponseDefault.fromJson(value as Map) as ReturnType; case 'MapTest': return MapTest.fromJson(value as Map) as ReturnType; case 'MixedPropertiesAndAdditionalPropertiesClass': diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/foo_get_default_response.dart new file mode 100644 index 00000000000..423f93eb779 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/foo_get_default_response.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/model/foo.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_get_default_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooGetDefaultResponse { + /// Returns a new [FooGetDefaultResponse] instance. + FooGetDefaultResponse({ + + this.string, + }); + + @JsonKey( + + name: r'string', + required: false, + includeIfNull: false + ) + + + final Foo? string; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FooGetDefaultResponse && + other.string == string; + + @override + int get hashCode => + string.hashCode; + + factory FooGetDefaultResponse.fromJson(Map json) => _$FooGetDefaultResponseFromJson(json); + + Map toJson() => _$FooGetDefaultResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/foo_get_default_response_test.dart similarity index 60% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/inline_response_default_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/foo_get_default_response_test.dart index d57cafb1928..4282326fe61 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/inline_response_default_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/foo_get_default_response_test.dart @@ -1,12 +1,12 @@ import 'package:test/test.dart'; import 'package:openapi/openapi.dart'; -// tests for InlineResponseDefault +// tests for FooGetDefaultResponse void main() { - final InlineResponseDefault? instance = /* InlineResponseDefault(...) */ null; + final FooGetDefaultResponse? instance = /* FooGetDefaultResponse(...) */ null; // TODO add properties to the entity - group(InlineResponseDefault, () { + group(FooGetDefaultResponse, () { // Foo string test('to test the property `string`', () async { // TODO diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES index 15c25bc0c33..1a69ee77d62 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES @@ -24,10 +24,10 @@ doc/FakeApi.md doc/FakeClassnameTags123Api.md doc/FileSchemaTestClass.md doc/Foo.md +doc/FooGetDefaultResponse.md doc/FormatTest.md doc/HasOnlyReadOnly.md doc/HealthCheckResult.md -doc/InlineResponseDefault.md doc/MapTest.md doc/MixedPropertiesAndAdditionalPropertiesClass.md doc/Model200Response.md @@ -92,10 +92,10 @@ lib/src/model/enum_arrays.dart lib/src/model/enum_test.dart lib/src/model/file_schema_test_class.dart lib/src/model/foo.dart +lib/src/model/foo_get_default_response.dart lib/src/model/format_test.dart lib/src/model/has_only_read_only.dart lib/src/model/health_check_result.dart -lib/src/model/inline_response_default.dart lib/src/model/map_test.dart lib/src/model/mixed_properties_and_additional_properties_class.dart lib/src/model/model200_response.dart 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 ab3bada585c..0f37d116722 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 @@ -128,10 +128,10 @@ Class | Method | HTTP request | Description - [EnumTest](doc/EnumTest.md) - [FileSchemaTestClass](doc/FileSchemaTestClass.md) - [Foo](doc/Foo.md) + - [FooGetDefaultResponse](doc/FooGetDefaultResponse.md) - [FormatTest](doc/FormatTest.md) - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) - [HealthCheckResult](doc/HealthCheckResult.md) - - [InlineResponseDefault](doc/InlineResponseDefault.md) - [MapTest](doc/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](doc/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](doc/Model200Response.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md index f1753b62ee8..0bfa6194188 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **fooGet** -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -36,7 +36,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FooGetDefaultResponse.md new file mode 100644 index 00000000000..10d0133abd9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# openapi.model.FooGetDefaultResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [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/petstore_client_lib_fake/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart index 3490ac16086..17f56a53fae 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart @@ -36,10 +36,10 @@ export 'package:openapi/src/model/enum_arrays.dart'; export 'package:openapi/src/model/enum_test.dart'; export 'package:openapi/src/model/file_schema_test_class.dart'; export 'package:openapi/src/model/foo.dart'; +export 'package:openapi/src/model/foo_get_default_response.dart'; export 'package:openapi/src/model/format_test.dart'; export 'package:openapi/src/model/has_only_read_only.dart'; export 'package:openapi/src/model/health_check_result.dart'; -export 'package:openapi/src/model/inline_response_default.dart'; export 'package:openapi/src/model/map_test.dart'; export 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; export 'package:openapi/src/model/model200_response.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart index 7ad2d45db75..1e1f4dad6ab 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/default_api.dart @@ -7,7 +7,7 @@ import 'dart:async'; import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; -import 'package:openapi/src/model/inline_response_default.dart'; +import 'package:openapi/src/model/foo_get_default_response.dart'; class DefaultApi { @@ -28,9 +28,9 @@ class DefaultApi { /// * [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] containing a [Response] with a [InlineResponseDefault] as data + /// Returns a [Future] containing a [Response] with a [FooGetDefaultResponse] as data /// Throws [DioError] if API call or serialization fails - Future> fooGet({ + Future> fooGet({ CancelToken? cancelToken, Map? headers, Map? extra, @@ -59,14 +59,14 @@ class DefaultApi { onReceiveProgress: onReceiveProgress, ); - InlineResponseDefault _responseData; + FooGetDefaultResponse _responseData; try { - const _responseType = FullType(InlineResponseDefault); + const _responseType = FullType(FooGetDefaultResponse); _responseData = _serializers.deserialize( _response.data!, specifiedType: _responseType, - ) as InlineResponseDefault; + ) as FooGetDefaultResponse; } catch (error, stackTrace) { throw DioError( @@ -77,7 +77,7 @@ class DefaultApi { )..stackTrace = stackTrace; } - return Response( + return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/foo_get_default_response.dart new file mode 100644 index 00000000000..655b5f480db --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/foo_get_default_response.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/model/foo.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo_get_default_response.g.dart'; + +/// FooGetDefaultResponse +/// +/// Properties: +/// * [string] +abstract class FooGetDefaultResponse implements Built { + @BuiltValueField(wireName: r'string') + Foo? get string; + + FooGetDefaultResponse._(); + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooGetDefaultResponseBuilder b) => b; + + factory FooGetDefaultResponse([void updates(FooGetDefaultResponseBuilder b)]) = _$FooGetDefaultResponse; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooGetDefaultResponseSerializer(); +} + +class _$FooGetDefaultResponseSerializer implements StructuredSerializer { + @override + final Iterable types = const [FooGetDefaultResponse, _$FooGetDefaultResponse]; + + @override + final String wireName = r'FooGetDefaultResponse'; + + @override + Iterable serialize(Serializers serializers, FooGetDefaultResponse object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.string != null) { + result + ..add(r'string') + ..add(serializers.serialize(object.string, + specifiedType: const FullType(Foo))); + } + return result; + } + + @override + FooGetDefaultResponse deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = FooGetDefaultResponseBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + + switch (key) { + case r'string': + final valueDes = serializers.deserialize(value, + specifiedType: const FullType(Foo)) as Foo; + result.string.replace(valueDes); + break; + } + } + return result.build(); + } +} + 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 c1ff1c751f2..8ac0fc258f9 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 @@ -31,10 +31,10 @@ import 'package:openapi/src/model/enum_arrays.dart'; import 'package:openapi/src/model/enum_test.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_get_default_response.dart'; import 'package:openapi/src/model/format_test.dart'; import 'package:openapi/src/model/has_only_read_only.dart'; import 'package:openapi/src/model/health_check_result.dart'; -import 'package:openapi/src/model/inline_response_default.dart'; import 'package:openapi/src/model/map_test.dart'; import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; import 'package:openapi/src/model/model200_response.dart'; @@ -83,10 +83,10 @@ part 'serializers.g.dart'; EnumTest, FileSchemaTestClass, Foo, + FooGetDefaultResponse, FormatTest, HasOnlyReadOnly, HealthCheckResult, - InlineResponseDefault, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/foo_get_default_response_test.dart similarity index 66% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_response_default_test.dart rename to samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/foo_get_default_response_test.dart index 56fbf1d0b1a..c64cbb8034c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/inline_response_default_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/foo_get_default_response_test.dart @@ -1,12 +1,12 @@ import 'package:test/test.dart'; import 'package:openapi/openapi.dart'; -// tests for InlineResponseDefault +// tests for FooGetDefaultResponse void main() { - final instance = InlineResponseDefaultBuilder(); + final instance = FooGetDefaultResponseBuilder(); // TODO add properties to the builder and call build() - group(InlineResponseDefault, () { + group(FooGetDefaultResponse, () { // Foo string test('to test the property `string`', () async { // TODO diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES index 578005d31c6..c2faff09ed8 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES @@ -26,10 +26,10 @@ doc/FakeApi.md doc/FakeClassnameTags123Api.md doc/FileSchemaTestClass.md doc/Foo.md +doc/FooGetDefaultResponse.md doc/FormatTest.md doc/HasOnlyReadOnly.md doc/HealthCheckResult.md -doc/InlineResponseDefault.md doc/MapTest.md doc/MixedPropertiesAndAdditionalPropertiesClass.md doc/Model200Response.md @@ -94,10 +94,10 @@ lib/model/enum_class.dart lib/model/enum_test.dart lib/model/file_schema_test_class.dart lib/model/foo.dart +lib/model/foo_get_default_response.dart lib/model/format_test.dart lib/model/has_only_read_only.dart lib/model/health_check_result.dart -lib/model/inline_response_default.dart lib/model/map_test.dart lib/model/mixed_properties_and_additional_properties_class.dart lib/model/model200_response.dart 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 c19234f8d8a..989702d292d 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 @@ -123,10 +123,10 @@ Class | Method | HTTP request | Description - [EnumTest](doc//EnumTest.md) - [FileSchemaTestClass](doc//FileSchemaTestClass.md) - [Foo](doc//Foo.md) + - [FooGetDefaultResponse](doc//FooGetDefaultResponse.md) - [FormatTest](doc//FormatTest.md) - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) - [HealthCheckResult](doc//HealthCheckResult.md) - - [InlineResponseDefault](doc//InlineResponseDefault.md) - [MapTest](doc//MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](doc//Model200Response.md) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md index d7b1c748f14..1ae3cbc5ef4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **fooGet** -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -36,7 +36,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FooGetDefaultResponse.md new file mode 100644 index 00000000000..10d0133abd9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# openapi.model.FooGetDefaultResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [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/dart2/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart index 3e66c2e121d..e624212cc80 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart @@ -55,10 +55,10 @@ part 'model/enum_class.dart'; part 'model/enum_test.dart'; part 'model/file_schema_test_class.dart'; part 'model/foo.dart'; +part 'model/foo_get_default_response.dart'; part 'model/format_test.dart'; part 'model/has_only_read_only.dart'; part 'model/health_check_result.dart'; -part 'model/inline_response_default.dart'; part 'model/map_test.dart'; part 'model/mixed_properties_and_additional_properties_class.dart'; part 'model/model200_response.dart'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart index 23798028b94..c6261534301 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/default_api.dart @@ -42,7 +42,7 @@ class DefaultApi { ); } - Future fooGet() async { + Future fooGet() async { final response = await fooGetWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); @@ -51,7 +51,7 @@ class DefaultApi { // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { - return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'InlineResponseDefault',) as InlineResponseDefault; + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'FooGetDefaultResponse',) as FooGetDefaultResponse; } return null; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index ba7a9e692b7..65fc8807797 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -230,14 +230,14 @@ class ApiClient { return FileSchemaTestClass.fromJson(value); case 'Foo': return Foo.fromJson(value); + case 'FooGetDefaultResponse': + return FooGetDefaultResponse.fromJson(value); case 'FormatTest': return FormatTest.fromJson(value); case 'HasOnlyReadOnly': return HasOnlyReadOnly.fromJson(value); case 'HealthCheckResult': return HealthCheckResult.fromJson(value); - case 'InlineResponseDefault': - return InlineResponseDefault.fromJson(value); case 'MapTest': return MapTest.fromJson(value); case 'MixedPropertiesAndAdditionalPropertiesClass': diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart new file mode 100644 index 00000000000..de0b2f2637c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo_get_default_response.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class FooGetDefaultResponse { + /// Returns a new [FooGetDefaultResponse] instance. + FooGetDefaultResponse({ + this.string, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + Foo? string; + + @override + bool operator ==(Object other) => identical(this, other) || other is FooGetDefaultResponse && + other.string == string; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (string == null ? 0 : string!.hashCode); + + @override + String toString() => 'FooGetDefaultResponse[string=$string]'; + + Map toJson() { + final _json = {}; + if (string != null) { + _json[r'string'] = string; + } + return _json; + } + + /// Returns a new [FooGetDefaultResponse] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static FooGetDefaultResponse? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FooGetDefaultResponse[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FooGetDefaultResponse[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return FooGetDefaultResponse( + string: Foo.fromJson(json[r'string']), + ); + } + return null; + } + + static List? listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FooGetDefaultResponse.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FooGetDefaultResponse.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of FooGetDefaultResponse-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FooGetDefaultResponse.listFromJson(entry.value, growable: growable,); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_get_default_response_test.dart similarity index 65% rename from samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart rename to samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_get_default_response_test.dart index e344b8a6fd0..9ed5ae1075e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/inline_response_default_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/foo_get_default_response_test.dart @@ -11,12 +11,11 @@ import 'package:openapi/api.dart'; import 'package:test/test.dart'; -// these tests are not regenerated by dart 2 generator as they break compatibility with Dart versions under 2.12 -// tests for InlineResponseDefault +// tests for FooGetDefaultResponse void main() { - // final instance = InlineResponseDefault(); + // final instance = FooGetDefaultResponse(); - group('test InlineResponseDefault', () { + group('test FooGetDefaultResponse', () { // Foo string test('to test the property `string`', () async { // TODO diff --git a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES index 100fdeb9795..602bebcdf5e 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/FILES @@ -39,13 +39,13 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md docs/GmFruit.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/Mammal.md docs/MapTest.md @@ -80,6 +80,7 @@ git_push.sh go.mod go.sum model_200_response.go +model__foo_get_default_response.go model__special_model_name_.go model_additional_properties_class.go model_animal.go @@ -111,7 +112,6 @@ model_fruit_req.go model_gm_fruit.go model_has_only_read_only.go model_health_check_result.go -model_inline_response_default.go model_list.go model_mammal.go model_map_test_.go diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index 387082499c5..52c0fcc98d0 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -145,13 +145,13 @@ Class | Method | HTTP request | Description - [File](docs/File.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [FormatTest](docs/FormatTest.md) - [Fruit](docs/Fruit.md) - [FruitReq](docs/FruitReq.md) - [GmFruit](docs/GmFruit.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - - [InlineResponseDefault](docs/InlineResponseDefault.md) - [List](docs/List.md) - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) 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 df095c3f298..e94f609d548 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -48,19 +48,19 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: response "4XX": content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: client error "404": content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: not found /pet: post: @@ -1953,7 +1953,7 @@ components: items: type: string type: array - inline_response_default: + _foo_get_default_response: example: string: bar: bar diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_default.go b/samples/openapi3/client/petstore/go/go-petstore/api_default.go index 4a0fb1a5d5f..a025e553800 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_default.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_default.go @@ -30,8 +30,8 @@ type DefaultApi interface { FooGet(ctx context.Context) ApiFooGetRequest // FooGetExecute executes the request - // @return InlineResponseDefault - FooGetExecute(r ApiFooGetRequest) (*InlineResponseDefault, *http.Response, error) + // @return FooGetDefaultResponse + FooGetExecute(r ApiFooGetRequest) (*FooGetDefaultResponse, *http.Response, error) } // DefaultApiService DefaultApi service @@ -42,7 +42,7 @@ type ApiFooGetRequest struct { ApiService DefaultApi } -func (r ApiFooGetRequest) Execute() (*InlineResponseDefault, *http.Response, error) { +func (r ApiFooGetRequest) Execute() (*FooGetDefaultResponse, *http.Response, error) { return r.ApiService.FooGetExecute(r) } @@ -60,13 +60,13 @@ func (a *DefaultApiService) FooGet(ctx context.Context) ApiFooGetRequest { } // Execute executes the request -// @return InlineResponseDefault -func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (*InlineResponseDefault, *http.Response, error) { +// @return FooGetDefaultResponse +func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (*FooGetDefaultResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *InlineResponseDefault + localVarReturnValue *FooGetDefaultResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FooGet") @@ -120,7 +120,7 @@ func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (*InlineResponseDe error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 404 { - var v InlineResponseDefault + var v FooGetDefaultResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -130,7 +130,7 @@ func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (*InlineResponseDe return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { - var v InlineResponseDefault + var v FooGetDefaultResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -139,7 +139,7 @@ func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (*InlineResponseDe newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - var v InlineResponseDefault + var v FooGetDefaultResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md index 62cef88c3f6..c87531bdf6c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## FooGet -> InlineResponseDefault FooGet(ctx).Execute() +> FooGetDefaultResponse FooGet(ctx).Execute() @@ -35,7 +35,7 @@ func main() { fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.FooGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `FooGet`: InlineResponseDefault + // response from `FooGet`: FooGetDefaultResponse fmt.Fprintf(os.Stdout, "Response from `DefaultApi.FooGet`: %v\n", resp) } ``` @@ -51,7 +51,7 @@ Other parameters are passed through a pointer to a apiFooGetRequest struct via t ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..c4a27cfc81f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FooGetDefaultResponse.md @@ -0,0 +1,56 @@ +# FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | Pointer to [**Foo**](Foo.md) | | [optional] + +## Methods + +### NewFooGetDefaultResponse + +`func NewFooGetDefaultResponse() *FooGetDefaultResponse` + +NewFooGetDefaultResponse instantiates a new FooGetDefaultResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFooGetDefaultResponseWithDefaults + +`func NewFooGetDefaultResponseWithDefaults() *FooGetDefaultResponse` + +NewFooGetDefaultResponseWithDefaults instantiates a new FooGetDefaultResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetString + +`func (o *FooGetDefaultResponse) GetString() Foo` + +GetString returns the String field if non-nil, zero value otherwise. + +### GetStringOk + +`func (o *FooGetDefaultResponse) GetStringOk() (*Foo, bool)` + +GetStringOk returns a tuple with the String field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetString + +`func (o *FooGetDefaultResponse) SetString(v Foo)` + +SetString sets String field to given value. + +### HasString + +`func (o *FooGetDefaultResponse) HasString() bool` + +HasString returns a boolean if a field has been set. + + +[[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/go/go-petstore/model__foo_get_default_response.go b/samples/openapi3/client/petstore/go/go-petstore/model__foo_get_default_response.go new file mode 100644 index 00000000000..3bc2b67b72b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model__foo_get_default_response.go @@ -0,0 +1,140 @@ +/* +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +import ( + "encoding/json" +) + +// FooGetDefaultResponse struct for FooGetDefaultResponse +type FooGetDefaultResponse struct { + String *Foo `json:"string,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FooGetDefaultResponse FooGetDefaultResponse + +// NewFooGetDefaultResponse instantiates a new FooGetDefaultResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFooGetDefaultResponse() *FooGetDefaultResponse { + this := FooGetDefaultResponse{} + return &this +} + +// NewFooGetDefaultResponseWithDefaults instantiates a new FooGetDefaultResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFooGetDefaultResponseWithDefaults() *FooGetDefaultResponse { + this := FooGetDefaultResponse{} + return &this +} + +// GetString returns the String field value if set, zero value otherwise. +func (o *FooGetDefaultResponse) GetString() Foo { + if o == nil || o.String == nil { + var ret Foo + return ret + } + return *o.String +} + +// GetStringOk returns a tuple with the String field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FooGetDefaultResponse) GetStringOk() (*Foo, bool) { + if o == nil || o.String == nil { + return nil, false + } + return o.String, true +} + +// HasString returns a boolean if a field has been set. +func (o *FooGetDefaultResponse) HasString() bool { + if o != nil && o.String != nil { + return true + } + + return false +} + +// SetString gets a reference to the given Foo and assigns it to the String field. +func (o *FooGetDefaultResponse) SetString(v Foo) { + o.String = &v +} + +func (o FooGetDefaultResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.String != nil { + toSerialize["string"] = o.String + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return json.Marshal(toSerialize) +} + +func (o *FooGetDefaultResponse) UnmarshalJSON(bytes []byte) (err error) { + varFooGetDefaultResponse := _FooGetDefaultResponse{} + + if err = json.Unmarshal(bytes, &varFooGetDefaultResponse); err == nil { + *o = FooGetDefaultResponse(varFooGetDefaultResponse) + } + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + delete(additionalProperties, "string") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFooGetDefaultResponse struct { + value *FooGetDefaultResponse + isSet bool +} + +func (v NullableFooGetDefaultResponse) Get() *FooGetDefaultResponse { + return v.value +} + +func (v *NullableFooGetDefaultResponse) Set(val *FooGetDefaultResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFooGetDefaultResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFooGetDefaultResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFooGetDefaultResponse(val *FooGetDefaultResponse) *NullableFooGetDefaultResponse { + return &NullableFooGetDefaultResponse{value: val, isSet: true} +} + +func (v NullableFooGetDefaultResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFooGetDefaultResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES index d9a7d4789da..9f9129b99e5 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES @@ -39,6 +39,7 @@ docs/FakeApi.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/Fruit.md docs/FruitReq.md @@ -46,7 +47,6 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/IsoscelesTriangle.md docs/Mammal.md docs/MapTest.md @@ -153,6 +153,7 @@ src/main/java/org/openapitools/client/model/EnumTest.java src/main/java/org/openapitools/client/model/EquilateralTriangle.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java src/main/java/org/openapitools/client/model/FormatTest.java src/main/java/org/openapitools/client/model/Fruit.java src/main/java/org/openapitools/client/model/FruitReq.java @@ -160,7 +161,6 @@ src/main/java/org/openapitools/client/model/GmFruit.java src/main/java/org/openapitools/client/model/GrandparentAnimal.java src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java src/main/java/org/openapitools/client/model/HealthCheckResult.java -src/main/java/org/openapitools/client/model/InlineResponseDefault.java src/main/java/org/openapitools/client/model/IsoscelesTriangle.java src/main/java/org/openapitools/client/model/Mammal.java src/main/java/org/openapitools/client/model/MapTest.java diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/README.md b/samples/openapi3/client/petstore/java/jersey2-java8/README.md index 433f6979739..784f3ea2177 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/README.md @@ -211,6 +211,7 @@ Class | Method | HTTP request | Description - [EquilateralTriangle](docs/EquilateralTriangle.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [FormatTest](docs/FormatTest.md) - [Fruit](docs/Fruit.md) - [FruitReq](docs/FruitReq.md) @@ -218,7 +219,6 @@ Class | Method | HTTP request | Description - [GrandparentAnimal](docs/GrandparentAnimal.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - - [InlineResponseDefault](docs/InlineResponseDefault.md) - [IsoscelesTriangle](docs/IsoscelesTriangle.md) - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) 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 dad28120951..1db8f0a9d1a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml @@ -48,7 +48,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_default' + $ref: '#/components/schemas/_foo_get_default_response' description: response x-accepts: application/json /pet: @@ -2136,7 +2136,7 @@ components: $ref: '#/components/schemas/Bar' type: array type: object - inline_response_default: + _foo_get_default_response: example: string: bar: bar diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/DefaultApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/DefaultApi.md index 00a8ac2ac24..f4502a6aa62 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/DefaultApi.md @@ -10,7 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* ## fooGet -> InlineResponseDefault fooGet() +> FooGetDefaultResponse fooGet() @@ -31,7 +31,7 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); try { - InlineResponseDefault result = apiInstance.fooGet(); + FooGetDefaultResponse result = apiInstance.fooGet(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#fooGet"); @@ -50,7 +50,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..ff3d7a3a56c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java index e35e81cad3f..9088aa8da1f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -8,7 +8,7 @@ import org.openapitools.client.Pair; import javax.ws.rs.core.GenericType; -import org.openapitools.client.model.InlineResponseDefault; +import org.openapitools.client.model.FooGetDefaultResponse; import java.util.ArrayList; import java.util.HashMap; @@ -48,7 +48,7 @@ public class DefaultApi { /** * * - * @return InlineResponseDefault + * @return FooGetDefaultResponse * @throws ApiException if fails to make API call * @http.response.details @@ -56,14 +56,14 @@ public class DefaultApi {
0 response -
*/ - public InlineResponseDefault fooGet() throws ApiException { + public FooGetDefaultResponse fooGet() throws ApiException { return fooGetWithHttpInfo().getData(); } /** * * - * @return ApiResponse<InlineResponseDefault> + * @return ApiResponse<FooGetDefaultResponse> * @throws ApiException if fails to make API call * @http.response.details @@ -71,7 +71,7 @@ public class DefaultApi {
0 response -
*/ - public ApiResponse fooGetWithHttpInfo() throws ApiException { + public ApiResponse fooGetWithHttpInfo() throws ApiException { Object localVarPostBody = null; // create path and map variables @@ -99,7 +99,7 @@ public class DefaultApi { String[] localVarAuthNames = new String[] { }; - GenericType localVarReturnType = new GenericType() {}; + GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 00000000000..2eec61d30cf --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * FooGetDefaultResponse + */ +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@JsonTypeName("_foo_get_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(Foo string) { + this.string = string; + } + + + /** + * Return true if this _foo_get_default_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 00000000000..9b92839a55c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES index 115adc024f9..c362f355b01 100755 --- a/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES @@ -28,10 +28,10 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineResponseDefault.md docs/List.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -93,10 +93,10 @@ petstore_api/models/enum_test.py petstore_api/models/file.py petstore_api/models/file_schema_test_class.py petstore_api/models/foo.py +petstore_api/models/foo_get_default_response.py petstore_api/models/format_test.py petstore_api/models/has_only_read_only.py petstore_api/models/health_check_result.py -petstore_api/models/inline_response_default.py petstore_api/models/list.py petstore_api/models/map_test.py petstore_api/models/mixed_properties_and_additional_properties_class.py diff --git a/samples/openapi3/client/petstore/python-legacy/README.md b/samples/openapi3/client/petstore/python-legacy/README.md index 1c29f905122..a9af4fe48d2 100755 --- a/samples/openapi3/client/petstore/python-legacy/README.md +++ b/samples/openapi3/client/petstore/python-legacy/README.md @@ -148,10 +148,10 @@ Class | Method | HTTP request | Description - [File](docs/File.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [FormatTest](docs/FormatTest.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - - [InlineResponseDefault](docs/InlineResponseDefault.md) - [List](docs/List.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/openapi3/client/petstore/python-legacy/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-legacy/docs/DefaultApi.md index 7f022fd7d3e..151e354947c 100755 --- a/samples/openapi3/client/petstore/python-legacy/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python-legacy/docs/DefaultApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **foo_get** -> InlineResponseDefault foo_get() +> FooGetDefaultResponse foo_get() @@ -44,7 +44,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/python-legacy/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/python-legacy/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..6c8095c9a39 --- /dev/null +++ b/samples/openapi3/client/petstore/python-legacy/docs/FooGetDefaultResponse.md @@ -0,0 +1,11 @@ +# FooGetDefaultResponse + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [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/python-legacy/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/__init__.py index acaabdb1773..68ec54c6b79 100755 --- a/samples/openapi3/client/petstore/python-legacy/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/__init__.py @@ -57,10 +57,10 @@ from petstore_api.models.enum_test import EnumTest from petstore_api.models.file import File from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.foo import Foo +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.models.inline_response_default import InlineResponseDefault from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/api/default_api.py index c626466b75d..833a1e00fa7 100755 --- a/samples/openapi3/client/petstore/python-legacy/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/api/default_api.py @@ -58,7 +58,7 @@ class DefaultApi(object): :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: InlineResponseDefault + :rtype: FooGetDefaultResponse """ kwargs['_return_http_data_only'] = True return self.foo_get_with_http_info(**kwargs) # noqa: E501 @@ -93,7 +93,7 @@ class DefaultApi(object): :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: tuple(InlineResponseDefault, status_code(int), headers(HTTPHeaderDict)) + :rtype: tuple(FooGetDefaultResponse, status_code(int), headers(HTTPHeaderDict)) """ local_var_params = locals() diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py index 2bb081e87ba..2b4432c9e36 100755 --- a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py @@ -36,10 +36,10 @@ from petstore_api.models.enum_test import EnumTest from petstore_api.models.file import File from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.foo import Foo +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.models.inline_response_default import InlineResponseDefault from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/foo_get_default_response.py new file mode 100644 index 00000000000..54c9cab12a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/foo_get_default_response.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +try: + from inspect import getfullargspec +except ImportError: + from inspect import getargspec as getfullargspec +import pprint +import re # noqa: F401 +import six + +from petstore_api.configuration import Configuration + + +class FooGetDefaultResponse(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'string': 'Foo' + } + + attribute_map = { + 'string': 'string' + } + + def __init__(self, string=None, local_vars_configuration=None): # noqa: E501 + """FooGetDefaultResponse - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration.get_default_copy() + self.local_vars_configuration = local_vars_configuration + + self._string = None + self.discriminator = None + + if string is not None: + self.string = string + + @property + def string(self): + """Gets the string of this FooGetDefaultResponse. # noqa: E501 + + + :return: The string of this FooGetDefaultResponse. # noqa: E501 + :rtype: Foo + """ + return self._string + + @string.setter + def string(self, string): + """Sets the string of this FooGetDefaultResponse. + + + :param string: The string of this FooGetDefaultResponse. # noqa: E501 + :type string: Foo + """ + + self._string = string + + def to_dict(self, serialize=False): + """Returns the model properties as a dict""" + result = {} + + def convert(x): + if hasattr(x, "to_dict"): + args = getfullargspec(x.to_dict).args + if len(args) == 1: + return x.to_dict() + else: + return x.to_dict(serialize) + else: + return x + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + attr = self.attribute_map.get(attr, attr) if serialize else attr + if isinstance(value, list): + result[attr] = list(map( + lambda x: convert(x), + value + )) + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], convert(item[1])), + value.items() + )) + else: + result[attr] = convert(value) + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FooGetDefaultResponse): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, FooGetDefaultResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/samples/openapi3/client/petstore/python-legacy/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python-legacy/test/test_foo_get_default_response.py new file mode 100644 index 00000000000..d2cadc258d8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-legacy/test/test_foo_get_default_response.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import petstore_api +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse # noqa: E501 +from petstore_api.rest import ApiException + +class TestFooGetDefaultResponse(unittest.TestCase): + """FooGetDefaultResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test FooGetDefaultResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = petstore_api.models.foo_get_default_response.FooGetDefaultResponse() # noqa: E501 + if include_optional : + return FooGetDefaultResponse( + string = petstore_api.models.foo.Foo( + bar = 'bar', ) + ) + else : + return FooGetDefaultResponse( + ) + + def testFooGetDefaultResponse(self): + """Test FooGetDefaultResponse""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES index 90e36d7f34d..4e13fcd0369 100644 --- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES @@ -44,6 +44,7 @@ docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md +docs/FooGetDefaultResponse.md docs/FooObject.md docs/FormatTest.md docs/Fruit.md @@ -54,7 +55,6 @@ docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/InlineAdditionalPropertiesRefPayload.md -docs/InlineResponseDefault.md docs/IntegerEnum.md docs/IntegerEnumOneValue.md docs/IntegerEnumWithDefaultValue.md @@ -158,6 +158,7 @@ petstore_api/model/equilateral_triangle.py petstore_api/model/file.py petstore_api/model/file_schema_test_class.py petstore_api/model/foo.py +petstore_api/model/foo_get_default_response.py petstore_api/model/foo_object.py petstore_api/model/format_test.py petstore_api/model/fruit.py @@ -168,7 +169,6 @@ petstore_api/model/grandparent_animal.py petstore_api/model/has_only_read_only.py petstore_api/model/health_check_result.py petstore_api/model/inline_additional_properties_ref_payload.py -petstore_api/model/inline_response_default.py petstore_api/model/integer_enum.py petstore_api/model/integer_enum_one_value.py petstore_api/model/integer_enum_with_default_value.py diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index f5880f1528d..de817ea11ee 100644 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -173,6 +173,7 @@ Class | Method | HTTP request | Description - [File](docs/File.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - [FooObject](docs/FooObject.md) - [FormatTest](docs/FormatTest.md) - [Fruit](docs/Fruit.md) @@ -183,7 +184,6 @@ Class | Method | HTTP request | Description - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) - [InlineAdditionalPropertiesRefPayload](docs/InlineAdditionalPropertiesRefPayload.md) - - [InlineResponseDefault](docs/InlineResponseDefault.md) - [IntegerEnum](docs/IntegerEnum.md) - [IntegerEnumOneValue](docs/IntegerEnumOneValue.md) - [IntegerEnumWithDefaultValue](docs/IntegerEnumWithDefaultValue.md) diff --git a/samples/openapi3/client/petstore/python/docs/DefaultApi.md b/samples/openapi3/client/petstore/python/docs/DefaultApi.md index c3e035bbb44..52ae252d489 100644 --- a/samples/openapi3/client/petstore/python/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python/docs/DefaultApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **foo_get** -> InlineResponseDefault foo_get() +> FooGetDefaultResponse foo_get() @@ -19,7 +19,7 @@ Method | HTTP request | Description import time import petstore_api from petstore_api.api import default_api -from petstore_api.model.inline_response_default import InlineResponseDefault +from petstore_api.model.foo_get_default_response import FooGetDefaultResponse 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. @@ -47,7 +47,7 @@ This endpoint does not need any parameter. ### Return type -[**InlineResponseDefault**](InlineResponseDefault.md) +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/python/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/python/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..c89067a5d31 --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/FooGetDefaultResponse.md @@ -0,0 +1,12 @@ +# FooGetDefaultResponse + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [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/python/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py index c3515258b95..861b95fab49 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py @@ -21,7 +21,7 @@ from petstore_api.model_utils import ( # noqa: F401 none_type, validate_and_convert_types ) -from petstore_api.model.inline_response_default import InlineResponseDefault +from petstore_api.model.foo_get_default_response import FooGetDefaultResponse class DefaultApi(object): @@ -37,7 +37,7 @@ class DefaultApi(object): self.api_client = api_client self.foo_get_endpoint = _Endpoint( settings={ - 'response_type': (InlineResponseDefault,), + 'response_type': (FooGetDefaultResponse,), 'auth': [], 'endpoint_path': '/foo', 'operation_id': 'foo_get', @@ -124,7 +124,7 @@ class DefaultApi(object): async_req (bool): execute request asynchronously Returns: - InlineResponseDefault + FooGetDefaultResponse If the method is called asynchronously, returns the request thread. """ diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/foo_get_default_response.py b/samples/openapi3/client/petstore/python/petstore_api/model/foo_get_default_response.py new file mode 100644 index 00000000000..c5222f834a8 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/model/foo_get_default_response.py @@ -0,0 +1,269 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, + OpenApiModel +) +from petstore_api.exceptions import ApiAttributeError + + +def lazy_import(): + from petstore_api.model.foo import Foo + globals()['Foo'] = Foo + + +class FooGetDefaultResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'string': (Foo,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'string': 'string', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """FooGetDefaultResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + string (Foo): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', True) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + for arg in args: + if isinstance(arg, dict): + kwargs.update(arg) + else: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """FooGetDefaultResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + string (Foo): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + for arg in args: + if isinstance(arg, dict): + kwargs.update(arg) + else: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py index 6a3e321b6a2..23731306701 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -47,6 +47,7 @@ from petstore_api.model.equilateral_triangle import EquilateralTriangle from petstore_api.model.file import File from petstore_api.model.file_schema_test_class import FileSchemaTestClass from petstore_api.model.foo import Foo +from petstore_api.model.foo_get_default_response import FooGetDefaultResponse from petstore_api.model.foo_object import FooObject from petstore_api.model.format_test import FormatTest from petstore_api.model.fruit import Fruit @@ -57,7 +58,6 @@ from petstore_api.model.grandparent_animal import GrandparentAnimal from petstore_api.model.has_only_read_only import HasOnlyReadOnly from petstore_api.model.health_check_result import HealthCheckResult from petstore_api.model.inline_additional_properties_ref_payload import InlineAdditionalPropertiesRefPayload -from petstore_api.model.inline_response_default import InlineResponseDefault from petstore_api.model.integer_enum import IntegerEnum from petstore_api.model.integer_enum_one_value import IntegerEnumOneValue from petstore_api.model.integer_enum_with_default_value import IntegerEnumWithDefaultValue diff --git a/samples/openapi3/client/petstore/python/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python/test/test_foo_get_default_response.py new file mode 100644 index 00000000000..8a3769551c9 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_foo_get_default_response.py @@ -0,0 +1,37 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import petstore_api +from petstore_api.model.foo import Foo +globals()['Foo'] = Foo +from petstore_api.model.foo_get_default_response import FooGetDefaultResponse + + +class TestFooGetDefaultResponse(unittest.TestCase): + """FooGetDefaultResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFooGetDefaultResponse(self): + """Test FooGetDefaultResponse""" + # FIXME: construct object with mandatory attributes with example values + # model = FooGetDefaultResponse() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/.openapi-generator/FILES b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/.openapi-generator/FILES index 8073b039895..a6a0ffe5e87 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/.openapi-generator/FILES @@ -15,12 +15,12 @@ models/Cat.ts models/CatAllOf.ts models/Dog.ts models/DogAllOf.ts -models/InlineRequest.ts -models/InlineRequest1.ts -models/InlineRequest2.ts +models/FilePostRequest.ts models/ObjectSerializer.ts models/PetByAge.ts models/PetByType.ts +models/PetsFilteredPatchRequest.ts +models/PetsPatchRequest.ts models/all.ts package.json rxjsStub.ts diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/DefaultApi.md b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/DefaultApi.md index 8710d587b06..21992b8771f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/DefaultApi.md +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/DefaultApi.md @@ -24,8 +24,8 @@ const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); let body:.DefaultApiFilePostRequest = { - // InlineRequest2 (optional) - inlineRequest2: { + // FilePostRequest (optional) + filePostRequest: { file: null, }, }; @@ -40,7 +40,7 @@ apiInstance.filePost(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **inlineRequest2** | **InlineRequest2**| | + **filePostRequest** | **FilePostRequest**| | ### Return type @@ -79,8 +79,8 @@ const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); let body:.DefaultApiPetsFilteredPatchRequest = { - // InlineRequest1 (optional) - inlineRequest1: null, + // PetsFilteredPatchRequest (optional) + petsFilteredPatchRequest: null, }; apiInstance.petsFilteredPatch(body).then((data:any) => { @@ -93,7 +93,7 @@ apiInstance.petsFilteredPatch(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **inlineRequest1** | **InlineRequest1**| | + **petsFilteredPatchRequest** | **PetsFilteredPatchRequest**| | ### Return type @@ -132,8 +132,8 @@ const configuration = .createConfiguration(); const apiInstance = new .DefaultApi(configuration); let body:.DefaultApiPetsPatchRequest = { - // InlineRequest (optional) - inlineRequest: null, + // PetsPatchRequest (optional) + petsPatchRequest: null, }; apiInstance.petsPatch(body).then((data:any) => { @@ -146,7 +146,7 @@ apiInstance.petsPatch(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **inlineRequest** | **InlineRequest**| | + **petsPatchRequest** | **PetsPatchRequest**| | ### Return type diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts index 6691155af29..616be727ebb 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts @@ -8,9 +8,9 @@ import {canConsumeForm, isCodeInRange} from '../util'; import {SecurityAuthentication} from '../auth/auth'; -import { InlineRequest } from '../models/InlineRequest'; -import { InlineRequest1 } from '../models/InlineRequest1'; -import { InlineRequest2 } from '../models/InlineRequest2'; +import { FilePostRequest } from '../models/FilePostRequest'; +import { PetsFilteredPatchRequest } from '../models/PetsFilteredPatchRequest'; +import { PetsPatchRequest } from '../models/PetsPatchRequest'; /** * no description @@ -18,9 +18,9 @@ import { InlineRequest2 } from '../models/InlineRequest2'; export class DefaultApiRequestFactory extends BaseAPIRequestFactory { /** - * @param inlineRequest2 + * @param filePostRequest */ - public async filePost(inlineRequest2?: InlineRequest2, _options?: Configuration): Promise { + public async filePost(filePostRequest?: FilePostRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; @@ -38,7 +38,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(inlineRequest2, "InlineRequest2", ""), + ObjectSerializer.serialize(filePostRequest, "FilePostRequest", ""), contentType ); requestContext.setBody(serializedBody); @@ -53,9 +53,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * @param inlineRequest1 + * @param petsFilteredPatchRequest */ - public async petsFilteredPatch(inlineRequest1?: InlineRequest1, _options?: Configuration): Promise { + public async petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; @@ -73,7 +73,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(inlineRequest1, "InlineRequest1", ""), + ObjectSerializer.serialize(petsFilteredPatchRequest, "PetsFilteredPatchRequest", ""), contentType ); requestContext.setBody(serializedBody); @@ -88,9 +88,9 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { } /** - * @param inlineRequest + * @param petsPatchRequest */ - public async petsPatch(inlineRequest?: InlineRequest, _options?: Configuration): Promise { + public async petsPatch(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; @@ -108,7 +108,7 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(inlineRequest, "InlineRequest", ""), + ObjectSerializer.serialize(petsPatchRequest, "PetsPatchRequest", ""), contentType ); requestContext.setBody(serializedBody); diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts new file mode 100644 index 00000000000..ddd7a052d56 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/FilePostRequest.ts @@ -0,0 +1,35 @@ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class FilePostRequest { + 'file'?: any; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "file", + "baseName": "file", + "type": "any", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FilePostRequest.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts index ae022869aa3..2630127fb0c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/ObjectSerializer.ts @@ -2,21 +2,21 @@ export * from './Cat'; export * from './CatAllOf'; export * from './Dog'; export * from './DogAllOf'; -export * from './InlineRequest'; -export * from './InlineRequest1'; -export * from './InlineRequest2'; +export * from './FilePostRequest'; export * from './PetByAge'; export * from './PetByType'; +export * from './PetsFilteredPatchRequest'; +export * from './PetsPatchRequest'; import { Cat } from './Cat'; import { CatAllOf } from './CatAllOf'; import { Dog , DogBreedEnum } from './Dog'; import { DogAllOf , DogAllOfBreedEnum } from './DogAllOf'; -import { InlineRequest , InlineRequestBreedEnum } from './InlineRequest'; -import { InlineRequest1 , InlineRequest1PetTypeEnum } from './InlineRequest1'; -import { InlineRequest2 } from './InlineRequest2'; +import { FilePostRequest } from './FilePostRequest'; import { PetByAge } from './PetByAge'; import { PetByType, PetByTypePetTypeEnum } from './PetByType'; +import { PetsFilteredPatchRequest , PetsFilteredPatchRequestPetTypeEnum } from './PetsFilteredPatchRequest'; +import { PetsPatchRequest , PetsPatchRequestBreedEnum } from './PetsPatchRequest'; /* tslint:disable:no-unused-variable */ let primitives = [ @@ -40,9 +40,9 @@ const supportedMediaTypes: { [mediaType: string]: number } = { let enumsMap: Set = new Set([ "DogBreedEnum", "DogAllOfBreedEnum", - "InlineRequestBreedEnum", - "InlineRequest1PetTypeEnum", "PetByTypePetTypeEnum", + "PetsFilteredPatchRequestPetTypeEnum", + "PetsPatchRequestBreedEnum", ]); let typeMap: {[index: string]: any} = { @@ -50,11 +50,11 @@ let typeMap: {[index: string]: any} = { "CatAllOf": CatAllOf, "Dog": Dog, "DogAllOf": DogAllOf, - "InlineRequest": InlineRequest, - "InlineRequest1": InlineRequest1, - "InlineRequest2": InlineRequest2, + "FilePostRequest": FilePostRequest, "PetByAge": PetByAge, "PetByType": PetByType, + "PetsFilteredPatchRequest": PetsFilteredPatchRequest, + "PetsPatchRequest": PetsPatchRequest, } export class ObjectSerializer { diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts new file mode 100644 index 00000000000..8e4fae3898e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsFilteredPatchRequest.ts @@ -0,0 +1,61 @@ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { PetByAge } from './PetByAge'; +import { PetByType } from './PetByType'; +import { HttpFile } from '../http/http'; + +export class PetsFilteredPatchRequest { + 'age': number; + 'nickname'?: string; + 'petType': PetsFilteredPatchRequestPetTypeEnum; + 'hunts'?: boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "age", + "baseName": "age", + "type": "number", + "format": "" + }, + { + "name": "nickname", + "baseName": "nickname", + "type": "string", + "format": "" + }, + { + "name": "petType", + "baseName": "pet_type", + "type": "PetsFilteredPatchRequestPetTypeEnum", + "format": "" + }, + { + "name": "hunts", + "baseName": "hunts", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PetsFilteredPatchRequest.attributeTypeMap; + } + + public constructor() { + } +} + + +export type PetsFilteredPatchRequestPetTypeEnum = "Cat" | "Dog" ; + diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts new file mode 100644 index 00000000000..e035f280536 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/PetsPatchRequest.ts @@ -0,0 +1,62 @@ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Cat } from './Cat'; +import { Dog } from './Dog'; +import { HttpFile } from '../http/http'; + +export class PetsPatchRequest { + 'hunts'?: boolean; + 'age'?: number; + 'bark'?: boolean; + 'breed'?: PetsPatchRequestBreedEnum; + + static readonly discriminator: string | undefined = "petType"; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "hunts", + "baseName": "hunts", + "type": "boolean", + "format": "" + }, + { + "name": "age", + "baseName": "age", + "type": "number", + "format": "" + }, + { + "name": "bark", + "baseName": "bark", + "type": "boolean", + "format": "" + }, + { + "name": "breed", + "baseName": "breed", + "type": "PetsPatchRequestBreedEnum", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PetsPatchRequest.attributeTypeMap; + } + + public constructor() { + this.petType = "PetsPatchRequest"; + } +} + + +export type PetsPatchRequestBreedEnum = "Dingo" | "Husky" | "Retriever" | "Shepherd" ; + diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/all.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/all.ts index 666d1c4b8c8..61fd42f246b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/all.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/models/all.ts @@ -2,8 +2,8 @@ export * from './Cat' export * from './CatAllOf' export * from './Dog' export * from './DogAllOf' -export * from './InlineRequest' -export * from './InlineRequest1' -export * from './InlineRequest2' +export * from './FilePostRequest' export * from './PetByAge' export * from './PetByType' +export * from './PetsFilteredPatchRequest' +export * from './PetsPatchRequest' diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts index 04d304d385e..ac317b1e0e6 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts @@ -6,11 +6,11 @@ import { Cat } from '../models/Cat'; import { CatAllOf } from '../models/CatAllOf'; import { Dog } from '../models/Dog'; import { DogAllOf } from '../models/DogAllOf'; -import { InlineRequest } from '../models/InlineRequest'; -import { InlineRequest1 } from '../models/InlineRequest1'; -import { InlineRequest2 } from '../models/InlineRequest2'; +import { FilePostRequest } from '../models/FilePostRequest'; import { PetByAge } from '../models/PetByAge'; import { PetByType } from '../models/PetByType'; +import { PetsFilteredPatchRequest } from '../models/PetsFilteredPatchRequest'; +import { PetsPatchRequest } from '../models/PetsPatchRequest'; import { ObservableDefaultApi } from "./ObservableAPI"; import { DefaultApiRequestFactory, DefaultApiResponseProcessor} from "../apis/DefaultApi"; @@ -18,28 +18,28 @@ import { DefaultApiRequestFactory, DefaultApiResponseProcessor} from "../apis/De export interface DefaultApiFilePostRequest { /** * - * @type InlineRequest2 + * @type FilePostRequest * @memberof DefaultApifilePost */ - inlineRequest2?: InlineRequest2 + filePostRequest?: FilePostRequest } export interface DefaultApiPetsFilteredPatchRequest { /** * - * @type InlineRequest1 + * @type PetsFilteredPatchRequest * @memberof DefaultApipetsFilteredPatch */ - inlineRequest1?: InlineRequest1 + petsFilteredPatchRequest?: PetsFilteredPatchRequest } export interface DefaultApiPetsPatchRequest { /** * - * @type InlineRequest + * @type PetsPatchRequest * @memberof DefaultApipetsPatch */ - inlineRequest?: InlineRequest + petsPatchRequest?: PetsPatchRequest } export class ObjectDefaultApi { @@ -53,21 +53,21 @@ export class ObjectDefaultApi { * @param param the request object */ public filePost(param: DefaultApiFilePostRequest = {}, options?: Configuration): Promise { - return this.api.filePost(param.inlineRequest2, options).toPromise(); + return this.api.filePost(param.filePostRequest, options).toPromise(); } /** * @param param the request object */ public petsFilteredPatch(param: DefaultApiPetsFilteredPatchRequest = {}, options?: Configuration): Promise { - return this.api.petsFilteredPatch(param.inlineRequest1, options).toPromise(); + return this.api.petsFilteredPatch(param.petsFilteredPatchRequest, options).toPromise(); } /** * @param param the request object */ public petsPatch(param: DefaultApiPetsPatchRequest = {}, options?: Configuration): Promise { - return this.api.petsPatch(param.inlineRequest, options).toPromise(); + return this.api.petsPatch(param.petsPatchRequest, options).toPromise(); } } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts index c6680d8f25d..15651a2bcac 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts @@ -7,11 +7,11 @@ import { Cat } from '../models/Cat'; import { CatAllOf } from '../models/CatAllOf'; import { Dog } from '../models/Dog'; import { DogAllOf } from '../models/DogAllOf'; -import { InlineRequest } from '../models/InlineRequest'; -import { InlineRequest1 } from '../models/InlineRequest1'; -import { InlineRequest2 } from '../models/InlineRequest2'; +import { FilePostRequest } from '../models/FilePostRequest'; import { PetByAge } from '../models/PetByAge'; import { PetByType } from '../models/PetByType'; +import { PetsFilteredPatchRequest } from '../models/PetsFilteredPatchRequest'; +import { PetsPatchRequest } from '../models/PetsPatchRequest'; import { DefaultApiRequestFactory, DefaultApiResponseProcessor} from "../apis/DefaultApi"; export class ObservableDefaultApi { @@ -30,10 +30,10 @@ export class ObservableDefaultApi { } /** - * @param inlineRequest2 + * @param filePostRequest */ - public filePost(inlineRequest2?: InlineRequest2, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.filePost(inlineRequest2, _options); + public filePost(filePostRequest?: FilePostRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.filePost(filePostRequest, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -52,10 +52,10 @@ export class ObservableDefaultApi { } /** - * @param inlineRequest1 + * @param petsFilteredPatchRequest */ - public petsFilteredPatch(inlineRequest1?: InlineRequest1, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.petsFilteredPatch(inlineRequest1, _options); + public petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.petsFilteredPatch(petsFilteredPatchRequest, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -74,10 +74,10 @@ export class ObservableDefaultApi { } /** - * @param inlineRequest + * @param petsPatchRequest */ - public petsPatch(inlineRequest?: InlineRequest, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.petsPatch(inlineRequest, _options); + public petsPatch(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.petsPatch(petsPatchRequest, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts index 046970370a8..91071153a85 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts @@ -6,11 +6,11 @@ import { Cat } from '../models/Cat'; import { CatAllOf } from '../models/CatAllOf'; import { Dog } from '../models/Dog'; import { DogAllOf } from '../models/DogAllOf'; -import { InlineRequest } from '../models/InlineRequest'; -import { InlineRequest1 } from '../models/InlineRequest1'; -import { InlineRequest2 } from '../models/InlineRequest2'; +import { FilePostRequest } from '../models/FilePostRequest'; import { PetByAge } from '../models/PetByAge'; import { PetByType } from '../models/PetByType'; +import { PetsFilteredPatchRequest } from '../models/PetsFilteredPatchRequest'; +import { PetsPatchRequest } from '../models/PetsPatchRequest'; import { ObservableDefaultApi } from './ObservableAPI'; import { DefaultApiRequestFactory, DefaultApiResponseProcessor} from "../apis/DefaultApi"; @@ -26,26 +26,26 @@ export class PromiseDefaultApi { } /** - * @param inlineRequest2 + * @param filePostRequest */ - public filePost(inlineRequest2?: InlineRequest2, _options?: Configuration): Promise { - const result = this.api.filePost(inlineRequest2, _options); + public filePost(filePostRequest?: FilePostRequest, _options?: Configuration): Promise { + const result = this.api.filePost(filePostRequest, _options); return result.toPromise(); } /** - * @param inlineRequest1 + * @param petsFilteredPatchRequest */ - public petsFilteredPatch(inlineRequest1?: InlineRequest1, _options?: Configuration): Promise { - const result = this.api.petsFilteredPatch(inlineRequest1, _options); + public petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Promise { + const result = this.api.petsFilteredPatch(petsFilteredPatchRequest, _options); return result.toPromise(); } /** - * @param inlineRequest + * @param petsPatchRequest */ - public petsPatch(inlineRequest?: InlineRequest, _options?: Configuration): Promise { - const result = this.api.petsPatch(inlineRequest, _options); + public petsPatch(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Promise { + const result = this.api.petsPatch(petsPatchRequest, _options); return result.toPromise(); } diff --git a/samples/schema/petstore/mysql/.openapi-generator/FILES b/samples/schema/petstore/mysql/.openapi-generator/FILES index dfa9d914fde..84ef3294ab0 100644 --- a/samples/schema/petstore/mysql/.openapi-generator/FILES +++ b/samples/schema/petstore/mysql/.openapi-generator/FILES @@ -21,10 +21,10 @@ Model/EnumTest.sql Model/File.sql Model/FileSchemaTestClass.sql Model/Foo.sql +Model/FooGetDefaultResponse.sql Model/FormatTest.sql Model/HasOnlyReadOnly.sql Model/HealthCheckResult.sql -Model/InlineResponseDefault.sql Model/List.sql Model/MapTest.sql Model/MixedPropertiesAndAdditionalPropertiesClass.sql diff --git a/samples/schema/petstore/mysql/Model/FooGetDefaultResponse.sql b/samples/schema/petstore/mysql/Model/FooGetDefaultResponse.sql new file mode 100644 index 00000000000..f3709246242 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/FooGetDefaultResponse.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for '_foo_get_default_response' definition. +-- + + +-- +-- SELECT template for table `_foo_get_default_response` +-- +SELECT `string` FROM `_foo_get_default_response` WHERE 1; + +-- +-- INSERT template for table `_foo_get_default_response` +-- +INSERT INTO `_foo_get_default_response`(`string`) VALUES (?); + +-- +-- UPDATE template for table `_foo_get_default_response` +-- +UPDATE `_foo_get_default_response` SET `string` = ? WHERE 1; + +-- +-- DELETE template for table `_foo_get_default_response` +-- +DELETE FROM `_foo_get_default_response` WHERE 0; + diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql index e8566fe64cf..d22077b8d12 100644 --- a/samples/schema/petstore/mysql/mysql_schema.sql +++ b/samples/schema/petstore/mysql/mysql_schema.sql @@ -211,6 +211,14 @@ CREATE TABLE IF NOT EXISTS `Foo` ( `bar` TEXT ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `_foo_get_default_response` generated from model 'UnderscorefooUnderscoregetUnderscoredefaultUnderscoreresponse' +-- + +CREATE TABLE IF NOT EXISTS `_foo_get_default_response` ( + `string` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `format_test` generated from model 'formatUnderscoretest' -- @@ -252,14 +260,6 @@ CREATE TABLE IF NOT EXISTS `HealthCheckResult` ( `NullableMessage` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.'; --- --- Table structure for table `inline_response_default` generated from model 'inlineUnderscoreresponseUnderscoredefault' --- - -CREATE TABLE IF NOT EXISTS `inline_response_default` ( - `string` TEXT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- -- Table structure for table `List` generated from model 'List' -- diff --git a/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES b/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES index 872bc298acf..463e9366b2c 100644 --- a/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES +++ b/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES @@ -41,10 +41,10 @@ src/gen/java/org/openapitools/model/EnumClass.java src/gen/java/org/openapitools/model/EnumTest.java src/gen/java/org/openapitools/model/FileSchemaTestClass.java src/gen/java/org/openapitools/model/Foo.java +src/gen/java/org/openapitools/model/FooGetDefaultResponse.java src/gen/java/org/openapitools/model/FormatTest.java src/gen/java/org/openapitools/model/HasOnlyReadOnly.java src/gen/java/org/openapitools/model/HealthCheckResult.java -src/gen/java/org/openapitools/model/InlineResponseDefault.java src/gen/java/org/openapitools/model/MapTest.java src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java src/gen/java/org/openapitools/model/Model200Response.java diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java index 00a9bdddb7e..20c04683dfa 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApi.java @@ -7,7 +7,7 @@ import org.openapitools.api.factories.FooApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import org.openapitools.model.InlineResponseDefault; +import org.openapitools.model.FooGetDefaultResponse; import java.util.Map; import java.util.List; @@ -59,9 +59,9 @@ public class FooApi { @Produces({ "application/json" }) - @io.swagger.annotations.ApiOperation(value = "", notes = "", response = InlineResponseDefault.class, tags={ }) + @io.swagger.annotations.ApiOperation(value = "", notes = "", response = FooGetDefaultResponse.class, tags={ }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "response", response = InlineResponseDefault.class) + @io.swagger.annotations.ApiResponse(code = 200, message = "response", response = FooGetDefaultResponse.class) }) public Response fooGet(@Context SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java index a4dc114ae7e..07f7f34dcef 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FooApiService.java @@ -5,7 +5,7 @@ import org.openapitools.model.*; import org.glassfish.jersey.media.multipart.FormDataBodyPart; -import org.openapitools.model.InlineResponseDefault; +import org.openapitools.model.FooGetDefaultResponse; import java.util.List; import org.openapitools.api.NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java new file mode 100644 index 00000000000..5ad561923b7 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java @@ -0,0 +1,98 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * FooGetDefaultResponse + */ +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + @JsonProperty(JSON_PROPERTY_STRING) + private Foo string; + + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @JsonProperty(value = "string") + @ApiModelProperty(value = "") + @Valid + public Foo getString() { + return string; + } + + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java index 1b87caa98f6..c83f4b9d1da 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java @@ -3,7 +3,7 @@ package org.openapitools.api.impl; import org.openapitools.api.*; import org.openapitools.model.*; -import org.openapitools.model.InlineResponseDefault; +import org.openapitools.model.FooGetDefaultResponse; import java.util.List; import org.openapitools.api.NotFoundException; diff --git a/samples/server/petstore/php-laravel/.openapi-generator/FILES b/samples/server/petstore/php-laravel/.openapi-generator/FILES index b4ae804ba87..eb2e7313fb4 100644 --- a/samples/server/petstore/php-laravel/.openapi-generator/FILES +++ b/samples/server/petstore/php-laravel/.openapi-generator/FILES @@ -44,10 +44,10 @@ lib/app/Models/EnumTest.php lib/app/Models/File.php lib/app/Models/FileSchemaTestClass.php lib/app/Models/Foo.php +lib/app/Models/FooGetDefaultResponse.php lib/app/Models/FormatTest.php lib/app/Models/HasOnlyReadOnly.php lib/app/Models/HealthCheckResult.php -lib/app/Models/InlineResponseDefault.php lib/app/Models/MapTest.php lib/app/Models/MixedPropertiesAndAdditionalPropertiesClass.php lib/app/Models/Model200Response.php diff --git a/samples/server/petstore/php-laravel/lib/app/Models/FooGetDefaultResponse.php b/samples/server/petstore/php-laravel/lib/app/Models/FooGetDefaultResponse.php new file mode 100644 index 00000000000..8e85ac6f3f8 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/FooGetDefaultResponse.php @@ -0,0 +1,15 @@ +, - - #[serde(rename = "binary2")] - #[serde(skip_serializing_if="Option::is_none")] - pub binary2: Option, - -} - -impl InlineRequest { - pub fn new() -> InlineRequest { - InlineRequest { - binary1: None, - binary2: None, - } - } -} - -/// Converts the InlineRequest value to the Query Parameters representation (style=form, explode=false) -/// specified in https://swagger.io/docs/specification/serialization/ -/// Should be implemented in a serde serializer -impl std::string::ToString for InlineRequest { - fn to_string(&self) -> String { - let mut params: Vec = vec![]; - // Skipping binary1 in query parameter serialization - // Skipping binary1 in query parameter serialization - - // Skipping binary2 in query parameter serialization - // Skipping binary2 in query parameter serialization - - params.join(",").to_string() - } -} - -/// Converts Query Parameters representation (style=form, explode=false) to a InlineRequest value -/// as specified in https://swagger.io/docs/specification/serialization/ -/// Should be implemented in a serde deserializer -impl std::str::FromStr for InlineRequest { - type Err = String; - - fn from_str(s: &str) -> std::result::Result { - #[derive(Default)] - // An intermediate representation of the struct to use for parsing. - struct IntermediateRep { - pub binary1: Vec, - pub binary2: Vec, - } - - let mut intermediate_rep = IntermediateRep::default(); - - // Parse into intermediate representation - let mut string_iter = s.split(',').into_iter(); - let mut key_result = string_iter.next(); - - while key_result.is_some() { - let val = match string_iter.next() { - Some(x) => x, - None => return std::result::Result::Err("Missing value while parsing InlineRequest".to_string()) - }; - - if let Some(key) = key_result { - match key { - "binary1" => return std::result::Result::Err("Parsing binary data in this style is not supported in InlineRequest".to_string()), - "binary2" => return std::result::Result::Err("Parsing binary data in this style is not supported in InlineRequest".to_string()), - _ => return std::result::Result::Err("Unexpected key while parsing InlineRequest".to_string()) - } - } - - // Get the next key - key_result = string_iter.next(); - } - - // Use the intermediate representation to return the struct - std::result::Result::Ok(InlineRequest { - binary1: intermediate_rep.binary1.into_iter().next(), - binary2: intermediate_rep.binary2.into_iter().next(), - }) - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for InlineRequest - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into InlineRequest - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct MultipartRelatedRequest { @@ -384,3 +261,126 @@ impl std::convert::TryFrom for header::IntoHeaderVal } } + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct MultipleIdenticalMimeTypesPostRequest { + #[serde(rename = "binary1")] + #[serde(skip_serializing_if="Option::is_none")] + pub binary1: Option, + + #[serde(rename = "binary2")] + #[serde(skip_serializing_if="Option::is_none")] + pub binary2: Option, + +} + +impl MultipleIdenticalMimeTypesPostRequest { + pub fn new() -> MultipleIdenticalMimeTypesPostRequest { + MultipleIdenticalMimeTypesPostRequest { + binary1: None, + binary2: None, + } + } +} + +/// Converts the MultipleIdenticalMimeTypesPostRequest value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::string::ToString for MultipleIdenticalMimeTypesPostRequest { + fn to_string(&self) -> String { + let mut params: Vec = vec![]; + // Skipping binary1 in query parameter serialization + // Skipping binary1 in query parameter serialization + + // Skipping binary2 in query parameter serialization + // Skipping binary2 in query parameter serialization + + params.join(",").to_string() + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a MultipleIdenticalMimeTypesPostRequest value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for MultipleIdenticalMimeTypesPostRequest { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + #[derive(Default)] + // An intermediate representation of the struct to use for parsing. + struct IntermediateRep { + pub binary1: Vec, + pub binary2: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(',').into_iter(); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => return std::result::Result::Err("Missing value while parsing MultipleIdenticalMimeTypesPostRequest".to_string()) + }; + + if let Some(key) = key_result { + match key { + "binary1" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipleIdenticalMimeTypesPostRequest".to_string()), + "binary2" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipleIdenticalMimeTypesPostRequest".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing MultipleIdenticalMimeTypesPostRequest".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(MultipleIdenticalMimeTypesPostRequest { + binary1: intermediate_rep.binary1.into_iter().next(), + binary2: intermediate_rep.binary2.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for MultipleIdenticalMimeTypesPostRequest - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into MultipleIdenticalMimeTypesPostRequest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + diff --git a/samples/server/petstore/rust-server/output/no-example-v3/.openapi-generator/FILES b/samples/server/petstore/rust-server/output/no-example-v3/.openapi-generator/FILES index cfc118d4ff7..1bb2bdbcce9 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/.openapi-generator/FILES +++ b/samples/server/petstore/rust-server/output/no-example-v3/.openapi-generator/FILES @@ -3,7 +3,7 @@ Cargo.toml README.md api/openapi.yaml -docs/InlineRequest.md +docs/OpGetRequest.md docs/default_api.md examples/ca.pem examples/client/main.rs diff --git a/samples/server/petstore/rust-server/output/no-example-v3/README.md b/samples/server/petstore/rust-server/output/no-example-v3/README.md index 8bee672329a..72ec4324c50 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/README.md +++ b/samples/server/petstore/rust-server/output/no-example-v3/README.md @@ -99,7 +99,7 @@ Method | HTTP request | Description ## Documentation For Models - - [InlineRequest](docs/InlineRequest.md) + - [OpGetRequest](docs/OpGetRequest.md) ## Documentation For Authorization diff --git a/samples/server/petstore/rust-server/output/no-example-v3/api/openapi.yaml b/samples/server/petstore/rust-server/output/no-example-v3/api/openapi.yaml index f63e831ad43..a60a7da8f32 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/api/openapi.yaml +++ b/samples/server/petstore/rust-server/output/no-example-v3/api/openapi.yaml @@ -11,14 +11,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_request' + $ref: '#/components/schemas/_op_get_request' required: true responses: "200": description: OK components: schemas: - inline_request: + _op_get_request: properties: propery: type: string diff --git a/samples/server/petstore/rust-server/output/no-example-v3/docs/OpGetRequest.md b/samples/server/petstore/rust-server/output/no-example-v3/docs/OpGetRequest.md new file mode 100644 index 00000000000..fc7bb0c542c --- /dev/null +++ b/samples/server/petstore/rust-server/output/no-example-v3/docs/OpGetRequest.md @@ -0,0 +1,10 @@ +# OpGetRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propery** | **String** | | [optional] [default to None] + +[[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/server/petstore/rust-server/output/no-example-v3/docs/default_api.md b/samples/server/petstore/rust-server/output/no-example-v3/docs/default_api.md index 03deff06924..638f9f80314 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/docs/default_api.md +++ b/samples/server/petstore/rust-server/output/no-example-v3/docs/default_api.md @@ -8,14 +8,14 @@ Method | HTTP request | Description # **** -> (inline_request) +> (op_get_request) ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **inline_request** | [**InlineRequest**](InlineRequest.md)| | + **op_get_request** | [**OpGetRequest**](OpGetRequest.md)| | ### Return type diff --git a/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs b/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs index 46d195faf93..3bc8fa48fe2 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs @@ -104,11 +104,11 @@ impl Api for Server where C: Has + Send + Sync { async fn op_get( &self, - inline_request: models::InlineRequest, + op_get_request: models::OpGetRequest, context: &C) -> Result { let context = context.clone(); - info!("op_get({:?}) - X-Span-ID: {:?}", inline_request, context.get().0.clone()); + info!("op_get({:?}) - X-Span-ID: {:?}", op_get_request, context.get().0.clone()); Err(ApiError("Generic failure".into())) } diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs index 5941e759d64..bc32420a2d9 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs @@ -382,7 +382,7 @@ impl Api for Client where async fn op_get( &self, - param_inline_request: models::InlineRequest, + param_op_get_request: models::OpGetRequest, context: &C) -> Result { let mut client_service = self.client_service.clone(); @@ -415,7 +415,7 @@ impl Api for Client where }; // Body parameter - let body = serde_json::to_string(¶m_inline_request).expect("impossible to fail to serialize"); + let body = serde_json::to_string(¶m_op_get_request).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs index 0b81f725817..100c47adacd 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs @@ -27,7 +27,7 @@ pub trait Api { async fn op_get( &self, - inline_request: models::InlineRequest, + op_get_request: models::OpGetRequest, context: &C) -> Result; } @@ -42,7 +42,7 @@ pub trait ApiNoContext { async fn op_get( &self, - inline_request: models::InlineRequest, + op_get_request: models::OpGetRequest, ) -> Result; } @@ -72,11 +72,11 @@ impl + Send + Sync, C: Clone + Send + Sync> ApiNoContext for Contex async fn op_get( &self, - inline_request: models::InlineRequest, + op_get_request: models::OpGetRequest, ) -> Result { let context = self.context().clone(); - self.api().op_get(inline_request, &context).await + self.api().op_get(op_get_request, &context).await } } diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs index ad99e5097c4..fa170060bd9 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs @@ -6,25 +6,25 @@ use crate::header; #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] -pub struct InlineRequest { +pub struct OpGetRequest { #[serde(rename = "propery")] #[serde(skip_serializing_if="Option::is_none")] pub propery: Option, } -impl InlineRequest { - pub fn new() -> InlineRequest { - InlineRequest { +impl OpGetRequest { + pub fn new() -> OpGetRequest { + OpGetRequest { propery: None, } } } -/// Converts the InlineRequest value to the Query Parameters representation (style=form, explode=false) +/// Converts the OpGetRequest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl std::string::ToString for InlineRequest { +impl std::string::ToString for OpGetRequest { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -37,10 +37,10 @@ impl std::string::ToString for InlineRequest { } } -/// Converts Query Parameters representation (style=form, explode=false) to a InlineRequest value +/// Converts Query Parameters representation (style=form, explode=false) to a OpGetRequest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl std::str::FromStr for InlineRequest { +impl std::str::FromStr for OpGetRequest { type Err = String; fn from_str(s: &str) -> std::result::Result { @@ -59,13 +59,13 @@ impl std::str::FromStr for InlineRequest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return std::result::Result::Err("Missing value while parsing InlineRequest".to_string()) + None => return std::result::Result::Err("Missing value while parsing OpGetRequest".to_string()) }; if let Some(key) = key_result { match key { "propery" => intermediate_rep.propery.push(::from_str(val).map_err(|x| format!("{}", x))?), - _ => return std::result::Result::Err("Unexpected key while parsing InlineRequest".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing OpGetRequest".to_string()) } } @@ -74,40 +74,40 @@ impl std::str::FromStr for InlineRequest { } // Use the intermediate representation to return the struct - std::result::Result::Ok(InlineRequest { + std::result::Result::Ok(OpGetRequest { propery: intermediate_rep.propery.into_iter().next(), }) } } -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { +impl std::convert::TryFrom> for hyper::header::HeaderValue { type Error = String; - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { let hdr_value = hdr_value.to_string(); match hyper::header::HeaderValue::from_str(&hdr_value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for InlineRequest - value: {} is invalid {}", + format!("Invalid header value for OpGetRequest - value: {} is invalid {}", hdr_value, e)) } } } #[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { +impl std::convert::TryFrom for header::IntoHeaderValue { type Error = String; fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { match hdr_value.to_str() { std::result::Result::Ok(value) => { - match ::from_str(value) { + match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into InlineRequest - {}", + format!("Unable to convert header value '{}' into OpGetRequest - {}", value, err)) } }, diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs index caa67c058c3..c8cced13d34 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs @@ -148,31 +148,31 @@ impl hyper::service::Service<(Request, C)> for Service where match result { Ok(body) => { let mut unused_elements = Vec::new(); - let param_inline_request: Option = if !body.is_empty() { + let param_op_get_request: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&*body); match serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); }) { - Ok(param_inline_request) => param_inline_request, + Ok(param_op_get_request) => param_op_get_request, Err(e) => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) - .body(Body::from(format!("Couldn't parse body parameter InlineRequest - doesn't match schema: {}", e))) - .expect("Unable to create Bad Request response for invalid body parameter InlineRequest due to schema")), + .body(Body::from(format!("Couldn't parse body parameter OpGetRequest - doesn't match schema: {}", e))) + .expect("Unable to create Bad Request response for invalid body parameter OpGetRequest due to schema")), } } else { None }; - let param_inline_request = match param_inline_request { - Some(param_inline_request) => param_inline_request, + let param_op_get_request = match param_op_get_request { + Some(param_op_get_request) => param_op_get_request, None => return Ok(Response::builder() .status(StatusCode::BAD_REQUEST) - .body(Body::from("Missing required body parameter InlineRequest")) - .expect("Unable to create Bad Request response for missing body parameter InlineRequest")), + .body(Body::from("Missing required body parameter OpGetRequest")) + .expect("Unable to create Bad Request response for missing body parameter OpGetRequest")), }; let result = api_impl.op_get( - param_inline_request, + param_op_get_request, &context ).await; let mut response = Response::new(Body::empty()); @@ -207,8 +207,8 @@ impl hyper::service::Service<(Request, C)> for Service where }, Err(e) => Ok(Response::builder() .status(StatusCode::BAD_REQUEST) - .body(Body::from(format!("Couldn't read body parameter InlineRequest: {}", e))) - .expect("Unable to create Bad Request response due to unable to read body parameter InlineRequest")), + .body(Body::from(format!("Couldn't read body parameter OpGetRequest: {}", e))) + .expect("Unable to create Bad Request response due to unable to read body parameter OpGetRequest")), } }, diff --git a/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES b/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES index d1eaac072b4..b0d6b6c8395 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES +++ b/samples/server/petstore/rust-server/output/openapi-v3/.openapi-generator/FILES @@ -7,6 +7,7 @@ docs/AdditionalPropertiesWithList.md docs/AnotherXmlArray.md docs/AnotherXmlInner.md docs/AnotherXmlObject.md +docs/AnyOfGet202Response.md docs/AnyOfObject.md docs/AnyOfObjectAnyOf.md docs/AnyOfProperty.md @@ -14,9 +15,9 @@ docs/DuplicateXmlObject.md docs/EnumWithStarObject.md docs/Err.md docs/Error.md -docs/InlineResponse201.md docs/Model12345AnyOfObject.md docs/Model12345AnyOfObjectAnyOf.md +docs/MultigetGet201Response.md docs/MyId.md docs/MyIdList.md docs/NullableTest.md @@ -25,6 +26,7 @@ docs/ObjectParam.md docs/ObjectUntypedProps.md docs/ObjectWithArrayOfObjects.md docs/Ok.md +docs/OneOfGet200Response.md docs/OptionalObjectHeader.md docs/RequiredObjectHeader.md docs/Result.md diff --git a/samples/server/petstore/rust-server/output/openapi-v3/README.md b/samples/server/petstore/rust-server/output/openapi-v3/README.md index d0e29d93bf4..b5bbb27bdf3 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/README.md @@ -153,6 +153,7 @@ Method | HTTP request | Description - [AnotherXmlArray](docs/AnotherXmlArray.md) - [AnotherXmlInner](docs/AnotherXmlInner.md) - [AnotherXmlObject](docs/AnotherXmlObject.md) + - [AnyOfGet202Response](docs/AnyOfGet202Response.md) - [AnyOfObject](docs/AnyOfObject.md) - [AnyOfObjectAnyOf](docs/AnyOfObjectAnyOf.md) - [AnyOfProperty](docs/AnyOfProperty.md) @@ -160,9 +161,9 @@ Method | HTTP request | Description - [EnumWithStarObject](docs/EnumWithStarObject.md) - [Err](docs/Err.md) - [Error](docs/Error.md) - - [InlineResponse201](docs/InlineResponse201.md) - [Model12345AnyOfObject](docs/Model12345AnyOfObject.md) - [Model12345AnyOfObjectAnyOf](docs/Model12345AnyOfObjectAnyOf.md) + - [MultigetGet201Response](docs/MultigetGet201Response.md) - [MyId](docs/MyId.md) - [MyIdList](docs/MyIdList.md) - [NullableTest](docs/NullableTest.md) @@ -171,6 +172,7 @@ Method | HTTP request | Description - [ObjectUntypedProps](docs/ObjectUntypedProps.md) - [ObjectWithArrayOfObjects](docs/ObjectWithArrayOfObjects.md) - [Ok](docs/Ok.md) + - [OneOfGet200Response](docs/OneOfGet200Response.md) - [OptionalObjectHeader](docs/OptionalObjectHeader.md) - [RequiredObjectHeader](docs/RequiredObjectHeader.md) - [Result](docs/Result.md) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml index e4fe38e5d43..aba7f549eaa 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml +++ b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml @@ -79,7 +79,7 @@ paths: content: application/xml: schema: - $ref: '#/components/schemas/inline_response_201' + $ref: '#/components/schemas/_multiget_get_201_response' description: XML rsp "202": content: @@ -415,11 +415,7 @@ paths: content: application/json: schema: - oneOf: - - type: integer - - items: - type: string - type: array + $ref: '#/components/schemas/_one_of_get_200_response' description: Success /any-of: get: @@ -452,9 +448,7 @@ paths: content: application/json: schema: - anyOf: - - $ref: '#/components/schemas/StringObject' - - $ref: '#/components/schemas/UuidObject' + $ref: '#/components/schemas/_any_of_get_202_response' description: AnyOfSuccess /json-complex-query-param: get: @@ -671,11 +665,21 @@ components: type: string Result: type: string - inline_response_201: + _multiget_get_201_response: properties: foo: type: string type: object + _one_of_get_200_response: + oneOf: + - type: integer + - items: + type: string + type: array + _any_of_get_202_response: + anyOf: + - $ref: '#/components/schemas/StringObject' + - $ref: '#/components/schemas/UuidObject' AnyOfObject_anyOf: enum: - FOO diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfGet202Response.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfGet202Response.md new file mode 100644 index 00000000000..40639b6228b --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/AnyOfGet202Response.md @@ -0,0 +1,9 @@ +# AnyOfGet202Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/server/petstore/rust-server/output/openapi-v3/docs/MultigetGet201Response.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/MultigetGet201Response.md new file mode 100644 index 00000000000..28a7502b747 --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/MultigetGet201Response.md @@ -0,0 +1,10 @@ +# MultigetGet201Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | **String** | | [optional] [default to None] + +[[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/server/petstore/rust-server/output/openapi-v3/docs/OneOfGet200Response.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/OneOfGet200Response.md new file mode 100644 index 00000000000..154891aef9e --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/OneOfGet200Response.md @@ -0,0 +1,9 @@ +# OneOfGet200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/server/petstore/rust-server/output/openapi-v3/docs/default_api.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md index 3bcab0647b3..192101ead31 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md @@ -268,7 +268,7 @@ This endpoint does not need any parameter. [[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) # **** -> swagger::OneOf2> () +> models::OneOfGet200Response () ### Required Parameters @@ -276,7 +276,7 @@ This endpoint does not need any parameter. ### Return type -[**swagger::OneOf2>**](swagger::OneOf2>.md) +[**models::OneOfGet200Response**](_one_of_get_200_response.md) ### Authorization diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs index e4430088125..3e21905952a 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs @@ -490,7 +490,7 @@ impl Api for Client where .map_err(|e| ApiError(format!("Failed to read response: {}", e))).await?; let body = str::from_utf8(&body) .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>(body).map_err(|e| { + let body = serde_json::from_str::(body).map_err(|e| { ApiError(format!("Response body did not match the schema: {}", e)) })?; Ok(AnyOfGetResponse::AnyOfSuccess @@ -1035,7 +1035,7 @@ impl Api for Client where .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; // ToDo: this will move to swagger-rs and become a standard From conversion trait // once https://github.com/RReverser/serde-xml-rs/pull/45 is accepted upstream - let body = serde_xml_rs::from_str::(body) + let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e)))?; Ok(MultigetGetResponse::XMLRsp (body) @@ -1261,7 +1261,7 @@ impl Api for Client where .map_err(|e| ApiError(format!("Failed to read response: {}", e))).await?; let body = str::from_utf8(&body) .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - let body = serde_json::from_str::>>(body).map_err(|e| { + let body = serde_json::from_str::(body).map_err(|e| { ApiError(format!("Response body did not match the schema: {}", e)) })?; Ok(OneOfGetResponse::Success diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs index 6c54e17ce75..61da16cebad 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs @@ -25,7 +25,7 @@ pub enum AnyOfGetResponse { , /// AnyOfSuccess AnyOfSuccess - (swagger::AnyOf2) + (models::AnyOfGet202Response) } #[derive(Debug, PartialEq, Serialize, Deserialize)] @@ -74,7 +74,7 @@ pub enum MultigetGetResponse { , /// XML rsp XMLRsp - (models::InlineResponse201) + (models::MultigetGet201Response) , /// octet rsp OctetRsp @@ -107,7 +107,7 @@ pub enum MultipleAuthSchemeGetResponse { pub enum OneOfGetResponse { /// Success Success - (swagger::OneOf2>) + (models::OneOfGet200Response) } #[derive(Debug, PartialEq, Serialize, Deserialize)] diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs index 7d9aa159a1f..8f9ceabecc8 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs @@ -399,6 +399,116 @@ impl AnotherXmlObject { } } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct AnyOfGet202Response { +} + +impl AnyOfGet202Response { + pub fn new() -> AnyOfGet202Response { + AnyOfGet202Response { + } + } +} + +/// Converts the AnyOfGet202Response value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::string::ToString for AnyOfGet202Response { + fn to_string(&self) -> String { + let mut params: Vec = vec![]; + params.join(",").to_string() + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a AnyOfGet202Response value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for AnyOfGet202Response { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + #[derive(Default)] + // An intermediate representation of the struct to use for parsing. + struct IntermediateRep { + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(',').into_iter(); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => return std::result::Result::Err("Missing value while parsing AnyOfGet202Response".to_string()) + }; + + if let Some(key) = key_result { + match key { + _ => return std::result::Result::Err("Unexpected key while parsing AnyOfGet202Response".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(AnyOfGet202Response { + }) + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for AnyOfGet202Response - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into AnyOfGet202Response - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + + +impl AnyOfGet202Response { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + /// Test a model containing an anyOf #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] @@ -982,130 +1092,6 @@ impl Error { } } -#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] -#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] -pub struct InlineResponse201 { - #[serde(rename = "foo")] - #[serde(skip_serializing_if="Option::is_none")] - pub foo: Option, - -} - -impl InlineResponse201 { - pub fn new() -> InlineResponse201 { - InlineResponse201 { - foo: None, - } - } -} - -/// Converts the InlineResponse201 value to the Query Parameters representation (style=form, explode=false) -/// specified in https://swagger.io/docs/specification/serialization/ -/// Should be implemented in a serde serializer -impl std::string::ToString for InlineResponse201 { - fn to_string(&self) -> String { - let mut params: Vec = vec![]; - - if let Some(ref foo) = self.foo { - params.push("foo".to_string()); - params.push(foo.to_string()); - } - - params.join(",").to_string() - } -} - -/// Converts Query Parameters representation (style=form, explode=false) to a InlineResponse201 value -/// as specified in https://swagger.io/docs/specification/serialization/ -/// Should be implemented in a serde deserializer -impl std::str::FromStr for InlineResponse201 { - type Err = String; - - fn from_str(s: &str) -> std::result::Result { - #[derive(Default)] - // An intermediate representation of the struct to use for parsing. - struct IntermediateRep { - pub foo: Vec, - } - - let mut intermediate_rep = IntermediateRep::default(); - - // Parse into intermediate representation - let mut string_iter = s.split(',').into_iter(); - let mut key_result = string_iter.next(); - - while key_result.is_some() { - let val = match string_iter.next() { - Some(x) => x, - None => return std::result::Result::Err("Missing value while parsing InlineResponse201".to_string()) - }; - - if let Some(key) = key_result { - match key { - "foo" => intermediate_rep.foo.push(::from_str(val).map_err(|x| format!("{}", x))?), - _ => return std::result::Result::Err("Unexpected key while parsing InlineResponse201".to_string()) - } - } - - // Get the next key - key_result = string_iter.next(); - } - - // Use the intermediate representation to return the struct - std::result::Result::Ok(InlineResponse201 { - foo: intermediate_rep.foo.into_iter().next(), - }) - } -} - -// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom> for hyper::header::HeaderValue { - type Error = String; - - fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { - let hdr_value = hdr_value.to_string(); - match hyper::header::HeaderValue::from_str(&hdr_value) { - std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(e) => std::result::Result::Err( - format!("Invalid header value for InlineResponse201 - value: {} is invalid {}", - hdr_value, e)) - } - } -} - -#[cfg(any(feature = "client", feature = "server"))] -impl std::convert::TryFrom for header::IntoHeaderValue { - type Error = String; - - fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { - match hdr_value.to_str() { - std::result::Result::Ok(value) => { - match ::from_str(value) { - std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), - std::result::Result::Err(err) => std::result::Result::Err( - format!("Unable to convert header value '{}' into InlineResponse201 - {}", - value, err)) - } - }, - std::result::Result::Err(e) => std::result::Result::Err( - format!("Unable to convert header: {:?} to string: {}", - hdr_value, e)) - } - } -} - - -impl InlineResponse201 { - /// Helper function to allow us to convert this model to an XML string. - /// Will panic if serialisation fails. - #[allow(dead_code)] - pub(crate) fn to_xml(&self) -> String { - serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") - } -} - /// Test a model containing an anyOf that starts with a number #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] @@ -1265,6 +1251,130 @@ impl Model12345AnyOfObjectAnyOf { } } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct MultigetGet201Response { + #[serde(rename = "foo")] + #[serde(skip_serializing_if="Option::is_none")] + pub foo: Option, + +} + +impl MultigetGet201Response { + pub fn new() -> MultigetGet201Response { + MultigetGet201Response { + foo: None, + } + } +} + +/// Converts the MultigetGet201Response value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::string::ToString for MultigetGet201Response { + fn to_string(&self) -> String { + let mut params: Vec = vec![]; + + if let Some(ref foo) = self.foo { + params.push("foo".to_string()); + params.push(foo.to_string()); + } + + params.join(",").to_string() + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a MultigetGet201Response value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for MultigetGet201Response { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + #[derive(Default)] + // An intermediate representation of the struct to use for parsing. + struct IntermediateRep { + pub foo: Vec, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(',').into_iter(); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => return std::result::Result::Err("Missing value while parsing MultigetGet201Response".to_string()) + }; + + if let Some(key) = key_result { + match key { + "foo" => intermediate_rep.foo.push(::from_str(val).map_err(|x| format!("{}", x))?), + _ => return std::result::Result::Err("Unexpected key while parsing MultigetGet201Response".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(MultigetGet201Response { + foo: intermediate_rep.foo.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for MultigetGet201Response - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into MultigetGet201Response - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + + +impl MultigetGet201Response { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct MyId(i32); @@ -2221,6 +2331,116 @@ impl Ok { } } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct OneOfGet200Response { +} + +impl OneOfGet200Response { + pub fn new() -> OneOfGet200Response { + OneOfGet200Response { + } + } +} + +/// Converts the OneOfGet200Response value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::string::ToString for OneOfGet200Response { + fn to_string(&self) -> String { + let mut params: Vec = vec![]; + params.join(",").to_string() + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a OneOfGet200Response value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for OneOfGet200Response { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + #[derive(Default)] + // An intermediate representation of the struct to use for parsing. + struct IntermediateRep { + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(',').into_iter(); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => return std::result::Result::Err("Missing value while parsing OneOfGet200Response".to_string()) + }; + + if let Some(key) = key_result { + match key { + _ => return std::result::Result::Err("Unexpected key while parsing OneOfGet200Response".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(OneOfGet200Response { + }) + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match hyper::header::HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for OneOfGet200Response - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(any(feature = "client", feature = "server"))] +impl std::convert::TryFrom for header::IntoHeaderValue { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into OneOfGet200Response - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + + +impl OneOfGet200Response { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct OptionalObjectHeader(i32);