diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index ddec54229a3178cbade9f7e60723e2a545b652a7..636016441a42fc26bc402e1c137b7f4043a7c239 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -142,6 +142,8 @@ func parameterToString(obj interface{}, collectionFormat string) string { if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) } return fmt.Sprintf("%v", obj) diff --git a/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION b/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION index 096bf47efe318864bcd257dd33de7b12f82321cb..0628777500bdde84d037cbb2b618e44234116eb5 100644 --- a/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION +++ b/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore/api/openapi.yaml b/samples/client/petstore/go/go-petstore/api/openapi.yaml index 443788211b9954f57d22edc013fa504f94c786e8..bff77e0df7a1d4abafd04b32e8524bcdf9c844fd 100644 --- a/samples/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore/api/openapi.yaml @@ -1,31 +1,27 @@ openapi: 3.0.1 info: - title: OpenAPI Petstore description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \' license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore version: 1.0.0 servers: - url: http://petstore.swagger.io:80/v2 tags: -- name: pet - description: Everything about your Pets -- name: store - description: Access to Petstore orders -- name: user - description: Operations about user +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user paths: /pet: - put: - tags: - - pet - summary: Update an existing pet - operationId: updatePet + post: + operationId: addPet requestBody: - description: Pet object that needs to be added to the store content: application/json: schema: @@ -33,28 +29,22 @@ paths: application/xml: schema: $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store required: true responses: - 400: - description: Invalid ID supplied - content: {} - 404: - description: Pet not found - content: {} 405: - description: Validation exception content: {} + description: Invalid input security: - petstore_auth: - write:pets - read:pets - post: + summary: Add a new pet to the store tags: - pet - summary: Add a new pet to the store - operationId: addPet + put: + operationId: updatePet requestBody: - description: Pet object that needs to be added to the store content: application/json: schema: @@ -62,115 +52,155 @@ paths: application/xml: schema: $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store required: true responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found 405: - description: Invalid input content: {} + description: Validation exception security: - petstore_auth: - write:pets - read:pets - /pet/findByStatus: - get: + summary: Update an existing pet tags: - pet - summary: Finds Pets by status + /pet/findByStatus: + get: description: Multiple status values can be provided with comma separated strings operationId: findPetsByStatus parameters: - - name: status + - description: Status values that need to be considered for filter + explode: false in: query - description: Status values that need to be considered for filter + name: status required: true - explode: false schema: - type: array items: - type: string default: available enum: - available - pending - sold + type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: - description: Invalid status value content: {} + description: Invalid status value security: - petstore_auth: - write:pets - read:pets - /pet/findByTags: - get: + summary: Finds Pets by status tags: - pet - summary: Finds Pets by tags + /pet/findByTags: + get: + deprecated: true description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - - name: tags + - description: Tags to filter by + explode: false in: query - description: Tags to filter by + name: tags required: true - explode: false schema: - type: array items: type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: - description: Invalid tag value content: {} - deprecated: true + description: Invalid tag value security: - petstore_auth: - write:pets - read:pets + summary: Finds Pets by tags + tags: + - pet /pet/{petId}: - get: + delete: + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet tags: - pet - summary: Find pet by ID + get: description: Returns a single pet operationId: getPetById parameters: - - name: petId + - description: ID of pet to return + explode: false in: path - description: ID of pet to return + name: petId required: true schema: - type: integer format: int64 + type: integer + style: simple responses: 200: - description: successful operation content: application/xml: schema: @@ -178,143 +208,109 @@ paths: application/json: schema: $ref: '#/components/schemas/Pet' + description: successful operation 400: - description: Invalid ID supplied content: {} + description: Invalid ID supplied 404: - description: Pet not found content: {} + description: Pet not found security: - api_key: [] - post: + summary: Find pet by ID tags: - pet - summary: Updates a pet in the store with form data + post: operationId: updatePetWithForm parameters: - - name: petId + - description: ID of pet that needs to be updated + explode: false in: path - description: ID of pet that needs to be updated + name: petId required: true schema: - type: integer format: int64 + type: integer + style: simple requestBody: content: application/x-www-form-urlencoded: schema: - properties: - name: - type: string - description: Updated name of the pet - status: - type: string - description: Updated status of the pet + $ref: '#/components/schemas/body' responses: 405: - description: Invalid input content: {} + description: Invalid input security: - petstore_auth: - write:pets - read:pets - delete: + summary: Updates a pet in the store with form data tags: - pet - summary: Deletes a pet - operationId: deletePet - parameters: - - name: api_key - in: header - schema: - type: string - - name: petId - in: path - description: Pet id to delete - required: true - schema: - type: integer - format: int64 - responses: - 400: - description: Invalid pet value - content: {} - security: - - petstore_auth: - - write:pets - - read:pets /pet/{petId}/uploadImage: post: - tags: - - pet - summary: uploads an image operationId: uploadFile parameters: - - name: petId + - description: ID of pet to update + explode: false in: path - description: ID of pet to update + name: petId required: true schema: - type: integer format: int64 + type: integer + style: simple requestBody: content: multipart/form-data: schema: - properties: - additionalMetadata: - type: string - description: Additional data to pass to server - file: - type: string - description: file to upload - format: binary + $ref: '#/components/schemas/body_1' responses: 200: - description: successful operation content: application/json: schema: $ref: '#/components/schemas/ApiResponse' + description: successful operation security: - petstore_auth: - write:pets - read:pets + summary: uploads an image + tags: + - pet /store/inventory: get: - tags: - - store - summary: Returns pet inventories by status description: Returns a map of status codes to quantities operationId: getInventory responses: 200: - description: successful operation content: application/json: schema: - type: object additionalProperties: - type: integer format: int32 + type: integer + type: object + description: successful operation security: - api_key: [] - /store/order: - post: + summary: Returns pet inventories by status tags: - store - summary: Place an order for a pet + /store/order: + post: operationId: placeOrder requestBody: - description: order placed for purchasing the pet content: '*/*': schema: $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet required: true responses: 200: - description: successful operation content: application/xml: schema: @@ -322,29 +318,53 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: - description: Invalid Order content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store /store/order/{order_id}: - get: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID tags: - store - summary: Find purchase order by ID + get: description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions operationId: getOrderById parameters: - - name: order_id + - description: ID of pet that needs to be fetched + explode: false in: path - description: ID of pet that needs to be fetched + name: order_id required: true schema: + format: int64 maximum: 5 minimum: 1 type: integer - format: int64 + style: simple responses: 200: - description: successful operation content: application/xml: schema: @@ -352,157 +372,169 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: - description: Invalid ID supplied content: {} + description: Invalid ID supplied 404: - description: Order not found content: {} - delete: + description: Order not found + summary: Find purchase order by ID tags: - store - summary: Delete purchase order by ID - description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - operationId: deleteOrder - parameters: - - name: order_id - in: path - description: ID of the order that needs to be deleted - required: true - schema: - type: string - responses: - 400: - description: Invalid ID supplied - content: {} - 404: - description: Order not found - content: {} /user: post: - tags: - - user - summary: Create user description: This can only be done by the logged in user. operationId: createUser requestBody: - description: Created user object content: '*/*': schema: $ref: '#/components/schemas/User' + description: Created user object required: true responses: default: - description: successful operation content: {} - /user/createWithArray: - post: + description: successful operation + summary: Create user tags: - user - summary: Creates list of users with given input array + /user/createWithArray: + post: operationId: createUsersWithArrayInput requestBody: - description: List of user object content: '*/*': schema: - type: array items: $ref: '#/components/schemas/User' + type: array + description: List of user object required: true responses: default: - description: successful operation content: {} - /user/createWithList: - post: + description: successful operation + summary: Creates list of users with given input array tags: - user - summary: Creates list of users with given input array + /user/createWithList: + post: operationId: createUsersWithListInput requestBody: - description: List of user object content: '*/*': schema: - type: array items: $ref: '#/components/schemas/User' + type: array + description: List of user object required: true responses: default: - description: successful operation content: {} - /user/login: - get: - tags: + description: successful operation + summary: Creates list of users with given input array + tags: - user - summary: Logs user into the system + /user/login: + get: operationId: loginUser parameters: - - name: username + - description: The user name for login + explode: true in: query - description: The user name for login + name: username required: true schema: type: string - - name: password + style: form + - description: The password for login in clear text + explode: true in: query - description: The password for login in clear text + name: password required: true schema: type: string + style: form responses: 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string description: successful operation headers: X-Rate-Limit: description: calls per hour allowed by the user + explode: false schema: - type: integer format: int32 + type: integer + style: simple X-Expires-After: description: date in UTC when token expires + explode: false schema: - type: string format: date-time - content: - application/xml: - schema: - type: string - application/json: - schema: type: string + style: simple 400: - description: Invalid username/password supplied content: {} - /user/logout: - get: + description: Invalid username/password supplied + summary: Logs user into the system tags: - user - summary: Logs out current logged in user session + /user/logout: + get: operationId: logoutUser responses: default: - description: successful operation content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user /user/{username}: - get: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user tags: - user - summary: Get user by user name + get: operationId: getUserByName parameters: - - name: username + - description: The name that needs to be fetched. Use user1 for testing. + explode: false in: path - description: The name that needs to be fetched. Use user1 for testing. + name: username required: true schema: type: string + style: simple responses: 200: - description: successful operation content: application/xml: schema: @@ -510,188 +542,187 @@ paths: application/json: schema: $ref: '#/components/schemas/User' + description: successful operation 400: - description: Invalid username supplied content: {} + description: Invalid username supplied 404: - description: User not found content: {} - put: + description: User not found + summary: Get user by user name tags: - user - summary: Updated user + put: description: This can only be done by the logged in user. operationId: updateUser parameters: - - name: username + - description: name that need to be deleted + explode: false in: path - description: name that need to be deleted + name: username required: true schema: type: string + style: simple requestBody: - description: Updated user object content: '*/*': schema: $ref: '#/components/schemas/User' + description: Updated user object required: true responses: 400: - description: Invalid user supplied content: {} + description: Invalid user supplied 404: - description: User not found content: {} - delete: + description: User not found + summary: Updated user tags: - user - summary: Delete user - description: This can only be done by the logged in user. - operationId: deleteUser - parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - schema: - type: string - responses: - 400: - description: Invalid username supplied - content: {} - 404: - description: User not found - content: {} /fake_classname_test: patch: - tags: - - fake_classname_tags 123#$%^ - summary: To test class name in snake case description: To test class name in snake case operationId: testClassname requestBody: - description: client model content: application/json: schema: $ref: '#/components/schemas/Client' + description: client model required: true responses: 200: - description: successful operation content: application/json: schema: $ref: '#/components/schemas/Client' + description: successful operation security: - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ /fake: get: - tags: - - fake - summary: To test enum parameters description: To test enum parameters operationId: testEnumParameters parameters: - - name: enum_header_string_array + - description: Header parameter enum test (string array) + explode: false in: header - description: Header parameter enum test (string array) + name: enum_header_string_array + required: false schema: - type: array items: - type: string default: $ enum: - '>' - $ - - name: enum_header_string + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false in: header - description: Header parameter enum test (string) + name: enum_header_string + required: false schema: - type: string default: -efg enum: - _abc - -efg - (xyz) - - name: enum_query_string_array - in: query - description: Query parameter enum test (string array) + type: string + style: simple + - description: Query parameter enum test (string array) explode: false + in: query + name: enum_query_string_array + required: false schema: - type: array items: - type: string default: $ enum: - '>' - $ - - name: enum_query_string + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true in: query - description: Query parameter enum test (string) + name: enum_query_string + required: false schema: - type: string default: -efg enum: - _abc - -efg - (xyz) - - name: enum_query_integer + type: string + style: form + - description: Query parameter enum test (double) + explode: true in: query - description: Query parameter enum test (double) + name: enum_query_integer + required: false schema: - type: integer - format: int32 enum: - 1 - -2 - - name: enum_query_double + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true in: query - description: Query parameter enum test (double) + name: enum_query_double + required: false schema: - type: number - format: double enum: - 1.1 - -1.2 + format: double + type: number + style: form requestBody: content: application/x-www-form-urlencoded: schema: - properties: - enum_form_string_array: - type: array - description: Form parameter enum test (string array) - items: - type: string - default: $ - enum: - - '>' - - $ - enum_form_string: - type: string - description: Form parameter enum test (string) - default: -efg - enum: - - _abc - - -efg - - (xyz) + $ref: '#/components/schemas/body_2' responses: 400: - description: Invalid request content: {} + description: Invalid request 404: - description: Not found content: {} - post: + description: Not found + summary: To test enum parameters tags: - fake - summary: | - Fake endpoint for testing various parameters - å‡ç«¯é»ž - å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ - 가짜 엔드 í¬ì¸íЏ + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + post: description: | Fake endpoint for testing various parameters å‡ç«¯é»ž @@ -702,241 +733,150 @@ paths: content: application/x-www-form-urlencoded: schema: - required: - - byte - - double - - number - - pattern_without_delimiter - properties: - integer: - maximum: 100 - minimum: 10 - type: integer - description: None - int32: - maximum: 200 - minimum: 20 - type: integer - description: None - format: int32 - int64: - type: integer - description: None - format: int64 - number: - maximum: 543.2 - minimum: 32.1 - type: number - description: None - float: - maximum: 987.6 - type: number - description: None - format: float - double: - maximum: 123.4 - minimum: 67.8 - type: number - description: None - format: double - string: - pattern: /[a-z]/i - type: string - description: None - pattern_without_delimiter: - pattern: ^[A-Z].* - type: string - description: None - byte: - type: string - description: None - format: byte - binary: - type: string - description: None - format: binary - date: - type: string - description: None - format: date - dateTime: - type: string - description: None - format: date-time - password: - maxLength: 64 - minLength: 10 - type: string - description: None - format: password - callback: - type: string - description: None + $ref: '#/components/schemas/body_3' required: true responses: 400: - description: Invalid username supplied content: {} + description: Invalid username supplied 404: - description: User not found content: {} + description: User not found security: - http_basic_test: [] - patch: + summary: | + Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ tags: - fake - summary: To test "client" model - description: To test "client" model - operationId: testClientModel - requestBody: - description: client model - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Client' /fake/outer/number: post: - tags: - - fake description: Test serialization of outer number types operationId: fakeOuterNumberSerialize requestBody: - description: Input number as post body content: '*/*': schema: $ref: '#/components/schemas/OuterNumber' + description: Input number as post body required: false responses: 200: - description: Output number content: '*/*': schema: $ref: '#/components/schemas/OuterNumber' - /fake/outer/string: - post: + description: Output number tags: - fake + /fake/outer/string: + post: description: Test serialization of outer string types operationId: fakeOuterStringSerialize requestBody: - description: Input string as post body content: '*/*': schema: $ref: '#/components/schemas/OuterString' + description: Input string as post body required: false responses: 200: - description: Output string content: '*/*': schema: $ref: '#/components/schemas/OuterString' - /fake/outer/boolean: - post: + description: Output string tags: - fake + /fake/outer/boolean: + post: description: Test serialization of outer boolean types operationId: fakeOuterBooleanSerialize requestBody: - description: Input boolean as post body content: '*/*': schema: $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body required: false responses: 200: - description: Output boolean content: '*/*': schema: $ref: '#/components/schemas/OuterBoolean' - /fake/outer/composite: - post: + description: Output boolean tags: - fake + /fake/outer/composite: + post: description: Test serialization of object with outer number type operationId: fakeOuterCompositeSerialize requestBody: - description: Input composite as post body content: '*/*': schema: $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body required: false responses: 200: - description: Output composite content: '*/*': schema: $ref: '#/components/schemas/OuterComposite' - /fake/jsonFormData: - get: + description: Output composite tags: - fake - summary: test json serialization of form data + /fake/jsonFormData: + get: operationId: testJsonFormData requestBody: content: application/x-www-form-urlencoded: schema: - required: - - param - - param2 - properties: - param: - type: string - description: field1 - param2: - type: string - description: field2 + $ref: '#/components/schemas/body_4' required: true responses: 200: - description: successful operation content: {} - /fake/inline-additionalProperties: - post: + description: successful operation + summary: test json serialization of form data tags: - fake - summary: test inline additionalProperties + /fake/inline-additionalProperties: + post: operationId: testInlineAdditionalProperties requestBody: - description: request body content: application/json: schema: - type: object additionalProperties: type: string + type: object + description: request body required: true responses: 200: - description: successful operation content: {} - /fake/body-with-query-params: - put: + description: successful operation + summary: test inline additionalProperties tags: - fake + /fake/body-with-query-params: + put: operationId: testBodyWithQueryParams parameters: - - name: query + - explode: true in: query + name: query required: true schema: type: string + style: form requestBody: content: application/json: @@ -945,50 +885,60 @@ paths: required: true responses: 200: - description: Success content: {} + description: Success + tags: + - fake /another-fake/dummy: patch: - tags: - - $another-fake? - summary: To test special tags description: To test special tags operationId: test_special_tags requestBody: - description: client model content: application/json: schema: $ref: '#/components/schemas/Client' + description: client model required: true responses: 200: - description: successful operation content: application/json: schema: $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? components: schemas: Category: - type: object + example: + name: name + id: 6 properties: id: - type: integer format: int64 + type: integer name: type: string - example: - name: name - id: 6 + type: object xml: name: Category User: - type: object + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username properties: id: - type: integer format: int64 + type: integer x-is-unique: true username: type: string @@ -1003,31 +953,22 @@ components: phone: type: string userStatus: - type: integer description: User Status format: int32 - example: - firstName: firstName - lastName: lastName - password: password - userStatus: 6 - phone: phone - id: 0 - email: email - username: username + type: integer + type: object xml: name: User OuterNumber: type: number ArrayOfNumberOnly: - type: object properties: ArrayNumber: - type: array items: type: number - Capitalization: + type: array type: object + Capitalization: properties: smallCamel: type: string @@ -1040,238 +981,240 @@ components: SCA_ETH_Flow_Points: type: string ATT_NAME: - type: string description: | Name of the pet - MixedPropertiesAndAdditionalPropertiesClass: + type: string type: object + MixedPropertiesAndAdditionalPropertiesClass: properties: uuid: - type: string format: uuid - dateTime: type: string + dateTime: format: date-time + type: string map: - type: object additionalProperties: $ref: '#/components/schemas/Animal' - ApiResponse: + type: object type: object + ApiResponse: + example: + code: 0 + type: type + message: message properties: code: - type: integer format: int32 + type: integer type: type: string message: type: string - example: - code: 0 - type: type - message: message - Name: - required: - - name type: object + Name: + description: Model for testing model name same as property name properties: name: - type: integer format: int32 - snake_case: type: integer + snake_case: format: int32 readOnly: true + type: integer property: type: string 123Number: - type: integer + format: int32 readOnly: true - description: Model for testing model name same as property name + type: integer + required: + - name + type: object xml: name: Name EnumClass: - type: string default: -efg enum: - _abc - -efg - (xyz) + type: string List: - type: object properties: 123-list: type: string - NumberOnly: type: object + NumberOnly: properties: JustNumber: type: number - 200_response: type: object + 200_response: + description: Model for testing model name starting with number properties: name: - type: integer format: int32 + type: integer class: type: string - description: Model for testing model name starting with number + type: object xml: name: Name Client: - type: object + example: + client: client properties: client: type: string - example: - client: client + type: object Dog: allOf: - $ref: '#/components/schemas/Animal' - - type: object - properties: + - properties: breed: type: string + type: object Enum_Test: - required: - - enum_string_required - type: object properties: enum_string: - type: string enum: - UPPER - lower - "" - enum_string_required: type: string + enum_string_required: enum: - UPPER - lower - "" + type: string enum_integer: - type: integer - format: int32 enum: - 1 - -1 + format: int32 + type: integer enum_number: - type: number - format: double enum: - 1.1 - -1.2 + format: double + type: number outerEnum: $ref: '#/components/schemas/OuterEnum' - Order: + 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: - type: integer format: int64 - petId: type: integer + petId: format: int64 - quantity: type: integer + quantity: format: int32 + type: integer shipDate: - type: string format: date-time - status: type: string + status: description: Order Status enum: - placed - approved - delivered + type: string complete: - type: boolean default: false - example: - petId: 6 - quantity: 1 - id: 0 - shipDate: 2000-01-23T04:56:07.000+00:00 - complete: false - status: placed + type: boolean + type: object xml: name: Order AdditionalPropertiesClass: - type: object properties: map_property: - type: object additionalProperties: type: string - map_of_map_property: type: object + map_of_map_property: additionalProperties: - type: object additionalProperties: type: string - $special[model.name]: + type: object + type: object type: object + $special[model.name]: properties: $special[property.name]: - type: integer format: int64 + type: integer + type: object xml: name: $special[model.name] Return: - type: object + description: Model for testing reserved words properties: return: - type: integer format: int32 - description: Model for testing reserved words + type: integer + type: object xml: name: Return ReadOnlyFirst: - type: object properties: bar: - type: string readOnly: true + type: string baz: type: string - ArrayOfArrayOfNumberOnly: type: object + ArrayOfArrayOfNumberOnly: properties: ArrayArrayNumber: - type: array items: - type: array items: type: number + type: array + type: array + type: object OuterEnum: - type: string enum: - placed - approved - delivered + type: string ArrayTest: - type: object properties: array_of_string: - type: array items: type: string - array_array_of_integer: type: array + array_array_of_integer: items: - type: array items: - type: integer format: int64 - array_array_of_model: + type: integer + type: array type: array + array_array_of_model: items: - type: array items: $ref: '#/components/schemas/ReadOnlyFirst' - OuterComposite: + type: array + type: array type: object + OuterComposite: + example: {} properties: my_number: $ref: '#/components/schemas/OuterNumber' @@ -1279,222 +1222,342 @@ components: $ref: '#/components/schemas/OuterString' my_boolean: $ref: '#/components/schemas/OuterBoolean' - example: {} - format_test: - required: - - byte - - date - - number - - password type: object + format_test: properties: integer: - maximum: 1E+2 - minimum: 1E+1 + format: int32 + maximum: 100.0 + minimum: 10.0 type: integer int32: - maximum: 2E+2 - minimum: 2E+1 - type: integer format: int32 - int64: + maximum: 200.0 + minimum: 20.0 type: integer + int64: format: int64 + type: integer number: maximum: 543.2 minimum: 32.1 type: number float: + format: float maximum: 987.6 minimum: 54.3 type: number - format: float double: + format: double maximum: 123.4 minimum: 67.8 type: number - format: double string: pattern: /[a-z]/i type: string byte: + format: byte pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ type: string - format: byte binary: - type: string format: binary - date: type: string + date: format: date - dateTime: type: string + dateTime: format: date-time - uuid: type: string + uuid: format: uuid + type: string password: + format: password maxLength: 64 minLength: 10 type: string - format: password - EnumArrays: + required: + - byte + - date + - number + - password type: object + EnumArrays: properties: just_symbol: - type: string enum: - '>=' - $ + type: string array_enum: - type: array items: - type: string enum: - fish - crab + type: string + type: array + type: object OuterString: type: string ClassModel: - type: object + description: Model for testing model with "_class" property properties: _class: type: string - description: Model for testing model with "_class" property + type: object OuterBoolean: type: boolean x-codegen-body-parameter-name: boolean_post_body Animal: - required: - - className - type: object + discriminator: + propertyName: className properties: className: type: string color: - type: string default: red - discriminator: - propertyName: className + type: string + required: + - className + type: object Cat: allOf: - $ref: '#/components/schemas/Animal' - - type: object - properties: + - properties: declawed: type: boolean + type: object MapTest: - type: object properties: map_map_of_string: - type: object additionalProperties: - type: object additionalProperties: type: string - map_of_enum_string: + type: object type: object + map_of_enum_string: additionalProperties: - type: string enum: - UPPER - lower - Tag: + type: string + type: object type: object + Tag: + example: + name: name + id: 1 properties: id: - type: integer format: int64 + type: integer name: type: string - example: - name: name - id: 1 + type: object xml: name: Tag AnimalFarm: - type: array items: $ref: '#/components/schemas/Animal' + type: array Pet: - required: - - name - - photoUrls - type: object + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available properties: id: - type: integer format: int64 + type: integer x-is-unique: true category: $ref: '#/components/schemas/Category' name: - type: string example: doggie + type: string photoUrls: + items: + type: string type: array xml: name: photoUrl wrapped: true - items: - type: string tags: + items: + $ref: '#/components/schemas/Tag' type: array xml: name: tag wrapped: true - items: - $ref: '#/components/schemas/Tag' status: - type: string description: pet status in the store enum: - available - pending - sold - example: - photoUrls: - - photoUrls - - photoUrls - name: doggie - id: 0 - category: - name: name - id: 6 - tags: - - name: name - id: 1 - - name: name - id: 1 - status: available + type: string + required: + - name + - photoUrls + type: object xml: name: Pet hasOnlyReadOnly: - type: object properties: bar: - type: string readOnly: true - foo: type: string + foo: readOnly: true + type: string + type: object + body: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + body_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + body_2: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + body_3: + properties: + integer: + description: None + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + body_4: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 securitySchemes: petstore_auth: - type: oauth2 flows: implicit: authorizationUrl: http://petstore.swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets + type: oauth2 http_basic_test: - type: http scheme: basic + type: http api_key: - type: apiKey - name: api_key in: header - api_key_query: + name: api_key type: apiKey - name: api_key_query + api_key_query: in: query + name: api_key_query + type: apiKey diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index c3908518e9e9a213a5be4bcc543eb40f53501141..6f436f1284d13f10b5191e3f851bb7d2419dc4e9 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -153,6 +153,8 @@ func parameterToString(obj interface{}, collectionFormat string) string { if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) } return fmt.Sprintf("%v", obj) diff --git a/samples/client/petstore/go/go-petstore/docs/ModelApiResponse.md b/samples/client/petstore/go/go-petstore/docs/ModelApiResponse.md deleted file mode 100644 index f4af21468294580c91aac3323da0614e48a2bf06..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/docs/ModelApiResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# ModelApiResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Code** | **int32** | | [optional] [default to null] -**Type_** | **string** | | [optional] [default to null] -**Message** | **string** | | [optional] [default to null] - -[[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/docs/ModelReturn.md b/samples/client/petstore/go/go-petstore/docs/ModelReturn.md deleted file mode 100644 index 86350d4310c19e8dc89b04124ed60523383420bf..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/docs/ModelReturn.md +++ /dev/null @@ -1,10 +0,0 @@ -# ModelReturn - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Return_** | **int32** | | [optional] [default to null] - -[[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/docs/OuterBoolean.md b/samples/client/petstore/go/go-petstore/docs/OuterBoolean.md deleted file mode 100644 index 8b2433994745bda537287dff67c70265ea2a13ee..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/docs/OuterBoolean.md +++ /dev/null @@ -1,9 +0,0 @@ -# OuterBoolean - -## 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/docs/OuterNumber.md b/samples/client/petstore/go/go-petstore/docs/OuterNumber.md deleted file mode 100644 index 8aa37f329bd414939d520fcb00ca78fe9e1f59df..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/docs/OuterNumber.md +++ /dev/null @@ -1,9 +0,0 @@ -# OuterNumber - -## 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/docs/OuterString.md b/samples/client/petstore/go/go-petstore/docs/OuterString.md deleted file mode 100644 index 9ccaadaf98df47ad61e32572b134deb9644132f8..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/docs/OuterString.md +++ /dev/null @@ -1,9 +0,0 @@ -# OuterString - -## 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/model_outer_boolean.go b/samples/client/petstore/go/go-petstore/model_outer_boolean.go deleted file mode 100644 index dc9ceb0c67e3358846177f880a1603f80dd1ad72..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/model_outer_boolean.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Swagger 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 - * Contact: apiteam@swagger.io - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ - -package petstore - -type OuterBoolean struct { -} diff --git a/samples/client/petstore/go/go-petstore/model_outer_number.go b/samples/client/petstore/go/go-petstore/model_outer_number.go deleted file mode 100644 index 75aad986c34f4dace837cb58b8010dad1af5d8c5..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/model_outer_number.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Swagger 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 - * Contact: apiteam@swagger.io - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ - -package petstore - -type OuterNumber struct { -} diff --git a/samples/client/petstore/go/go-petstore/model_outer_string.go b/samples/client/petstore/go/go-petstore/model_outer_string.go deleted file mode 100644 index f2a440337bdd097b25125ad0ab07c92986f8784e..0000000000000000000000000000000000000000 --- a/samples/client/petstore/go/go-petstore/model_outer_string.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Swagger 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 - * Contact: apiteam@swagger.io - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ - -package petstore - -type OuterString struct { -}