From b63242219c7584b7cde7ebc9892fe1ed4a7424e5 Mon Sep 17 00:00:00 2001 From: Alex Korobko Date: Wed, 9 Jan 2019 16:22:20 -0500 Subject: [PATCH] Issue 1766 Modified mustache files for Go to support nullable in the spec v3.0+; Updated model files running .sh scripts for Go. --- .../resources/go-gin-server/model.mustache | 2 +- .../main/resources/go-server/model.mustache | 2 +- .../src/main/resources/go/model.mustache | 2 +- .../src/main/resources/go/model_doc.mustache | 2 +- .../.openapi-generator/VERSION | 2 +- .../petstore/go/go-petstore-withXml/README.md | 5 +- .../go/go-petstore-withXml/api/openapi.yaml | 784 ++++++++++-------- .../go-petstore-withXml/api_another_fake.go | 23 +- .../go/go-petstore-withXml/api_fake.go | 214 +++-- .../api_fake_classname_tags123.go | 23 +- .../go/go-petstore-withXml/api_pet.go | 97 ++- .../go/go-petstore-withXml/api_store.go | 57 +- .../go/go-petstore-withXml/api_user.go | 58 +- .../go/go-petstore-withXml/docs/AnimalFarm.md | 9 - .../docs/AnotherFakeApi.md | 4 +- .../go/go-petstore-withXml/docs/Category.md | 2 +- .../go/go-petstore-withXml/docs/FakeApi.md | 62 +- .../docs/FakeClassnameTags123Api.md | 4 +- .../go/go-petstore-withXml/docs/PetApi.md | 8 +- .../go/go-petstore-withXml/docs/StoreApi.md | 4 +- .../docs/StringBooleanMap.md | 9 - .../go/go-petstore-withXml/docs/UserApi.md | 16 +- .../go-petstore-withXml/model_animal_farm.go | 14 - .../go/go-petstore-withXml/model_category.go | 2 +- .../model_string_boolean_map.go | 14 - .../go-api-server/.openapi-generator/VERSION | 2 +- .../petstore/go-api-server/api/openapi.yaml | 7 + .../go-api-server/go/model_api_response.go | 1 + .../go-api-server/go/model_category.go | 1 + .../petstore/go-api-server/go/model_order.go | 1 + .../petstore/go-api-server/go/model_pet.go | 3 +- .../petstore/go-api-server/go/model_tag.go | 1 + .../petstore/go-api-server/go/model_user.go | 1 + .../go-gin-api-server/go/model_pet.go | 2 +- 34 files changed, 839 insertions(+), 599 deletions(-) delete mode 100644 samples/client/petstore/go/go-petstore-withXml/docs/AnimalFarm.md delete mode 100644 samples/client/petstore/go/go-petstore-withXml/docs/StringBooleanMap.md delete mode 100644 samples/client/petstore/go/go-petstore-withXml/model_animal_farm.go delete mode 100644 samples/client/petstore/go/go-petstore-withXml/model_string_boolean_map.go diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache index 28ba90cffc6..254fcb1f89a 100644 --- a/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache +++ b/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache @@ -19,6 +19,6 @@ const ( type {{classname}} struct { {{#vars}}{{#description}} // {{{description}}}{{/description}} - {{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` + {{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` {{/vars}} }{{/isEnum}}{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go-server/model.mustache b/modules/openapi-generator/src/main/resources/go-server/model.mustache index 28ba90cffc6..254fcb1f89a 100644 --- a/modules/openapi-generator/src/main/resources/go-server/model.mustache +++ b/modules/openapi-generator/src/main/resources/go-server/model.mustache @@ -19,6 +19,6 @@ const ( type {{classname}} struct { {{#vars}}{{#description}} // {{{description}}}{{/description}} - {{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` + {{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` {{/vars}} }{{/isEnum}}{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go/model.mustache b/modules/openapi-generator/src/main/resources/go/model.mustache index 07e5c758516..1a9f8d1c5aa 100644 --- a/modules/openapi-generator/src/main/resources/go/model.mustache +++ b/modules/openapi-generator/src/main/resources/go/model.mustache @@ -35,7 +35,7 @@ type {{classname}} struct { {{#description}} // {{{description}}} {{/description}} - {{name}} {{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` + {{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` {{/vars}} } {{/isEnum}} diff --git a/modules/openapi-generator/src/main/resources/go/model_doc.mustache b/modules/openapi-generator/src/main/resources/go/model_doc.mustache index 8f3c785d458..7889467690e 100644 --- a/modules/openapi-generator/src/main/resources/go/model_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go/model_doc.mustache @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{#vars}}**{{name}}** | {{#isNullable}}Pointer to {{/isNullable}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} {{/vars}} [[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/go/go-petstore-withXml/.openapi-generator/VERSION b/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION index f4cb97d56ce..afa63656064 100644 --- a/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION +++ b/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.1-SNAPSHOT \ No newline at end of file +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore-withXml/README.md b/samples/client/petstore/go/go-petstore-withXml/README.md index 610174ac2a8..4bca622853b 100644 --- a/samples/client/petstore/go/go-petstore-withXml/README.md +++ b/samples/client/petstore/go/go-petstore-withXml/README.md @@ -40,6 +40,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters +*FakeApi* | [**TestGroupParameters**](docs/FakeApi.md#testgroupparameters) | **Delete** /fake | Fake endpoint to test group parameters (optional) *FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties *FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **Get** /fake/jsonFormData | test json serialization of form data *FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **Patch** /fake_classname_test | To test class name in snake case @@ -70,7 +71,6 @@ Class | Method | HTTP request | Description - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) - [Animal](docs/Animal.md) - - [AnimalFarm](docs/AnimalFarm.md) - [ApiResponse](docs/ApiResponse.md) - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) @@ -101,8 +101,9 @@ Class | Method | HTTP request | Description - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Return](docs/Return.md) - [SpecialModelName](docs/SpecialModelName.md) - - [StringBooleanMap](docs/StringBooleanMap.md) - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) - [User](docs/User.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml index 4009731809f..671c549a19a 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml @@ -42,6 +42,7 @@ paths: summary: Add a new pet to the store tags: - pet + x-codegen-request-body-name: body put: operationId: updatePet requestBody: @@ -71,6 +72,7 @@ paths: summary: Update an existing pet tags: - pet + x-codegen-request-body-name: body /pet/findByStatus: get: description: Multiple status values can be provided with comma separated strings @@ -327,6 +329,7 @@ paths: summary: Place an order for a pet tags: - store + x-codegen-request-body-name: body /store/order/{order_id}: delete: description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -398,6 +401,7 @@ paths: summary: Create user tags: - user + x-codegen-request-body-name: body /user/createWithArray: post: operationId: createUsersWithArrayInput @@ -417,6 +421,7 @@ paths: summary: Creates list of users with given input array tags: - user + x-codegen-request-body-name: body /user/createWithList: post: operationId: createUsersWithListInput @@ -436,6 +441,7 @@ paths: summary: Creates list of users with given input array tags: - user + x-codegen-request-body-name: body /user/login: get: operationId: loginUser @@ -565,6 +571,7 @@ paths: summary: Updated user tags: - user + x-codegen-request-body-name: body /fake_classname_test: patch: description: To test class name in snake case @@ -588,7 +595,55 @@ paths: summary: To test class name in snake case tags: - fake_classname_tags 123#$%^ + x-codegen-request-body-name: body /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + in: query + name: required_string_group + required: true + schema: + type: integer + - description: Required Boolean in group parameters + in: header + name: required_boolean_group + required: true + schema: + type: boolean + - description: Required Integer in group parameters + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + - description: String in group parameters + in: query + name: string_group + schema: + type: integer + - description: Boolean in group parameters + in: header + name: boolean_group + schema: + type: boolean + - description: Integer in group parameters + in: query + name: int64_group + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Someting wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true get: description: To test enum parameters operationId: testEnumParameters @@ -709,6 +764,7 @@ paths: summary: To test "client" model tags: - fake + x-codegen-request-body-name: body post: description: | Fake endpoint for testing various parameters @@ -827,6 +883,7 @@ paths: description: Output number tags: - fake + x-codegen-request-body-name: body /fake/outer/string: post: description: Test serialization of outer string types @@ -847,6 +904,7 @@ paths: description: Output string tags: - fake + x-codegen-request-body-name: body /fake/outer/boolean: post: description: Test serialization of outer boolean types @@ -867,6 +925,7 @@ paths: description: Output boolean tags: - fake + x-codegen-request-body-name: body /fake/outer/composite: post: description: Test serialization of object with outer number type @@ -887,6 +946,7 @@ paths: description: Output composite tags: - fake + x-codegen-request-body-name: body /fake/jsonFormData: get: operationId: testJsonFormData @@ -931,6 +991,7 @@ paths: summary: test inline additionalProperties tags: - fake + x-codegen-request-body-name: param /fake/body-with-query-params: put: operationId: testBodyWithQueryParams @@ -952,6 +1013,7 @@ paths: description: Success tags: - fake + x-codegen-request-body-name: body /another-fake/dummy: patch: description: To test special tags and operation ID starting with number @@ -973,6 +1035,7 @@ paths: summary: To test special tags tags: - $another-fake? + x-codegen-request-body-name: body /fake/body-with-file-schema: put: description: For this test, the body for this request much reference a schema named `File`. @@ -989,6 +1052,7 @@ paths: description: Success tags: - fake + x-codegen-request-body-name: body /fake/{petId}/uploadImageWithRequiredFile: post: operationId: uploadFileWithRequiredFile @@ -1031,16 +1095,53 @@ paths: - pet components: schemas: + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order Category: example: - name: name + name: default-name id: 6 properties: id: format: int64 type: integer name: + default: default-name type: string + required: + - name type: object xml: name: Category @@ -1078,45 +1179,72 @@ components: type: object xml: name: User - OuterNumber: - type: number - ArrayOfNumberOnly: + Tag: + example: + name: name + id: 1 properties: - ArrayNumber: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: items: - type: number + type: string type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls type: object - Capitalization: - properties: - smallCamel: - type: string - CapitalCamel: - type: string - small_Snake: - type: string - Capital_Snake: - type: string - SCA_ETH_Flow_Points: - type: string - ATT_NAME: - description: | - Name of the pet - type: string - type: object - MixedPropertiesAndAdditionalPropertiesClass: - properties: - uuid: - format: uuid - type: string - dateTime: - format: date-time - type: string - map: - additionalProperties: - $ref: '#/components/schemas/Animal' - type: object - type: object + xml: + name: Pet ApiResponse: example: code: 0 @@ -1131,6 +1259,23 @@ components: message: type: string type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return Name: description: Model for testing model name same as property name properties: @@ -1151,23 +1296,6 @@ components: type: object xml: name: Name - EnumClass: - default: -efg - enum: - - _abc - - -efg - - (xyz) - type: string - List: - properties: - 123-list: - type: string - type: object - NumberOnly: - properties: - JustNumber: - type: number - type: object 200_response: description: Model for testing model name starting with number properties: @@ -1179,11 +1307,10 @@ components: type: object xml: name: Name - Client: - example: - client: client + ClassModel: + description: Model for testing model with "_class" property properties: - client: + _class: type: string type: object Dog: @@ -1193,158 +1320,29 @@ components: breed: type: string type: object - Enum_Test: + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + propertyName: className properties: - enum_string: - enum: - - UPPER - - lower - - "" + className: type: string - enum_string_required: - enum: - - UPPER - - lower - - "" + color: + default: red type: string - enum_integer: - enum: - - 1 - - -1 - format: int32 - type: integer - enum_number: - enum: - - 1.1 - - -1.2 - format: double - type: number - outerEnum: - $ref: '#/components/schemas/OuterEnum' required: - - enum_string_required - type: object - Order: - example: - petId: 6 - quantity: 1 - id: 0 - shipDate: 2000-01-23T04:56:07.000+00:00 - complete: false - status: placed - properties: - id: - format: int64 - type: integer - petId: - format: int64 - type: integer - quantity: - format: int32 - type: integer - shipDate: - format: date-time - type: string - status: - description: Order Status - enum: - - placed - - approved - - delivered - type: string - complete: - default: false - type: boolean - type: object - xml: - name: Order - AdditionalPropertiesClass: - properties: - map_property: - additionalProperties: - type: string - type: object - map_of_map_property: - additionalProperties: - additionalProperties: - type: string - type: object - type: object - type: object - $special[model.name]: - properties: - $special[property.name]: - format: int64 - type: integer - type: object - xml: - name: $special[model.name] - Return: - description: Model for testing reserved words - properties: - return: - format: int32 - type: integer - type: object - xml: - name: Return - ReadOnlyFirst: - properties: - bar: - readOnly: true - type: string - baz: - type: string - type: object - ArrayOfArrayOfNumberOnly: - properties: - ArrayArrayNumber: - items: - items: - type: number - type: array - type: array - type: object - OuterEnum: - enum: - - placed - - approved - - delivered - type: string - ArrayTest: - properties: - array_of_string: - items: - type: string - type: array - array_array_of_integer: - items: - items: - format: int64 - type: integer - type: array - type: array - array_array_of_model: - items: - items: - $ref: '#/components/schemas/ReadOnlyFirst' - type: array - type: array - type: object - OuterComposite: - example: - my_string: my_string - my_number: 0.80082819046101150206595775671303272247314453125 - my_boolean: true - properties: - my_number: - type: number - my_string: - type: string - my_boolean: - type: boolean - x-codegen-body-parameter-name: boolean_post_body + - className type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array format_test: properties: integer: @@ -1403,70 +1401,116 @@ components: - number - password type: object - EnumArrays: - properties: - just_symbol: - enum: - - '>=' - - $ - type: string - array_enum: - items: - enum: - - fish - - crab - type: string - type: array - type: object - OuterString: + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) type: string - ClassModel: - description: Model for testing model with "_class" property + Enum_Test: properties: - _class: + enum_string: + enum: + - UPPER + - lower + - "" type: string - type: object - OuterBoolean: - type: boolean - x-codegen-body-parameter-name: boolean_post_body - FileSchemaTestClass: - example: - file: - sourceURI: sourceURI - files: - - sourceURI: sourceURI - - sourceURI: sourceURI - properties: - file: - $ref: '#/components/schemas/File' - files: - items: - $ref: '#/components/schemas/File' - type: array - type: object - Animal: - discriminator: - propertyName: className - properties: - className: - type: string - color: - default: red + enum_string_required: + enum: + - UPPER + - lower + - "" type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' required: - - className + - enum_string_required type: object - StringBooleanMap: - additionalProperties: - type: boolean + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + 123-list: + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string type: object - Cat: - allOf: - - $ref: '#/components/schemas/Animal' - - properties: - declawed: - type: boolean - type: object MapTest: properties: map_map_of_string: @@ -1491,23 +1535,108 @@ components: type: boolean type: object type: object - Tag: - example: - name: name - id: 1 + ArrayTest: properties: - id: - format: int64 - type: integer - name: - type: string + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + OuterComposite: + example: + my_string: my_string + my_number: 0.80082819046101150206595775671303272247314453125 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array type: object - xml: - name: Tag - AnimalFarm: - items: - $ref: '#/components/schemas/Animal' - type: array File: description: Must be named `File` for test. example: @@ -1517,67 +1646,58 @@ components: description: Test capitalization type: string type: object - Pet: - example: - photoUrls: - - photoUrls - - photoUrls - name: doggie - id: 0 - category: - name: name - id: 6 - tags: - - name: name - id: 1 - - name: name - id: 1 - status: available + TypeHolderDefault: properties: - id: - format: int64 + string_item: + default: what + type: string + number_item: + type: number + integer_item: type: integer - x-is-unique: true - category: - $ref: '#/components/schemas/Category' - name: - example: doggie - type: string - photoUrls: + bool_item: + default: true + type: boolean + array_item: items: - type: string + type: integer type: array - xml: - name: photoUrl - wrapped: true - tags: - items: - $ref: '#/components/schemas/Tag' - type: array - xml: - name: tag - wrapped: true - status: - description: pet status in the store - enum: - - available - - pending - - sold - type: string required: - - name - - photoUrls + - array_item + - bool_item + - integer_item + - number_item + - string_item type: object - xml: - name: Pet - hasOnlyReadOnly: + TypeHolderExample: properties: - bar: - readOnly: true - type: string - foo: - readOnly: true + string_item: + example: what type: string + number_item: + example: 1.234 + type: number + integer_item: + example: -2 + type: integer + bool_item: + example: true + type: boolean + array_item: + example: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + required: + - array_item + - bool_item + - integer_item + - number_item + - string_item type: object securitySchemes: petstore_auth: @@ -1588,9 +1708,6 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 - http_basic_test: - scheme: basic - type: http api_key: in: header name: api_key @@ -1599,3 +1716,6 @@ components: in: query name: api_key_query type: apiKey + http_basic_test: + scheme: basic + type: http diff --git a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go index 2367690cc0e..7396effd641 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go @@ -29,10 +29,10 @@ type AnotherFakeApiService service AnotherFakeApiService To test special tags To test special tags and operation ID starting with number * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param client client model + * @param body client model @return Client */ -func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) { +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} @@ -67,7 +67,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, clie localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &client + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err @@ -84,14 +84,6 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -110,5 +102,14 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_fake.go index 46fd09eecf3..9d4f189f955 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake.go @@ -95,14 +95,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -121,6 +113,15 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -129,12 +130,12 @@ FakeApiService Test serialization of object with outer number type * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters: - * @param "OuterComposite" (optional.Interface of OuterComposite) - Input composite as post body + * @param "Body" (optional.Interface of OuterComposite) - Input composite as post body @return OuterComposite */ type FakeOuterCompositeSerializeOpts struct { - OuterComposite optional.Interface + Body optional.Interface } func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) { @@ -172,12 +173,12 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.OuterComposite.IsSet() { - localVarOptionalOuterComposite, localVarOptionalOuterCompositeok := localVarOptionals.OuterComposite.Value().(OuterComposite) - if !localVarOptionalOuterCompositeok { - return localVarReturnValue, nil, reportError("outerComposite should be OuterComposite") + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + localVarOptionalBody, localVarOptionalBodyok := localVarOptionals.Body.Value().(OuterComposite) + if !localVarOptionalBodyok { + return localVarReturnValue, nil, reportError("body should be OuterComposite") } - localVarPostBody = &localVarOptionalOuterComposite + localVarPostBody = &localVarOptionalBody } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) @@ -196,14 +197,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -222,6 +215,15 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -293,14 +295,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -319,6 +313,15 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -390,14 +393,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -416,6 +411,15 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -423,9 +427,9 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO FakeApiService For this test, the body for this request much reference a schema named `File`. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param fileSchemaTestClass + * @param body */ -func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) { +func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSchemaTestClass) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} @@ -459,7 +463,7 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaT localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &fileSchemaTestClass + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err @@ -491,9 +495,9 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaT FakeApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param query - * @param user + * @param body */ -func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) { +func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, body User) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} @@ -528,7 +532,7 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &user + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err @@ -560,10 +564,10 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri FakeApiService To test \"client\" model To test \"client\" model * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param client client model + * @param body client model @return Client */ -func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) { +func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Client, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} @@ -598,7 +602,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &client + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err @@ -615,14 +619,6 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -641,6 +637,15 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -906,12 +911,103 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona return localVarHttpResponse, nil } +/* +FakeApiService Fake endpoint to test group parameters (optional) +Fake endpoint to test group parameters (optional) + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param optional nil or *TestGroupParametersOpts - Optional Parameters: + * @param "StringGroup" (optional.Int32) - String in group parameters + * @param "BooleanGroup" (optional.Bool) - Boolean in group parameters + * @param "Int64Group" (optional.Int64) - Integer in group parameters +*/ + +type TestGroupParametersOpts struct { + StringGroup optional.Int32 + BooleanGroup optional.Bool + Int64Group optional.Int64 +} + +func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("required_string_group", parameterToString(requiredStringGroup, "")) + localVarQueryParams.Add("required_int64_group", parameterToString(requiredInt64Group, "")) + if localVarOptionals != nil && localVarOptionals.StringGroup.IsSet() { + localVarQueryParams.Add("string_group", parameterToString(localVarOptionals.StringGroup.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64Group.IsSet() { + localVarQueryParams.Add("int64_group", parameterToString(localVarOptionals.Int64Group.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + localVarHeaderParams["required_boolean_group"] = parameterToString(requiredBooleanGroup, "") + if localVarOptionals != nil && localVarOptionals.BooleanGroup.IsSet() { + localVarHeaderParams["boolean_group"] = parameterToString(localVarOptionals.BooleanGroup.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + /* FakeApiService test inline additionalProperties * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param requestBody request body + * @param param request body */ -func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody map[string]string) (*http.Response, error) { +func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, param map[string]string) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -945,7 +1041,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, req localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &requestBody + localVarPostBody = ¶m r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go index bf433a4a729..91fc17598ad 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go @@ -29,10 +29,10 @@ type FakeClassnameTags123ApiService service FakeClassnameTags123ApiService To test class name in snake case To test class name in snake case * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param client client model + * @param body client model @return Client */ -func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) { +func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} @@ -67,7 +67,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &client + localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { @@ -97,14 +97,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -123,5 +115,14 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore-withXml/api_pet.go b/samples/client/petstore/go/go-petstore-withXml/api_pet.go index f776e219e29..b39971e84fa 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_pet.go @@ -31,9 +31,9 @@ type PetApiService service /* PetApiService Add a new pet to the store * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pet Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store */ -func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) { +func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -67,7 +67,7 @@ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, er localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &pet + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err @@ -229,14 +229,6 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -255,6 +247,15 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -316,14 +317,6 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -342,6 +335,15 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -416,14 +418,6 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -442,15 +436,24 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } /* PetApiService Update an existing pet * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pet Pet object that needs to be added to the store + * @param body Pet object that needs to be added to the store */ -func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) { +func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} @@ -484,7 +487,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &pet + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err @@ -677,14 +680,6 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -703,6 +698,15 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -782,14 +786,6 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -808,5 +804,14 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore-withXml/api_store.go b/samples/client/petstore/go/go-petstore-withXml/api_store.go index b33c501957d..fe181797a81 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_store.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_store.go @@ -162,14 +162,6 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -188,6 +180,15 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -255,14 +256,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -281,16 +274,25 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } /* StoreApiService Place an order for a pet * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param order order placed for purchasing the pet + * @param body order placed for purchasing the pet @return Order */ -func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) { +func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -325,7 +327,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &order + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err @@ -342,14 +344,6 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -368,5 +362,14 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } diff --git a/samples/client/petstore/go/go-petstore-withXml/api_user.go b/samples/client/petstore/go/go-petstore-withXml/api_user.go index 1c98e701509..29be65f0856 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_user.go @@ -30,9 +30,9 @@ type UserApiService service UserApiService Create user This can only be done by the logged in user. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param user Created user object + * @param body Created user object */ -func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) { +func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -66,7 +66,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &user + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err @@ -97,9 +97,9 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo /* UserApiService Creates list of users with given input array * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param user List of user object + * @param body List of user object */ -func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) { +func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -133,7 +133,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &user + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err @@ -164,9 +164,9 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U /* UserApiService Creates list of users with given input array * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param user List of user object + * @param body List of user object */ -func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) { +func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -200,7 +200,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []Us localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &user + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err @@ -352,14 +352,6 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -378,6 +370,15 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -440,14 +441,6 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor return localVarReturnValue, localVarHttpResponse, err } - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, @@ -466,6 +459,15 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor return localVarReturnValue, localVarHttpResponse, newErr } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, nil } @@ -538,9 +540,9 @@ UserApiService Updated user This can only be done by the logged in user. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param username name that need to be deleted - * @param user Updated user object + * @param body Updated user object */ -func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) { +func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} @@ -575,7 +577,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user U localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &user + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AnimalFarm.md b/samples/client/petstore/go/go-petstore-withXml/docs/AnimalFarm.md deleted file mode 100644 index df6bab21dae..00000000000 --- a/samples/client/petstore/go/go-petstore-withXml/docs/AnimalFarm.md +++ /dev/null @@ -1,9 +0,0 @@ -# AnimalFarm - -## 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/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md index 43c63231137..6d996803c95 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **Call123TestSpecialTags** -> Client Call123TestSpecialTags(ctx, client) +> Client Call123TestSpecialTags(ctx, body) To test special tags To test special tags and operation ID starting with number @@ -18,7 +18,7 @@ To test special tags and operation ID starting with number Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **client** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Category.md b/samples/client/petstore/go/go-petstore-withXml/docs/Category.md index a0f5c8446a5..1440215d225 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Category.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Category.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] -**Name** | **string** | | [optional] +**Name** | **string** | | [default to default-name] [[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/go/go-petstore-withXml/docs/FakeApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md index b89c1abbc1c..d474551a034 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md @@ -13,6 +13,7 @@ Method | HTTP request | Description [**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters +[**TestGroupParameters**](FakeApi.md#TestGroupParameters) | **Delete** /fake | Fake endpoint to test group parameters (optional) [**TestInlineAdditionalProperties**](FakeApi.md#TestInlineAdditionalProperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties [**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data @@ -70,7 +71,7 @@ Optional parameters are passed through a pointer to a FakeOuterCompositeSerializ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body | + **body** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body | ### Return type @@ -158,7 +159,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **TestBodyWithFileSchema** -> TestBodyWithFileSchema(ctx, fileSchemaTestClass) +> TestBodyWithFileSchema(ctx, body) For this test, the body for this request much reference a schema named `File`. @@ -168,7 +169,7 @@ For this test, the body for this request much reference a schema named `File`. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | ### Return type @@ -186,7 +187,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **TestBodyWithQueryParams** -> TestBodyWithQueryParams(ctx, query, user) +> TestBodyWithQueryParams(ctx, query, body) ### Required Parameters @@ -195,7 +196,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **query** | **string**| | - **user** | [**User**](User.md)| | + **body** | [**User**](User.md)| | ### Return type @@ -213,7 +214,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **TestClientModel** -> Client TestClientModel(ctx, client) +> Client TestClientModel(ctx, body) To test \"client\" model To test \"client\" model @@ -223,7 +224,7 @@ To test \"client\" model Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **client** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md)| client model | ### Return type @@ -334,8 +335,51 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **TestGroupParameters** +> TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional) +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **requiredStringGroup** | **int32**| Required String in group parameters | + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | + **requiredInt64Group** | **int64**| Required Integer in group parameters | + **optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a TestGroupParametersOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + **stringGroup** | **optional.Int32**| String in group parameters | + **booleanGroup** | **optional.Bool**| Boolean in group parameters | + **int64Group** | **optional.Int64**| Integer in group parameters | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestInlineAdditionalProperties** -> TestInlineAdditionalProperties(ctx, requestBody) +> TestInlineAdditionalProperties(ctx, param) test inline additionalProperties ### Required Parameters @@ -343,7 +387,7 @@ test inline additionalProperties Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **requestBody** | [**map[string]string**](string.md)| request body | + **param** | [**map[string]string**](string.md)| request body | ### Return type diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md b/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md index db334ab5689..d9311e369db 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **TestClassname** -> Client TestClassname(ctx, client) +> Client TestClassname(ctx, body) To test class name in snake case To test class name in snake case @@ -18,7 +18,7 @@ To test class name in snake case Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **client** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md index 481ce5e80e5..e1fffc03512 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **AddPet** -> AddPet(ctx, pet) +> AddPet(ctx, body) Add a new pet to the store ### Required Parameters @@ -24,7 +24,7 @@ Add a new pet to the store Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -161,7 +161,7 @@ Name | Type | Description | Notes [[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) # **UpdatePet** -> UpdatePet(ctx, pet) +> UpdatePet(ctx, body) Update an existing pet ### Required Parameters @@ -169,7 +169,7 @@ Update an existing pet Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md index e424e2d966f..88d762e0302 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md @@ -91,7 +91,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **PlaceOrder** -> Order PlaceOrder(ctx, order) +> Order PlaceOrder(ctx, body) Place an order for a pet ### Required Parameters @@ -99,7 +99,7 @@ Place an order for a pet Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **order** | [**Order**](Order.md)| order placed for purchasing the pet | + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/StringBooleanMap.md b/samples/client/petstore/go/go-petstore-withXml/docs/StringBooleanMap.md deleted file mode 100644 index 7abf11ec68b..00000000000 --- a/samples/client/petstore/go/go-petstore-withXml/docs/StringBooleanMap.md +++ /dev/null @@ -1,9 +0,0 @@ -# StringBooleanMap - -## 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/client/petstore/go/go-petstore-withXml/docs/UserApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md index 82210d18310..e57a67b7547 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md @@ -15,7 +15,7 @@ Method | HTTP request | Description # **CreateUser** -> CreateUser(ctx, user) +> CreateUser(ctx, body) Create user This can only be done by the logged in user. @@ -25,7 +25,7 @@ This can only be done by the logged in user. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **user** | [**User**](User.md)| Created user object | + **body** | [**User**](User.md)| Created user object | ### Return type @@ -43,7 +43,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **CreateUsersWithArrayInput** -> CreateUsersWithArrayInput(ctx, user) +> CreateUsersWithArrayInput(ctx, body) Creates list of users with given input array ### Required Parameters @@ -51,7 +51,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **user** | [**[]User**](array.md)| List of user object | + **body** | [**[]User**](array.md)| List of user object | ### Return type @@ -69,7 +69,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **CreateUsersWithListInput** -> CreateUsersWithListInput(ctx, user) +> CreateUsersWithListInput(ctx, body) Creates list of users with given input array ### Required Parameters @@ -77,7 +77,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **user** | [**[]User**](array.md)| List of user object | + **body** | [**[]User**](array.md)| List of user object | ### Return type @@ -198,7 +198,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **UpdateUser** -> UpdateUser(ctx, username, user) +> UpdateUser(ctx, username, body) Updated user This can only be done by the logged in user. @@ -209,7 +209,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **username** | **string**| name that need to be deleted | - **user** | [**User**](User.md)| Updated user object | + **body** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/go/go-petstore-withXml/model_animal_farm.go b/samples/client/petstore/go/go-petstore-withXml/model_animal_farm.go deleted file mode 100644 index a6631942e3e..00000000000 --- a/samples/client/petstore/go/go-petstore-withXml/model_animal_farm.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * 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 - -type AnimalFarm struct { -} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_category.go b/samples/client/petstore/go/go-petstore-withXml/model_category.go index 2da34c43a24..134f5e8534c 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_category.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_category.go @@ -12,5 +12,5 @@ package petstore type Category struct { Id int64 `json:"id,omitempty" xml:"id"` - Name string `json:"name,omitempty" xml:"name"` + Name string `json:"name" xml:"name"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_string_boolean_map.go b/samples/client/petstore/go/go-petstore-withXml/model_string_boolean_map.go deleted file mode 100644 index 35c10ad518f..00000000000 --- a/samples/client/petstore/go/go-petstore-withXml/model_string_boolean_map.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * 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 - -type StringBooleanMap struct { -} diff --git a/samples/server/petstore/go-api-server/.openapi-generator/VERSION b/samples/server/petstore/go-api-server/.openapi-generator/VERSION index 6d94c9c2e12..afa63656064 100644 --- a/samples/server/petstore/go-api-server/.openapi-generator/VERSION +++ b/samples/server/petstore/go-api-server/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/go-api-server/api/openapi.yaml b/samples/server/petstore/go-api-server/api/openapi.yaml index c0b60f85dde..ac82672eb88 100644 --- a/samples/server/petstore/go-api-server/api/openapi.yaml +++ b/samples/server/petstore/go-api-server/api/openapi.yaml @@ -40,6 +40,7 @@ paths: summary: Add a new pet to the store tags: - pet + x-codegen-request-body-name: body put: operationId: updatePet requestBody: @@ -69,6 +70,7 @@ paths: summary: Update an existing pet tags: - pet + x-codegen-request-body-name: body /pet/findByStatus: get: description: Multiple status values can be provided with comma separated strings @@ -325,6 +327,7 @@ paths: summary: Place an order for a pet tags: - store + x-codegen-request-body-name: body /store/order/{orderId}: delete: description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -396,6 +399,7 @@ paths: summary: Create user tags: - user + x-codegen-request-body-name: body /user/createWithArray: post: operationId: createUsersWithArrayInput @@ -415,6 +419,7 @@ paths: summary: Creates list of users with given input array tags: - user + x-codegen-request-body-name: body /user/createWithList: post: operationId: createUsersWithListInput @@ -434,6 +439,7 @@ paths: summary: Creates list of users with given input array tags: - user + x-codegen-request-body-name: body /user/login: get: operationId: loginUser @@ -563,6 +569,7 @@ paths: summary: Updated user tags: - user + x-codegen-request-body-name: body components: schemas: Order: diff --git a/samples/server/petstore/go-api-server/go/model_api_response.go b/samples/server/petstore/go-api-server/go/model_api_response.go index d2cbaed56b4..2379e169080 100644 --- a/samples/server/petstore/go-api-server/go/model_api_response.go +++ b/samples/server/petstore/go-api-server/go/model_api_response.go @@ -11,6 +11,7 @@ package petstoreserver // ApiResponse - Describes the result of uploading an image resource type ApiResponse struct { + Code int32 `json:"code,omitempty"` Type string `json:"type,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_category.go b/samples/server/petstore/go-api-server/go/model_category.go index 4f7ca371b42..5e6f9d247fa 100644 --- a/samples/server/petstore/go-api-server/go/model_category.go +++ b/samples/server/petstore/go-api-server/go/model_category.go @@ -11,6 +11,7 @@ package petstoreserver // Category - A category for a pet type Category struct { + Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_order.go b/samples/server/petstore/go-api-server/go/model_order.go index 45c20b64543..a9d8dbb7957 100644 --- a/samples/server/petstore/go-api-server/go/model_order.go +++ b/samples/server/petstore/go-api-server/go/model_order.go @@ -15,6 +15,7 @@ import ( // Order - An order for a pets from the pet store type Order struct { + Id int64 `json:"id,omitempty"` PetId int64 `json:"petId,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_pet.go b/samples/server/petstore/go-api-server/go/model_pet.go index a085e97ab58..fb206487ab0 100644 --- a/samples/server/petstore/go-api-server/go/model_pet.go +++ b/samples/server/petstore/go-api-server/go/model_pet.go @@ -11,9 +11,10 @@ package petstoreserver // Pet - A pet for sale in the pet store type Pet struct { + Id int64 `json:"id,omitempty"` - Category *Category `json:"category,omitempty"` + Category Category `json:"category,omitempty"` Name string `json:"name"` diff --git a/samples/server/petstore/go-api-server/go/model_tag.go b/samples/server/petstore/go-api-server/go/model_tag.go index 1fd6437e34b..2fb07fb32c4 100644 --- a/samples/server/petstore/go-api-server/go/model_tag.go +++ b/samples/server/petstore/go-api-server/go/model_tag.go @@ -11,6 +11,7 @@ package petstoreserver // Tag - A tag for a pet type Tag struct { + Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_user.go b/samples/server/petstore/go-api-server/go/model_user.go index 304d910ec64..8f40d0ac04c 100644 --- a/samples/server/petstore/go-api-server/go/model_user.go +++ b/samples/server/petstore/go-api-server/go/model_user.go @@ -11,6 +11,7 @@ package petstoreserver // User - A User who is purchasing from the pet store type User struct { + Id int64 `json:"id,omitempty"` Username string `json:"username,omitempty"` diff --git a/samples/server/petstore/go-gin-api-server/go/model_pet.go b/samples/server/petstore/go-gin-api-server/go/model_pet.go index ff09e500be5..fb206487ab0 100644 --- a/samples/server/petstore/go-gin-api-server/go/model_pet.go +++ b/samples/server/petstore/go-gin-api-server/go/model_pet.go @@ -14,7 +14,7 @@ type Pet struct { Id int64 `json:"id,omitempty"` - Category *Category `json:"category,omitempty"` + Category Category `json:"category,omitempty"` Name string `json:"name"`