diff --git a/bin/openapi3/go-gin-petstore-server.sh b/bin/openapi3/go-gin-petstore-server.sh new file mode 100755 index 0000000000000000000000000000000000000000..310cad7fe868f832bd5f9042778396172bf25335 --- /dev/null +++ b/bin/openapi3/go-gin-petstore-server.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" + +ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go-gin-server -o samples/openapi3/server/petstore/go-gin-api-server -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" + +java $JAVA_OPTS -jar $executable $ags +#!/usr/bin/env bash \ No newline at end of file diff --git a/bin/openapi3/go-petstore-server.sh b/bin/openapi3/go-petstore-server.sh index 73ee76a77180c2b77a709639384bc0075f5d6103..d14f19df0e4a9ecf62362846b306c3230f640e21 100755 --- a/bin/openapi3/go-petstore-server.sh +++ b/bin/openapi3/go-petstore-server.sh @@ -28,6 +28,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g go-server -o samples/server/petstore/go-api-server -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-server -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go-server -o samples/openapi3/server/petstore/go-api-server -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/go-petstore.sh b/bin/openapi3/go-petstore.sh new file mode 100755 index 0000000000000000000000000000000000000000..db9630485d8b18d269b3ea5e90a3ce94f5b7eb02 --- /dev/null +++ b/bin/openapi3/go-petstore.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +SPEC="modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml" +GENERATOR="go" +STUB_DIR="samples/openapi3/client/petstore/go/go-petstore" +echo "Removing files and folders under $STUB_DIR" +rm -rf $STUB_DIR + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore $@" + +java $JAVA_OPTS -jar $executable $ags 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 28ba90cffc6cfff604bfdc4657644127bb066829..38408680231c49e60d7cfdd2ad8efbc68247d3f9 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 @@ -1,10 +1,10 @@ {{>partial_header}} package {{packageName}} {{#models}}{{#imports}} -import ({{/imports}}{{#imports}} - "{{import}}"{{/imports}}{{#imports}} +{{#-first}}import ( +{{/-first}} "{{import}}"{{#-last}} ) -{{/imports}}{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}} +{{/-last}}{{/imports}}{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}} type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} // List of {{{name}}} @@ -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 28ba90cffc6cfff604bfdc4657644127bb066829..38408680231c49e60d7cfdd2ad8efbc68247d3f9 100644 --- a/modules/openapi-generator/src/main/resources/go-server/model.mustache +++ b/modules/openapi-generator/src/main/resources/go-server/model.mustache @@ -1,10 +1,10 @@ {{>partial_header}} package {{packageName}} {{#models}}{{#imports}} -import ({{/imports}}{{#imports}} - "{{import}}"{{/imports}}{{#imports}} +{{#-first}}import ( +{{/-first}} "{{import}}"{{#-last}} ) -{{/imports}}{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}} +{{/-last}}{{/imports}}{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}} type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} // List of {{{name}}} @@ -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 07e5c75851627275c3173a2562ed7581323e4d57..1a9f8d1c5aaf940af7930854c7b612d7b5dde0dd 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 8f3c785d45881da08bf5417110ede764f2d88e7f..7889467690ec5aadcba89126c6c1213cc295b8e8 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/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml index 39668ac2732a404bba6fe719509b8c1a7badcf35..a9ac30bbad6acde18c45d54eb22450593a082900 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1027,6 +1027,18 @@ paths: format: binary required: - requiredFile + /fake/health: + get: + tags: + - fake + summary: Health check endpoint + responses: + 200: + description: The instance started successfully + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' servers: - url: 'http://{server}.swagger.io:{port}/v2' description: petstore server @@ -1605,3 +1617,10 @@ components: format: int64 xml: name: '$special[model.name]' + HealthCheckResult: + type: object + properties: + NullableMessage: + nullable: true + type: string + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. 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 f4cb97d56ce227fa8ff6289208572da61e6f140f..afa6365606414bf56f925745712166af5b4a2be0 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 610174ac2a85a82cfd40ec1ed3bd4600c7602f17..4bca622853b54579ae33c18e12d90d0973f3ba8e 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 4009731809ff1a33f4be0b11b6c4916f6c0fe62e..671c549a19a592109849b9af06ed05c1f114fd6d 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: - properties: - ArrayNumber: - items: - type: number - type: array - type: object - Capitalization: + Tag: + example: + name: name + id: 1 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 + id: + format: int64 + type: integer + name: type: string type: object - MixedPropertiesAndAdditionalPropertiesClass: + 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: - uuid: - format: uuid + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie type: string - dateTime: - format: date-time + photoUrls: + items: + 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 - map: - additionalProperties: - $ref: '#/components/schemas/Animal' - type: object + required: + - name + - photoUrls 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,163 +1320,34 @@ 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 + - className type: object - Order: - example: - petId: 6 - quantity: 1 - id: 0 - shipDate: 2000-01-23T04:56:07.000+00:00 - complete: false - status: placed + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: 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 - type: object - format_test: - properties: - integer: - maximum: 1E+2 - minimum: 1E+1 + integer: + maximum: 1E+2 + minimum: 1E+1 type: integer int32: format: int32 @@ -1403,70 +1401,116 @@ components: - number - password type: object - EnumArrays: + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: properties: - just_symbol: + enum_string: enum: - - '>=' - - $ + - UPPER + - lower + - "" type: string - array_enum: - items: - enum: - - fish - - crab + 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: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: type: string - type: array + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object type: object - OuterString: - type: string - ClassModel: - description: Model for testing model with "_class" property + MixedPropertiesAndAdditionalPropertiesClass: properties: - _class: + uuid: + format: uuid + type: string + dateTime: + format: date-time type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object type: object - OuterBoolean: - type: boolean - x-codegen-body-parameter-name: boolean_post_body - FileSchemaTestClass: + List: + properties: + 123-list: + type: string + type: object + Client: example: - file: - sourceURI: sourceURI - files: - - sourceURI: sourceURI - - sourceURI: sourceURI + client: client properties: - file: - $ref: '#/components/schemas/File' - files: - items: - $ref: '#/components/schemas/File' - type: array + client: + type: string type: object - Animal: - discriminator: - propertyName: className + ReadOnlyFirst: properties: - className: + bar: + readOnly: true type: string - color: - default: red + baz: type: string - required: - - className type: object - StringBooleanMap: - additionalProperties: - type: boolean + 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: + 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 + 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: - name: name - id: 1 + my_string: my_string + my_number: 0.80082819046101150206595775671303272247314453125 + my_boolean: true properties: - id: - format: int64 - type: integer - name: + 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 - type: integer - x-is-unique: true - category: - $ref: '#/components/schemas/Category' - name: - example: doggie + string_item: + default: what type: string - photoUrls: - items: - type: string - type: array - xml: - name: photoUrl - wrapped: true - tags: + number_item: + type: number + integer_item: + type: integer + bool_item: + default: true + type: boolean + array_item: items: - $ref: '#/components/schemas/Tag' + type: integer 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 2367690cc0ec94c81b98a2bb8b307b2aa2a70ff6..7396effd64141268627efeffdc0e8aad69c9a5e0 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 46fd09eecf32f5e753aaf01d6b2bea8eb835c897..9d4f189f9551978c489581cc5228e66f9eed0332 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 bf433a4a7295dc793767ebc753a1c0c234c951e3..91fc17598ad1486840227af3bd1a9d97366b161c 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 f776e219e290b5ce1efc8bf997f3e2683454b87f..b39971e84fa913ac85190c8beee60a20be518267 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 b33c501957d0ad7e802a04714017dce041bd42e9..fe181797a8126fcbfffd3c1f47d9b08b1d1a6295 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 1c98e701509e5599ae92eb0f5c206957a1c89d2c..29be65f0856d19c552903f0be957185945a0a880 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/AnotherFakeApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md index 43c6323113721f498bb201a35004fc285a0add41..6d996803c9585003de36de9996c3235c1ffcd7b3 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 a0f5c8446a56b96e8ffa67e7de78c513963e9781..1440215d2250cae36bc6170152b56802c0e36258 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 b89c1abbc1cba071dc8606156d24031b20248f43..d474551a034e6ce7e040d5ee3452d061e4972255 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 db334ab5689b9d55f5ca40edcd8ae2280240c30f..d9311e369dbb388991cb91359cedc58f066eeacf 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 481ce5e80e5999da2993c83f2768de5d621f68dd..e1fffc03512eb36db85073e9971247ddab014645 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 e424e2d966fc9f74068004a2bf089e94bfb7fe0c..88d762e03025cc03bc08bb93f786e70684113b4d 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/UserApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md index 82210d18310e92307ee08d521357fcd4231ee4ba..e57a67b75471975079d1f435cb1818e4e260d037 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_category.go b/samples/client/petstore/go/go-petstore-withXml/model_category.go index 2da34c43a248a1ef8787cc8efe0c22159c4a58a9..134f5e8534cfc7ab47386a9305f22bd4bb509f50 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/openapi3/client/petstore/go/go-petstore/.gitignore b/samples/openapi3/client/petstore/go/go-petstore/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..daf913b1b347aae6de6f48d599bc89ef8c8693d6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator-ignore b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator-ignore new file mode 100644 index 0000000000000000000000000000000000000000..7484ee590a3894506cf063799b885428f95a71be --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/VERSION b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..afa6365606414bf56f925745712166af5b4a2be0 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/go/go-petstore/.travis.yml b/samples/openapi3/client/petstore/go/go-petstore/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..f5cb2ce9a5aad73c57eed886e845d2e79c2899d1 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md new file mode 100644 index 0000000000000000000000000000000000000000..17133992d8db79479eb253dce53d93a9802d7fee --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -0,0 +1,182 @@ +# Go API client for 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: \" \\ + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: +``` +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +go get github.com/antihax/optional +``` + +Put the package under your project folder and add the following in import: +```golang +import "./petstore" +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **Patch** /another-fake/dummy | To test special tags +*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **Get** /foo | +*FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **Get** /fake/health | Health check endpoint +*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **Post** /fake/outer/boolean | +*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite | +*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number | +*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string | +*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **Put** /fake/body-with-file-schema | +*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params | +*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model +*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters +*FakeApi* | [**TestGroupParameters**](docs/FakeApi.md#testgroupparameters) | **Delete** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**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 +*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **Post** /pet | Add a new pet to the store +*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet +*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **Get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **Get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **Get** /pet/{petId} | Find pet by ID +*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet +*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **Post** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **Delete** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **Get** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **Post** /store/order | Place an order for a pet +*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **Post** /user | Create user +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **Post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **Post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **Get** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **Get** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **Get** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Put** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Animal](docs/Animal.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Dog](docs/Dog.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [InlineObject](docs/InlineObject.md) + - [InlineObject1](docs/InlineObject1.md) + - [InlineObject2](docs/InlineObject2.md) + - [InlineObject3](docs/InlineObject3.md) + - [InlineObject4](docs/InlineObject4.md) + - [InlineObject5](docs/InlineObject5.md) + - [InlineResponseDefault](docs/InlineResponseDefault.md) + - [List](docs/List.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Return](docs/Return.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation For Authorization + +## api_key +- **Type**: API key + +Example +```golang +auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. +}) +r, err := client.Service.Operation(auth, args) +``` +## api_key_query +- **Type**: API key + +Example +```golang +auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. +}) +r, err := client.Service.Operation(auth, args) +``` +## http_basic_test +- **Type**: HTTP basic authentication + +Example +```golang +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` +## petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +Example +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. +```golang +import "golang.org/x/oauth2" + +/* Perform OAuth2 round trip request and obtain a token */ + +tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +r, err := client.Service.Operation(auth, args) +``` + +## Author + + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f8900b2f3ed9d5def778affcd768e62b97f53220 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -0,0 +1,1905 @@ +openapi: 3.0.0 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: http://{server}.swagger.io:{port}/v2 + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: https://localhost:8080/{version} + variables: + version: + default: v2 + enum: + - v1 + - v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_default' + description: response + /pet: + post: + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 400: + description: Invalid ID supplied + 404: + description: Pet not found + 405: + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + 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: + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + 400: + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + description: Invalid user supplied + 404: + description: User not found + summary: Updated user + tags: + - user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + format: int32 + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + format: int32 + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + 400: + description: Someting wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + $ref: '#/components/requestBodies/inline_object_2' + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + responses: + 400: + description: Invalid request + 404: + description: Not found + summary: To test enum parameters + tags: + - fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + post: + description: | + Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ + operationId: testEndpointParameters + requestBody: + $ref: '#/components/requestBodies/inline_object_3' + content: + application/x-www-form-urlencoded: + schema: + 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 + type: object + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ + tags: + - fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + $ref: '#/components/requestBodies/inline_object_4' + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + responses: + 200: + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + 200: + description: successful operation + summary: test inline additionalProperties + tags: + - fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + 200: + description: Success + tags: + - fake + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + /fake/body-with-file-schema: + put: + description: For this test, the body for this request much reference a schema named `File`. + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + 200: + description: Success + tags: + - fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_5' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake/health: + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + inline_object_2: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_2' + inline_object_3: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_3' + inline_object_4: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_4' + inline_object_5: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_5' + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + 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 + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + format: int32 + readOnly: true + type: integer + required: + - name + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: + properties: + integer: + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: ^\d{10}$ + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + pattern: /^image_\d{1,3}$/i + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + 123-list: + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + 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 + 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 + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: $special[model.name] + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + inline_response_default: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + inline_object_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 + type: object + inline_object_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 + type: object + inline_object_4: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + inline_object_5: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go new file mode 100644 index 0000000000000000000000000000000000000000..f74f5bffd55489a34c56e3a4c21bb81b8769de3e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +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 +@return Client +*/ +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/another-fake/dummy" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &client + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v Client + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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/openapi3/client/petstore/go/go-petstore/api_default.go b/samples/openapi3/client/petstore/go/go-petstore/api_default.go new file mode 100644 index 0000000000000000000000000000000000000000..78cb5d9ae6e83cf1d238598bcf888bcbb8ca2907 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api_default.go @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type DefaultApiService service + +/* +DefaultApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponseDefault +*/ +func (a *DefaultApiService) FooGet(ctx context.Context) (InlineResponseDefault, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponseDefault + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/foo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 0 { + var v InlineResponseDefault + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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/openapi3/client/petstore/go/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go new file mode 100644 index 0000000000000000000000000000000000000000..94003cdd5aad26da3f19a92b1dc303ed79555581 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go @@ -0,0 +1,1222 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "github.com/antihax/optional" + "os" +) + +// Linger please +var ( + _ context.Context +) + +type FakeApiService service + +/* +FakeApiService Health check endpoint + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return HealthCheckResult +*/ +func (a *FakeApiService) FakeHealthGet(ctx context.Context) (HealthCheckResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue HealthCheckResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/health" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v HealthCheckResult + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +FakeApiService +Test serialization of outer boolean types + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: + * @param "Body" (optional.Bool) - Input boolean as post body +@return bool +*/ + +type FakeOuterBooleanSerializeOpts struct { + Body optional.Bool +} + +func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue bool + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/outer/boolean" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"*/*"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + localVarPostBody = localVarOptionals.Body.Value() + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v bool + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +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 +@return OuterComposite +*/ + +type FakeOuterCompositeSerializeOpts struct { + OuterComposite optional.Interface +} + +func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue OuterComposite + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/outer/composite" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"*/*"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.OuterComposite.IsSet() { + localVarOptionalOuterComposite, localVarOptionalOuterCompositeok := localVarOptionals.OuterComposite.Value().(OuterComposite) + if !localVarOptionalOuterCompositeok { + return localVarReturnValue, nil, reportError("outerComposite should be OuterComposite") + } + localVarPostBody = &localVarOptionalOuterComposite + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v OuterComposite + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +FakeApiService +Test serialization of outer number types + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters: + * @param "Body" (optional.Float32) - Input number as post body +@return float32 +*/ + +type FakeOuterNumberSerializeOpts struct { + Body optional.Float32 +} + +func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue float32 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/outer/number" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"*/*"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + localVarPostBody = localVarOptionals.Body.Value() + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v float32 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +FakeApiService +Test serialization of outer string types + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters: + * @param "Body" (optional.String) - Input string as post body +@return string +*/ + +type FakeOuterStringSerializeOpts struct { + Body optional.String +} + +func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/outer/string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"*/*"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + localVarPostBody = localVarOptionals.Body.Value() + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +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 +*/ +func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &fileSchemaTestClass + 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 + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param query + * @param user +*/ +func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/body-with-query-params" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("query", parameterToString(query, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &user + 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 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 +@return Client +*/ +func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &client + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v Client + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +FakeApiService Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param number None + * @param double None + * @param patternWithoutDelimiter None + * @param byte_ None + * @param optional nil or *TestEndpointParametersOpts - Optional Parameters: + * @param "Integer" (optional.Int32) - None + * @param "Int32_" (optional.Int32) - None + * @param "Int64_" (optional.Int64) - None + * @param "Float" (optional.Float32) - None + * @param "String_" (optional.String) - None + * @param "Binary" (optional.Interface of *os.File) - None + * @param "Date" (optional.String) - None + * @param "DateTime" (optional.Time) - None + * @param "Password" (optional.String) - None + * @param "Callback" (optional.String) - None +*/ + +type TestEndpointParametersOpts struct { + Integer optional.Int32 + Int32_ optional.Int32 + Int64_ optional.Int64 + Float optional.Float32 + String_ optional.String + Binary optional.Interface + Date optional.String + DateTime optional.Time + Password optional.String + Callback optional.String +} + +func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + 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{} + if number < 32.1 { + return nil, reportError("number must be greater than 32.1") + } + if number > 543.2 { + return nil, reportError("number must be less than 543.2") + } + if double < 67.8 { + return nil, reportError("double must be greater than 67.8") + } + if double > 123.4 { + return nil, reportError("double must be less than 123.4") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"} + + // 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 + } + if localVarOptionals != nil && localVarOptionals.Integer.IsSet() { + localVarFormParams.Add("integer", parameterToString(localVarOptionals.Integer.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32_.IsSet() { + localVarFormParams.Add("int32", parameterToString(localVarOptionals.Int32_.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64_.IsSet() { + localVarFormParams.Add("int64", parameterToString(localVarOptionals.Int64_.Value(), "")) + } + localVarFormParams.Add("number", parameterToString(number, "")) + if localVarOptionals != nil && localVarOptionals.Float.IsSet() { + localVarFormParams.Add("float", parameterToString(localVarOptionals.Float.Value(), "")) + } + localVarFormParams.Add("double", parameterToString(double, "")) + if localVarOptionals != nil && localVarOptionals.String_.IsSet() { + localVarFormParams.Add("string", parameterToString(localVarOptionals.String_.Value(), "")) + } + localVarFormParams.Add("pattern_without_delimiter", parameterToString(patternWithoutDelimiter, "")) + localVarFormParams.Add("byte", parameterToString(byte_, "")) + localVarFormFileName = "binary" + var localVarFile *os.File + if localVarOptionals != nil && localVarOptionals.Binary.IsSet() { + localVarFileOk := false + localVarFile, localVarFileOk = localVarOptionals.Binary.Value().(*os.File) + if !localVarFileOk { + return nil, reportError("binary should be *os.File") + } + } + if localVarFile != nil { + fbs, _ := ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + if localVarOptionals != nil && localVarOptionals.Date.IsSet() { + localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() { + localVarFormParams.Add("dateTime", parameterToString(localVarOptionals.DateTime.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Password.IsSet() { + localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Callback.IsSet() { + localVarFormParams.Add("callback", parameterToString(localVarOptionals.Callback.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 To test enum parameters +To test enum parameters + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *TestEnumParametersOpts - Optional Parameters: + * @param "EnumHeaderStringArray" (optional.Interface of []string) - Header parameter enum test (string array) + * @param "EnumHeaderString" (optional.String) - Header parameter enum test (string) + * @param "EnumQueryStringArray" (optional.Interface of []string) - Query parameter enum test (string array) + * @param "EnumQueryString" (optional.String) - Query parameter enum test (string) + * @param "EnumQueryInteger" (optional.Int32) - Query parameter enum test (double) + * @param "EnumQueryDouble" (optional.Float64) - Query parameter enum test (double) + * @param "EnumFormStringArray" (optional.Interface of []string) - Form parameter enum test (string array) + * @param "EnumFormString" (optional.String) - Form parameter enum test (string) +*/ + +type TestEnumParametersOpts struct { + EnumHeaderStringArray optional.Interface + EnumHeaderString optional.String + EnumQueryStringArray optional.Interface + EnumQueryString optional.String + EnumQueryInteger optional.Int32 + EnumQueryDouble optional.Float64 + EnumFormStringArray optional.Interface + EnumFormString optional.String +} + +func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + 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{} + + if localVarOptionals != nil && localVarOptionals.EnumQueryStringArray.IsSet() { + localVarQueryParams.Add("enum_query_string_array", parameterToString(localVarOptionals.EnumQueryStringArray.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumQueryString.IsSet() { + localVarQueryParams.Add("enum_query_string", parameterToString(localVarOptionals.EnumQueryString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumQueryInteger.IsSet() { + localVarQueryParams.Add("enum_query_integer", parameterToString(localVarOptionals.EnumQueryInteger.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumQueryDouble.IsSet() { + localVarQueryParams.Add("enum_query_double", parameterToString(localVarOptionals.EnumQueryDouble.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"} + + // 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 + } + if localVarOptionals != nil && localVarOptionals.EnumHeaderStringArray.IsSet() { + localVarHeaderParams["enum_header_string_array"] = parameterToString(localVarOptionals.EnumHeaderStringArray.Value(), "csv") + } + if localVarOptionals != nil && localVarOptionals.EnumHeaderString.IsSet() { + localVarHeaderParams["enum_header_string"] = parameterToString(localVarOptionals.EnumHeaderString.Value(), "") + } + if localVarOptionals != nil && localVarOptionals.EnumFormStringArray.IsSet() { + localVarFormParams.Add("enum_form_string_array", parameterToString(localVarOptionals.EnumFormStringArray.Value(), "csv")) + } + if localVarOptionals != nil && localVarOptionals.EnumFormString.IsSet() { + localVarFormParams.Add("enum_form_string", parameterToString(localVarOptionals.EnumFormString.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 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 +*/ +func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody map[string]string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/inline-additionalProperties" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &requestBody + 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 json serialization of form data + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param param field1 + * @param param2 field2 +*/ +func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/jsonFormData" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"} + + // 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 + } + localVarFormParams.Add("param", parameterToString(param, "")) + localVarFormParams.Add("param2", parameterToString(param2, "")) + 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 +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go new file mode 100644 index 0000000000000000000000000000000000000000..05416e6a2fb2f487dcffc6e9f29962858a8b181c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go @@ -0,0 +1,127 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +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 +@return Client +*/ +func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Client + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake_classname_test" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &client + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarQueryParams.Add("api_key_query", key) + } + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v Client + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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/openapi3/client/petstore/go/go-petstore/api_pet.go b/samples/openapi3/client/petstore/go/go-petstore/api_pet.go new file mode 100644 index 0000000000000000000000000000000000000000..04813836bb7cf66c26cba86b4641f4f1857c7722 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api_pet.go @@ -0,0 +1,816 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" + "os" +) + +// Linger please +var ( + _ context.Context +) + +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 +*/ +func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/xml"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &pet + 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 +} + +/* +PetApiService Deletes a pet + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId Pet id to delete + * @param optional nil or *DeletePetOpts - Optional Parameters: + * @param "ApiKey" (optional.String) - +*/ + +type DeletePetOpts struct { + ApiKey optional.String +} + +func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*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 + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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 + } + if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() { + localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.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 +} + +/* +PetApiService Finds Pets by status +Multiple status values can be provided with comma separated strings + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param status Status values that need to be considered for filter +@return []Pet +*/ +func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Pet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/pet/findByStatus" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("status", parameterToString(status, "csv")) + // 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{"application/xml", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []Pet + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 Finds Pets by tags +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tags Tags to filter by +@return []Pet +*/ +func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Pet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/pet/findByTags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("tags", parameterToString(tags, "csv")) + // 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{"application/xml", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []Pet + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 Find pet by ID +Returns a single pet + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to return +@return Pet +*/ +func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Pet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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{"application/xml", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["api_key"] = key + } + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v Pet + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +*/ +func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/xml"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &pet + 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 +} + +/* +PetApiService Updates a pet in the store with form data + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet that needs to be updated + * @param optional nil or *UpdatePetWithFormOpts - Optional Parameters: + * @param "Name" (optional.String) - Updated name of the pet + * @param "Status" (optional.String) - Updated status of the pet +*/ + +type UpdatePetWithFormOpts struct { + Name optional.String + Status optional.String +} + +func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/pet/{petId}" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"} + + // 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 + } + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Status.IsSet() { + localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.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 +} + +/* +PetApiService uploads an image + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to update + * @param optional nil or *UploadFileOpts - Optional Parameters: + * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server + * @param "File" (optional.Interface of *os.File) - file to upload +@return ApiResponse +*/ + +type UploadFileOpts struct { + AdditionalMetadata optional.String + File optional.Interface +} + +func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ApiResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() { + localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), "")) + } + localVarFormFileName = "file" + var localVarFile *os.File + if localVarOptionals != nil && localVarOptionals.File.IsSet() { + localVarFileOk := false + localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File) + if !localVarFileOk { + return localVarReturnValue, nil, reportError("file should be *os.File") + } + } + if localVarFile != nil { + fbs, _ := ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 uploads an image (required) + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters: + * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server +@return ApiResponse +*/ + +type UploadFileWithRequiredFileOpts struct { + AdditionalMetadata optional.String +} + +func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ApiResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile" + localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() { + localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), "")) + } + localVarFormFileName = "requiredFile" + localVarFile := requiredFile + if localVarFile != nil { + fbs, _ := ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ApiResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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/openapi3/client/petstore/go/go-petstore/api_store.go b/samples/openapi3/client/petstore/go/go-petstore/api_store.go new file mode 100644 index 0000000000000000000000000000000000000000..bbe4d04dfceeb8748355a7e281881d1f677ecd59 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api_store.go @@ -0,0 +1,374 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type StoreApiService service + +/* +StoreApiService Delete purchase order by ID +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orderId ID of the order that needs to be deleted +*/ +func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*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 + "/store/order/{order_id}" + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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 + } + 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 +} + +/* +StoreApiService Returns pet inventories by status +Returns a map of status codes to quantities + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return map[string]int32 +*/ +func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]int32 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/store/inventory" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["api_key"] = key + } + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v map[string]int32 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 Find purchase order by ID +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orderId ID of pet that needs to be fetched +@return Order +*/ +func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Order + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}" + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if orderId < 1 { + return localVarReturnValue, nil, reportError("orderId must be greater than 1") + } + if orderId > 5 { + return localVarReturnValue, nil, reportError("orderId must be less than 5") + } + + // 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{"application/xml", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v Order + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +@return Order +*/ +func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Order + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/store/order" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/xml", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &order + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v Order + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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/openapi3/client/petstore/go/go-petstore/api_user.go b/samples/openapi3/client/petstore/go/go-petstore/api_user.go new file mode 100644 index 0000000000000000000000000000000000000000..75eb29fd09151e325e03b494101c18091bef1c8e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/api_user.go @@ -0,0 +1,605 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +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 +*/ +func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &user + 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 +} + +/* +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 +*/ +func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/createWithArray" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &user + 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 +} + +/* +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 +*/ +func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/createWithList" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &user + 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 +} + +/* +UserApiService Delete 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 The name that needs to be deleted +*/ +func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*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 + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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 + } + 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 +} + +/* +UserApiService Get user by user name + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username The name that needs to be fetched. Use user1 for testing. +@return User +*/ +func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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{"application/xml", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v User + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +UserApiService Logs user into the system + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param username The user name for login + * @param password The password for login in clear text +@return string +*/ +func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/login" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("username", parameterToString(username, "")) + localVarQueryParams.Add("password", parameterToString(password, "")) + // 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{"application/xml", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + 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 +} + +/* +UserApiService Logs out current logged in user session + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +*/ +func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/logout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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 + } + 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 +} + +/* +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 +*/ +func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &user + 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 +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go new file mode 100644 index 0000000000000000000000000000000000000000..67322368383bd7971bead4e273159c3cfbb68697 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -0,0 +1,496 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the OpenAPI Petstore API v1.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AnotherFakeApi *AnotherFakeApiService + + DefaultApi *DefaultApiService + + FakeApi *FakeApiService + + FakeClassnameTags123Api *FakeClassnameTags123ApiService + + PetApi *PetApiService + + StoreApi *StoreApiService + + UserApi *UserApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AnotherFakeApi = (*AnotherFakeApiService)(&c.common) + c.DefaultApi = (*DefaultApiService)(&c.common) + c.FakeApi = (*FakeApiService)(&c.common) + c.FakeClassnameTags123Api = (*FakeClassnameTags123ApiService)(&c.common) + c.PetApi = (*PetApiService)(&c.common) + c.StoreApi = (*StoreApiService)(&c.common) + c.UserApi = (*UserApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + 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) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFileName string, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/configuration.go b/samples/openapi3/client/petstore/go/go-petstore/configuration.go new file mode 100644 index 0000000000000000000000000000000000000000..19ccc325fa920b0e5636b7b6619004f7d6d526e6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/configuration.go @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "net/http" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + HTTPClient *http.Client +} + +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "http://petstore.swagger.io:80/v2", + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + } + return cfg +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md new file mode 100644 index 0000000000000000000000000000000000000000..0c8ba7085b3f5b9a496fc04f92c43404675fb187 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapProperty** | **map[string]string** | | [optional] +**MapOfMapProperty** | [**map[string]map[string]string**](map.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Animal.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Animal.md new file mode 100644 index 0000000000000000000000000000000000000000..d7113331a609ebf742f27fe57eb36bcad5787be8 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Animal.md @@ -0,0 +1,11 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to red] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/AnotherFakeApi.md new file mode 100644 index 0000000000000000000000000000000000000000..43c6323113721f498bb201a35004fc285a0add41 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/AnotherFakeApi.md @@ -0,0 +1,37 @@ +# \AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags + + +# **Call123TestSpecialTags** +> Client Call123TestSpecialTags(ctx, client) +To test special tags + +To test special tags and operation ID starting with number + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ApiResponse.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ApiResponse.md new file mode 100644 index 0000000000000000000000000000000000000000..f9b16338ecda4668abf02bb2770e8962e68e8cd7 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int32** | | [optional] +**Type** | **string** | | [optional] +**Message** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 0000000000000000000000000000000000000000..a53147b62703c15a94d88c8573246ba10351bbb3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | [**[][]float32**](array.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md new file mode 100644 index 0000000000000000000000000000000000000000..19031e76d207e51cd6255d9a396bb2d52f886e9f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **[]float32** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayTest.md new file mode 100644 index 0000000000000000000000000000000000000000..a46d1acf665a4ab5ff6a75a8b4d1f4c3825a2129 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayTest.md @@ -0,0 +1,12 @@ +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayOfString** | **[]string** | | [optional] +**ArrayArrayOfInteger** | [**[][]int64**](array.md) | | [optional] +**ArrayArrayOfModel** | [**[][]ReadOnlyFirst**](array.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Capitalization.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Capitalization.md new file mode 100644 index 0000000000000000000000000000000000000000..ac65ee37dba8b7ebade80312c7bc19b394f9ea66 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Capitalization.md @@ -0,0 +1,15 @@ +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SmallCamel** | **string** | | [optional] +**CapitalCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**ATT_NAME** | **string** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md new file mode 100644 index 0000000000000000000000000000000000000000..b51d5fd2b95ccd5ada5059c740778d6fdc9298eb --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md @@ -0,0 +1,12 @@ +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to red] +**Declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Category.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Category.md new file mode 100644 index 0000000000000000000000000000000000000000..1440215d2250cae36bc6170152b56802c0e36258 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [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/openapi3/client/petstore/go/go-petstore/docs/ClassModel.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ClassModel.md new file mode 100644 index 0000000000000000000000000000000000000000..8d7a72843939dc1be0469c1c0ef6acda1a5529b9 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ClassModel.md @@ -0,0 +1,10 @@ +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Client.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Client.md new file mode 100644 index 0000000000000000000000000000000000000000..fdf5fd9a69d001a8808d62850567689287b2f11f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Client.md @@ -0,0 +1,10 @@ +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Client** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md new file mode 100644 index 0000000000000000000000000000000000000000..5d1fe96684d9dff3c9a967cf65c69bbd499de889 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md @@ -0,0 +1,31 @@ +# \DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FooGet**](DefaultApi.md#FooGet) | **Get** /foo | + + +# **FooGet** +> InlineResponseDefault FooGet(ctx, ) + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](inline_response_default.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md new file mode 100644 index 0000000000000000000000000000000000000000..13c0aa28e6b10fc0d83ceb88f31d787cf92bdb26 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md @@ -0,0 +1,12 @@ +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to red] +**Breed** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumArrays.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumArrays.md new file mode 100644 index 0000000000000000000000000000000000000000..9eca8b2903255e95c8c2de0d4a6665967159bfca --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumArrays.md @@ -0,0 +1,11 @@ +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustSymbol** | **string** | | [optional] +**ArrayEnum** | **[]string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AnimalFarm.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md similarity index 95% rename from samples/client/petstore/go/go-petstore-withXml/docs/AnimalFarm.md rename to samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md index df6bab21dae850d1537f6f53297c0a3ff2a0dbeb..67f017becd0c42acd0ce07d9616590c067a0f8b7 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/AnimalFarm.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md @@ -1,4 +1,4 @@ -# AnimalFarm +# EnumClass ## Properties Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md new file mode 100644 index 0000000000000000000000000000000000000000..85eab0e1d4024a8505ddbcf06f12266b58180aa9 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md @@ -0,0 +1,14 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumString** | **string** | | [optional] +**EnumStringRequired** | **string** | | +**EnumInteger** | **int32** | | [optional] +**EnumNumber** | **float64** | | [optional] +**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md new file mode 100644 index 0000000000000000000000000000000000000000..7d05419d2f7f2d3d9a9d2030a2ebf5ab5dd87aab --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md @@ -0,0 +1,456 @@ +# \FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FakeHealthGet**](FakeApi.md#FakeHealthGet) | **Get** /fake/health | Health check endpoint +[**FakeOuterBooleanSerialize**](FakeApi.md#FakeOuterBooleanSerialize) | **Post** /fake/outer/boolean | +[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite | +[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number | +[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string | +[**TestBodyWithFileSchema**](FakeApi.md#TestBodyWithFileSchema) | **Put** /fake/body-with-file-schema | +[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params | +[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model +[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters +[**TestGroupParameters**](FakeApi.md#TestGroupParameters) | **Delete** /fake | Fake endpoint to test group parameters (optional) +[**TestInlineAdditionalProperties**](FakeApi.md#TestInlineAdditionalProperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties +[**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data + + +# **FakeHealthGet** +> HealthCheckResult FakeHealthGet(ctx, ) +Health check endpoint + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[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) + +# **FakeOuterBooleanSerialize** +> bool FakeOuterBooleanSerialize(ctx, optional) + + +Test serialization of outer boolean types + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **optional.Bool**| Input boolean as post body | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize(ctx, optional) + + +Test serialization of object with outer number type + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **FakeOuterNumberSerialize** +> float32 FakeOuterNumberSerialize(ctx, optional) + + +Test serialization of outer number types + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **optional.Float32**| Input number as post body | + +### Return type + +**float32** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **FakeOuterStringSerialize** +> string FakeOuterStringSerialize(ctx, optional) + + +Test serialization of outer string types + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **optional.String**| Input string as post body | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + + +For this test, the body for this request much reference a schema named `File`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestBodyWithQueryParams** +> TestBodyWithQueryParams(ctx, query, user) + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **query** | **string**| | + **user** | [**User**](User.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestClientModel** +> Client TestClientModel(ctx, client) +To test \"client\" model + +To test \"client\" model + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[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) + +# **TestEndpointParameters** +> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional) +Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ + +Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **number** | **float32**| None | + **double** | **float64**| None | + **patternWithoutDelimiter** | **string**| None | + **byte_** | **string**| None | + **optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + **integer** | **optional.Int32**| None | + **int32_** | **optional.Int32**| None | + **int64_** | **optional.Int64**| None | + **float** | **optional.Float32**| None | + **string_** | **optional.String**| None | + **binary** | **optional.Interface of *os.File****optional.*os.File**| None | + **date** | **optional.String**| None | + **dateTime** | **optional.Time**| None | + **password** | **optional.String**| None | + **callback** | **optional.String**| None | + +### Return type + + (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[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) + +# **TestEnumParameters** +> TestEnumParameters(ctx, optional) +To test enum parameters + +To test enum parameters + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a TestEnumParametersOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) | + **enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg] + **enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) | + **enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg] + **enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) | + **enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) | + **enumFormStringArray** | [**optional.Interface of []string**](string.md)| Form parameter enum test (string array) | [default to $] + **enumFormString** | **optional.String**| Form parameter enum test (string) | [default to -efg] + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **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) +test inline additionalProperties + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **requestBody** | [**map[string]string**](string.md)| request body | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestJsonFormData** +> TestJsonFormData(ctx, param, param2) +test json serialization of form data + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **param** | **string**| field1 | + **param2** | **string**| field2 | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md new file mode 100644 index 0000000000000000000000000000000000000000..db334ab5689b9d55f5ca40edcd8ae2280240c30f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md @@ -0,0 +1,37 @@ +# \FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case + + +# **TestClassname** +> Client TestClassname(ctx, client) +To test class name in snake case + +To test class name in snake case + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/File.md b/samples/openapi3/client/petstore/go/go-petstore/docs/File.md new file mode 100644 index 0000000000000000000000000000000000000000..e7f7d80e05debef64e66a354a1c4e25034463942 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/File.md @@ -0,0 +1,10 @@ +# File + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FileSchemaTestClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FileSchemaTestClass.md new file mode 100644 index 0000000000000000000000000000000000000000..69cbfa2c189fba5ad2173a673a8745e6b4527722 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | [**File**](File.md) | | [optional] +**Files** | [**[]File**](File.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md new file mode 100644 index 0000000000000000000000000000000000000000..4900535886f5463497f5f95c1ce07cf045e87948 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md @@ -0,0 +1,10 @@ +# Foo + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to bar] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FormatTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FormatTest.md new file mode 100644 index 0000000000000000000000000000000000000000..8801f1d5700bc2dfa81db445de8c9f98f22b26c9 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FormatTest.md @@ -0,0 +1,24 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int32** | | [optional] +**Int32** | **int32** | | [optional] +**Int64** | **int64** | | [optional] +**Number** | **float32** | | +**Float** | **float32** | | [optional] +**Double** | **float64** | | [optional] +**String** | **string** | | [optional] +**Byte** | **string** | | +**Binary** | [***os.File**](*os.File.md) | | [optional] +**Date** | **string** | | +**DateTime** | [**time.Time**](time.Time.md) | | [optional] +**Uuid** | **string** | | [optional] +**Password** | **string** | | +**PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md new file mode 100644 index 0000000000000000000000000000000000000000..c259e8b325a0f2ca91340ed95d8381b6638816e9 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] +**Foo** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/go/go-petstore/docs/HealthCheckResult.md new file mode 100644 index 0000000000000000000000000000000000000000..fa2d93d82aa4d59db3a44051213c002992b926ce --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/HealthCheckResult.md @@ -0,0 +1,10 @@ +# HealthCheckResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NullableMessage** | Pointer to **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject.md new file mode 100644 index 0000000000000000000000000000000000000000..ba0eb8201e207b07789a316cd41cd5dc287bb5bb --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject.md @@ -0,0 +1,11 @@ +# InlineObject + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | Updated name of the pet | [optional] +**Status** | **string** | Updated status of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject1.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject1.md new file mode 100644 index 0000000000000000000000000000000000000000..0330fdd8ff7a046d995e38bee93dc2dc8a7adcf5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject1.md @@ -0,0 +1,11 @@ +# InlineObject1 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**File** | [***os.File**](*os.File.md) | file to upload | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject2.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject2.md new file mode 100644 index 0000000000000000000000000000000000000000..dca7f2953e48ce3e6a5db0e2c2106ae0dbdce13e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject2.md @@ -0,0 +1,11 @@ +# InlineObject2 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumFormStringArray** | **[]string** | Form parameter enum test (string array) | [optional] +**EnumFormString** | **string** | Form parameter enum test (string) | [optional] [default to ENUM_FORM_STRING_EFG] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject3.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject3.md new file mode 100644 index 0000000000000000000000000000000000000000..398fa834485c1a327eaf1b1c274a763d2df5c932 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject3.md @@ -0,0 +1,23 @@ +# InlineObject3 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int32** | None | [optional] +**Int32** | **int32** | None | [optional] +**Int64** | **int64** | None | [optional] +**Number** | **float32** | None | +**Float** | **float32** | None | [optional] +**Double** | **float64** | None | +**String** | **string** | None | [optional] +**PatternWithoutDelimiter** | **string** | None | +**Byte** | **string** | None | +**Binary** | [***os.File**](*os.File.md) | None | [optional] +**Date** | **string** | None | [optional] +**DateTime** | [**time.Time**](time.Time.md) | None | [optional] +**Password** | **string** | None | [optional] +**Callback** | **string** | None | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject4.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject4.md new file mode 100644 index 0000000000000000000000000000000000000000..ff4b519d951f4ceba4de8e732db4bab47c722f62 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject4.md @@ -0,0 +1,11 @@ +# InlineObject4 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Param** | **string** | field1 | +**Param2** | **string** | field2 | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject5.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject5.md new file mode 100644 index 0000000000000000000000000000000000000000..c5d977bebe60a458151b0a8d9e662b599e09a0c4 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject5.md @@ -0,0 +1,11 @@ +# InlineObject5 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AdditionalMetadata** | **string** | Additional data to pass to server | [optional] +**RequiredFile** | [***os.File**](*os.File.md) | file to upload | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineResponseDefault.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineResponseDefault.md new file mode 100644 index 0000000000000000000000000000000000000000..e437c153a5f0ffd7c376a7b60a577a9a2a5f6fda --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineResponseDefault.md @@ -0,0 +1,10 @@ +# InlineResponseDefault + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/List.md b/samples/openapi3/client/petstore/go/go-petstore/docs/List.md new file mode 100644 index 0000000000000000000000000000000000000000..3255fa2786855e92f270d04929e13c5dc50b6278 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/List.md @@ -0,0 +1,10 @@ +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/MapTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/MapTest.md new file mode 100644 index 0000000000000000000000000000000000000000..49381ec4b857842d43f537f47fec5954d091795a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/MapTest.md @@ -0,0 +1,13 @@ +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional] +**MapOfEnumString** | **map[string]string** | | [optional] +**DirectMap** | **map[string]bool** | | [optional] +**IndirectMap** | **map[string]bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 0000000000000000000000000000000000000000..0e5f61f6273cb2566c3ecfa950df025b2b320beb --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **string** | | [optional] +**DateTime** | [**time.Time**](time.Time.md) | | [optional] +**Map** | [**map[string]Animal**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Model200Response.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Model200Response.md new file mode 100644 index 0000000000000000000000000000000000000000..c5abac20d8661fce2a8a29ba8424a030b4d3ecd6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Model200Response.md @@ -0,0 +1,11 @@ +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int32** | | [optional] +**Class** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Name.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Name.md new file mode 100644 index 0000000000000000000000000000000000000000..fccddf63899805dca7256d980a7fb1f50fcbe1d1 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Name.md @@ -0,0 +1,13 @@ +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int32** | | +**SnakeCase** | **int32** | | [optional] +**Property** | **string** | | [optional] +**Var123Number** | **int32** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/NumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/NumberOnly.md new file mode 100644 index 0000000000000000000000000000000000000000..4d2ea1b0413588df4c0ef217677bc280b3ccb45e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/NumberOnly.md @@ -0,0 +1,10 @@ +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **float32** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Order.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Order.md new file mode 100644 index 0000000000000000000000000000000000000000..befa9151a18ab8b63aeda95e35c92ee8d946f3a2 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**PetId** | **int64** | | [optional] +**Quantity** | **int32** | | [optional] +**ShipDate** | [**time.Time**](time.Time.md) | | [optional] +**Status** | **string** | Order Status | [optional] +**Complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterComposite.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterComposite.md new file mode 100644 index 0000000000000000000000000000000000000000..30732cf10bffd5a4e620a710481e0c29085cd9a7 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | **float32** | | [optional] +**MyString** | **string** | | [optional] +**MyBoolean** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/StringBooleanMap.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md similarity index 93% rename from samples/client/petstore/go/go-petstore-withXml/docs/StringBooleanMap.md rename to samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md index 7abf11ec68b1d3b8f1b9d7f7dd54ccf2e3831445..06d413b01680bf17ffb8f5b47c516603f5350d96 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/StringBooleanMap.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md @@ -1,4 +1,4 @@ -# StringBooleanMap +# OuterEnum ## Properties Name | Type | Description | Notes diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md new file mode 100644 index 0000000000000000000000000000000000000000..049c82eb5a03443b252acaa0b901d813712b08ea --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**PhotoUrls** | **[]string** | | +**Tags** | [**[]Tag**](Tag.md) | | [optional] +**Status** | **string** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md new file mode 100644 index 0000000000000000000000000000000000000000..481ce5e80e5999da2993c83f2768de5d621f68dd --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md @@ -0,0 +1,297 @@ +# \PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddPet**](PetApi.md#AddPet) | **Post** /pet | Add a new pet to the store +[**DeletePet**](PetApi.md#DeletePet) | **Delete** /pet/{petId} | Deletes a pet +[**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status +[**FindPetsByTags**](PetApi.md#FindPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags +[**GetPetById**](PetApi.md#GetPetById) | **Get** /pet/{petId} | Find pet by ID +[**UpdatePet**](PetApi.md#UpdatePet) | **Put** /pet | Update an existing pet +[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data +[**UploadFile**](PetApi.md#UploadFile) | **Post** /pet/{petId}/uploadImage | uploads an image +[**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **AddPet** +> AddPet(ctx, pet) +Add a new pet to the store + +### Required Parameters + +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 | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + +# **DeletePet** +> DeletePet(ctx, petId, optional) +Deletes a pet + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **petId** | **int64**| Pet id to delete | + **optional** | ***DeletePetOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DeletePetOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **apiKey** | **optional.String**| | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### 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) + +# **FindPetsByStatus** +> []Pet FindPetsByStatus(ctx, status) +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **status** | [**[]string**](string.md)| Status values that need to be considered for filter | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + +# **FindPetsByTags** +> []Pet FindPetsByTags(ctx, tags) +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **tags** | [**[]string**](string.md)| Tags to filter by | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + +# **GetPetById** +> Pet GetPetById(ctx, petId) +Find pet by ID + +Returns a single pet + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **petId** | **int64**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) +Update an existing pet + +### Required Parameters + +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 | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + +# **UpdatePetWithForm** +> UpdatePetWithForm(ctx, petId, optional) +Updates a pet in the store with form data + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **petId** | **int64**| ID of pet that needs to be updated | + **optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **name** | **optional.String**| Updated name of the pet | + **status** | **optional.String**| Updated status of the pet | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **UploadFile** +> ApiResponse UploadFile(ctx, petId, optional) +uploads an image + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **petId** | **int64**| ID of pet to update | + **optional** | ***UploadFileOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a UploadFileOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **additionalMetadata** | **optional.String**| Additional data to pass to server | + **file** | **optional.Interface of *os.File****optional.*os.File**| file to upload | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional) +uploads an image (required) + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **petId** | **int64**| ID of pet to update | + **requiredFile** | ***os.File*****os.File**| file to upload | + **optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **additionalMetadata** | **optional.String**| Additional data to pass to server | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md new file mode 100644 index 0000000000000000000000000000000000000000..b3546db3cc8f9a45c7eca2255ff86cd4edf6b01d --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] +**Baz** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Return.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Return.md new file mode 100644 index 0000000000000000000000000000000000000000..bcf50e4e5cd1c7c1dfc8ceff20f48f92d539514f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Return.md @@ -0,0 +1,10 @@ +# Return + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Return** | **int32** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/SpecialModelName.md b/samples/openapi3/client/petstore/go/go-petstore/docs/SpecialModelName.md new file mode 100644 index 0000000000000000000000000000000000000000..7b2dfb654c024fa45bff5b344329f2d43bd688fc --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/SpecialModelName.md @@ -0,0 +1,10 @@ +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SpecialPropertyName** | **int64** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md new file mode 100644 index 0000000000000000000000000000000000000000..fb9743b96d0214cf8afdc5c3f599e3cec5f9a333 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md @@ -0,0 +1,118 @@ +# \StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{order_id} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{order_id} | Find purchase order by ID +[**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet + + +# **DeleteOrder** +> DeleteOrder(ctx, orderId) +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **orderId** | **string**| ID of the order that needs to be deleted | + +### 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) + +# **GetInventory** +> map[string]int32 GetInventory(ctx, ) +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +**map[string]int32** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[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) + +# **GetOrderById** +> Order GetOrderById(ctx, orderId) +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **orderId** | **int64**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) +Place an order for a pet + +### Required Parameters + +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 | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +[[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) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md new file mode 100644 index 0000000000000000000000000000000000000000..acacb4f54a7d5d379b43f8d8a17b87692a6f111e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/User.md b/samples/openapi3/client/petstore/go/go-petstore/docs/User.md new file mode 100644 index 0000000000000000000000000000000000000000..87e1456c8a8855addfbc79372b75e5b17a3c0af7 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**Username** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Email** | **string** | | [optional] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int32** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md new file mode 100644 index 0000000000000000000000000000000000000000..3784b31187d11cf13851d9119f083e23670ee57c --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md @@ -0,0 +1,228 @@ +# \UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#CreateUser) | **Post** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#DeleteUser) | **Delete** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#GetUserByName) | **Get** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#LoginUser) | **Get** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#LogoutUser) | **Get** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user + + +# **CreateUser** +> CreateUser(ctx, user) +Create user + +This can only be done by the logged in user. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **user** | [**User**](User.md)| Created user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateUsersWithArrayInput** +> CreateUsersWithArrayInput(ctx, user) +Creates list of users with given input array + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **user** | [**[]User**](array.md)| List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateUsersWithListInput** +> CreateUsersWithListInput(ctx, user) +Creates list of users with given input array + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **user** | [**[]User**](array.md)| List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeleteUser** +> DeleteUser(ctx, username) +Delete user + +This can only be done by the logged in user. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **username** | **string**| The name that needs to be deleted | + +### 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) + +# **GetUserByName** +> User GetUserByName(ctx, username) +Get user by user name + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + +# **LoginUser** +> string LoginUser(ctx, username, password) +Logs user into the system + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + +# **LogoutUser** +> LogoutUser(ctx, ) +Logs out current logged in user session + +### Required Parameters +This endpoint does not need any parameter. + +### 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) + +# **UpdateUser** +> UpdateUser(ctx, username, user) +Updated user + +This can only be done by the logged in user. + +### Required Parameters + +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 | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/go/go-petstore/git_push.sh b/samples/openapi3/client/petstore/go/go-petstore/git_push.sh new file mode 100644 index 0000000000000000000000000000000000000000..8442b80bb4456c20d67f6442dbbeacd991a066d2 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_200_response.go b/samples/openapi3/client/petstore/go/go-petstore/model_200_response.go new file mode 100644 index 0000000000000000000000000000000000000000..f918cabaaae2177b338c739a7c321477e2c7216d --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_200_response.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +// Model for testing model name starting with number +type Model200Response struct { + Name int32 `json:"name,omitempty"` + Class string `json:"class,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model__special_model_name_.go b/samples/openapi3/client/petstore/go/go-petstore/model__special_model_name_.go new file mode 100644 index 0000000000000000000000000000000000000000..f906e91987dc21cfc27cdf7d7d6c1fb4834be104 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model__special_model_name_.go @@ -0,0 +1,14 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type SpecialModelName struct { + SpecialPropertyName int64 `json:"$special[property.name],omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_additional_properties_class.go b/samples/openapi3/client/petstore/go/go-petstore/model_additional_properties_class.go new file mode 100644 index 0000000000000000000000000000000000000000..1d06dde3d04d1d4acceb9abe4f17581ac8c73862 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_additional_properties_class.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type AdditionalPropertiesClass struct { + MapProperty map[string]string `json:"map_property,omitempty"` + MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_animal.go b/samples/openapi3/client/petstore/go/go-petstore/model_animal.go new file mode 100644 index 0000000000000000000000000000000000000000..39d0d2d1ec327a65c2a70a40dd0282c99103e655 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_animal.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type Animal struct { + ClassName string `json:"className"` + Color string `json:"color,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_api_response.go b/samples/openapi3/client/petstore/go/go-petstore/model_api_response.go new file mode 100644 index 0000000000000000000000000000000000000000..12732fa32c6b73ffc94710735cec6b0e6f0b7da3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_api_response.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type ApiResponse struct { + Code int32 `json:"code,omitempty"` + Type string `json:"type,omitempty"` + Message string `json:"message,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_array_of_array_of_number_only.go b/samples/openapi3/client/petstore/go/go-petstore/model_array_of_array_of_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..8bf700c7eb30ee6c41bfaf1ef145dd58a598464a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_array_of_array_of_number_only.go @@ -0,0 +1,14 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type ArrayOfArrayOfNumberOnly struct { + ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_array_of_number_only.go b/samples/openapi3/client/petstore/go/go-petstore/model_array_of_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..ccb473355caa55dbe61fc67081b0fdaf245a2728 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_array_of_number_only.go @@ -0,0 +1,14 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type ArrayOfNumberOnly struct { + ArrayNumber []float32 `json:"ArrayNumber,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_array_test_.go b/samples/openapi3/client/petstore/go/go-petstore/model_array_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..f8819800934b780d78c1ebb1dfd572dc449e4c01 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_array_test_.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type ArrayTest struct { + ArrayOfString []string `json:"array_of_string,omitempty"` + ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"` + ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_capitalization.go b/samples/openapi3/client/petstore/go/go-petstore/model_capitalization.go new file mode 100644 index 0000000000000000000000000000000000000000..8284ba9c7658df9d3d0a6f138393ecaed8e154a3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_capitalization.go @@ -0,0 +1,20 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type Capitalization struct { + SmallCamel string `json:"smallCamel,omitempty"` + CapitalCamel string `json:"CapitalCamel,omitempty"` + SmallSnake string `json:"small_Snake,omitempty"` + CapitalSnake string `json:"Capital_Snake,omitempty"` + SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"` + // Name of the pet + ATT_NAME string `json:"ATT_NAME,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_cat.go b/samples/openapi3/client/petstore/go/go-petstore/model_cat.go new file mode 100644 index 0000000000000000000000000000000000000000..58b3deeb938d4d3f63b1aac2570509b234b21511 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_cat.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type Cat struct { + ClassName string `json:"className"` + Color string `json:"color,omitempty"` + Declawed bool `json:"declawed,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_category.go b/samples/openapi3/client/petstore/go/go-petstore/model_category.go new file mode 100644 index 0000000000000000000000000000000000000000..2f971417ac10e15bb08dd8191f6f1d77aa698c12 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_category.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type Category struct { + Id int64 `json:"id,omitempty"` + Name string `json:"name"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_class_model.go b/samples/openapi3/client/petstore/go/go-petstore/model_class_model.go new file mode 100644 index 0000000000000000000000000000000000000000..09c7e891968aaa28a18f5b743120b46f59c8728d --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_class_model.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +// Model for testing model with \"_class\" property +type ClassModel struct { + Class string `json:"_class,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_string_boolean_map.go b/samples/openapi3/client/petstore/go/go-petstore/model_client.go similarity index 64% rename from samples/client/petstore/go/go-petstore-withXml/model_string_boolean_map.go rename to samples/openapi3/client/petstore/go/go-petstore/model_client.go index 35c10ad518fd50eda82128ffb36920c92adf30cc..3aa61112c4dad72f012a2f0450eaf643ab749c23 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_string_boolean_map.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_client.go @@ -4,11 +4,11 @@ * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - package petstore -type StringBooleanMap struct { +type Client struct { + Client string `json:"client,omitempty"` } diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_dog.go b/samples/openapi3/client/petstore/go/go-petstore/model_dog.go new file mode 100644 index 0000000000000000000000000000000000000000..3f791ca1947de35332d6ccb4c3f9b8fffc7bc02d --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_dog.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type Dog struct { + ClassName string `json:"className"` + Color string `json:"color,omitempty"` + Breed string `json:"breed,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_enum_arrays.go b/samples/openapi3/client/petstore/go/go-petstore/model_enum_arrays.go new file mode 100644 index 0000000000000000000000000000000000000000..ab4dce92ebbc46d8aa3a1b41f6885e7b6f2ac068 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_enum_arrays.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type EnumArrays struct { + JustSymbol string `json:"just_symbol,omitempty"` + ArrayEnum []string `json:"array_enum,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_enum_class.go b/samples/openapi3/client/petstore/go/go-petstore/model_enum_class.go new file mode 100644 index 0000000000000000000000000000000000000000..534ce432881734fdd09f2c66554030111adef9ec --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_enum_class.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +type EnumClass string + +// List of EnumClass +const ( + ABC EnumClass = "_abc" + EFG EnumClass = "-efg" + XYZ EnumClass = "(xyz)" +) \ No newline at end of file diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_enum_test_.go b/samples/openapi3/client/petstore/go/go-petstore/model_enum_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..f85f31501a019b9685228b6ef761896793a589b7 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_enum_test_.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type EnumTest struct { + EnumString string `json:"enum_string,omitempty"` + EnumStringRequired string `json:"enum_string_required"` + EnumInteger int32 `json:"enum_integer,omitempty"` + EnumNumber float64 `json:"enum_number,omitempty"` + OuterEnum OuterEnum `json:"outerEnum,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_file.go b/samples/openapi3/client/petstore/go/go-petstore/model_file.go new file mode 100644 index 0000000000000000000000000000000000000000..2782ccc9a2aa285cc3e7f15d274e78247e66926f --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_file.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +// Must be named `File` for test. +type File struct { + // Test capitalization + SourceURI string `json:"sourceURI,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_file_schema_test_class.go b/samples/openapi3/client/petstore/go/go-petstore/model_file_schema_test_class.go new file mode 100644 index 0000000000000000000000000000000000000000..487f766c64926d0136f5b317d28ddc738ea4b18a --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_file_schema_test_class.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type FileSchemaTestClass struct { + File File `json:"file,omitempty"` + Files []File `json:"files,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_animal_farm.go b/samples/openapi3/client/petstore/go/go-petstore/model_foo.go similarity index 66% rename from samples/client/petstore/go/go-petstore-withXml/model_animal_farm.go rename to samples/openapi3/client/petstore/go/go-petstore/model_foo.go index a6631942e3eff6ec84d2991ac09c3a095518a70c..c379a263487d77ca5191505e468ed9e3ec277300 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_animal_farm.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_foo.go @@ -4,11 +4,11 @@ * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - package petstore -type AnimalFarm struct { +type Foo struct { + Bar string `json:"bar,omitempty"` } diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_format_test_.go b/samples/openapi3/client/petstore/go/go-petstore/model_format_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..a8c778d7f54539a16931666050d758add07403d4 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_format_test_.go @@ -0,0 +1,34 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +import ( + "os" + "time" +) + +type FormatTest struct { + Integer int32 `json:"integer,omitempty"` + Int32 int32 `json:"int32,omitempty"` + Int64 int64 `json:"int64,omitempty"` + Number float32 `json:"number"` + Float float32 `json:"float,omitempty"` + Double float64 `json:"double,omitempty"` + String string `json:"string,omitempty"` + Byte string `json:"byte"` + Binary *os.File `json:"binary,omitempty"` + Date string `json:"date"` + DateTime time.Time `json:"dateTime,omitempty"` + Uuid string `json:"uuid,omitempty"` + Password string `json:"password"` + // A string that is a 10 digit number. Can have leading zeros. + PatternWithDigits string `json:"pattern_with_digits,omitempty"` + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + PatternWithDigitsAndDelimiter string `json:"pattern_with_digits_and_delimiter,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_has_only_read_only.go b/samples/openapi3/client/petstore/go/go-petstore/model_has_only_read_only.go new file mode 100644 index 0000000000000000000000000000000000000000..1cf0e4f530d4556375143482a71d9cea283f9cd9 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_has_only_read_only.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type HasOnlyReadOnly struct { + Bar string `json:"bar,omitempty"` + Foo string `json:"foo,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_health_check_result.go b/samples/openapi3/client/petstore/go/go-petstore/model_health_check_result.go new file mode 100644 index 0000000000000000000000000000000000000000..9f9947a9adcbfe853f4a54cba07cae5eba26f686 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_health_check_result.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +type HealthCheckResult struct { + NullableMessage *string `json:"NullableMessage,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_inline_object.go b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object.go new file mode 100644 index 0000000000000000000000000000000000000000..ff6bac3057eff58afae581e6c4affe6e8f5fccaa --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type InlineObject struct { + // Updated name of the pet + Name string `json:"name,omitempty"` + // Updated status of the pet + Status string `json:"status,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_1.go b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_1.go new file mode 100644 index 0000000000000000000000000000000000000000..81b7bc9db21a33cea95938e5dad37f6cd7a1809e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_1.go @@ -0,0 +1,20 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +import ( + "os" +) + +type InlineObject1 struct { + // Additional data to pass to server + AdditionalMetadata string `json:"additionalMetadata,omitempty"` + // file to upload + File *os.File `json:"file,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_2.go b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_2.go new file mode 100644 index 0000000000000000000000000000000000000000..d8aa3dae4fdc47a3c2a44f46429f90d54b355ac3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_2.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type InlineObject2 struct { + // Form parameter enum test (string array) + EnumFormStringArray []string `json:"enum_form_string_array,omitempty"` + // Form parameter enum test (string) + EnumFormString string `json:"enum_form_string,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_3.go b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_3.go new file mode 100644 index 0000000000000000000000000000000000000000..caa108f0fdbe0dbcaf2556aa66be3d4cc0f35614 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_3.go @@ -0,0 +1,45 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +import ( + "os" + "time" +) + +type InlineObject3 struct { + // None + Integer int32 `json:"integer,omitempty"` + // None + Int32 int32 `json:"int32,omitempty"` + // None + Int64 int64 `json:"int64,omitempty"` + // None + Number float32 `json:"number"` + // None + Float float32 `json:"float,omitempty"` + // None + Double float64 `json:"double"` + // None + String string `json:"string,omitempty"` + // None + PatternWithoutDelimiter string `json:"pattern_without_delimiter"` + // None + Byte string `json:"byte"` + // None + Binary *os.File `json:"binary,omitempty"` + // None + Date string `json:"date,omitempty"` + // None + DateTime time.Time `json:"dateTime,omitempty"` + // None + Password string `json:"password,omitempty"` + // None + Callback string `json:"callback,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_4.go b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_4.go new file mode 100644 index 0000000000000000000000000000000000000000..eadc31c7176b53ede217562b5d87d5ac6ee3e6a2 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_4.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type InlineObject4 struct { + // field1 + Param string `json:"param"` + // field2 + Param2 string `json:"param2"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_5.go b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_5.go new file mode 100644 index 0000000000000000000000000000000000000000..606b522bb1f0067da56815720e128ceb33b73bfd --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_inline_object_5.go @@ -0,0 +1,20 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +import ( + "os" +) + +type InlineObject5 struct { + // Additional data to pass to server + AdditionalMetadata string `json:"additionalMetadata,omitempty"` + // file to upload + RequiredFile *os.File `json:"requiredFile"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_inline_response_default.go b/samples/openapi3/client/petstore/go/go-petstore/model_inline_response_default.go new file mode 100644 index 0000000000000000000000000000000000000000..d72677acdabdd1dae8a3e26eaf7245d304f68e36 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_inline_response_default.go @@ -0,0 +1,14 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type InlineResponseDefault struct { + String Foo `json:"string,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_list.go b/samples/openapi3/client/petstore/go/go-petstore/model_list.go new file mode 100644 index 0000000000000000000000000000000000000000..12f3bd3f6600eb4ac806eb983fd0d7f17d5ff5b4 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_list.go @@ -0,0 +1,14 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type List struct { + Var123List string `json:"123-list,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_map_test_.go b/samples/openapi3/client/petstore/go/go-petstore/model_map_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..830e760fe314e7b52544396a749d3f65ff913224 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_map_test_.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type MapTest struct { + MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"` + MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"` + DirectMap map[string]bool `json:"direct_map,omitempty"` + IndirectMap map[string]bool `json:"indirect_map,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_mixed_properties_and_additional_properties_class.go b/samples/openapi3/client/petstore/go/go-petstore/model_mixed_properties_and_additional_properties_class.go new file mode 100644 index 0000000000000000000000000000000000000000..0ad92e96f8ece7b2069554568c55919635c8ace6 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_mixed_properties_and_additional_properties_class.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +import ( + "time" +) + +type MixedPropertiesAndAdditionalPropertiesClass struct { + Uuid string `json:"uuid,omitempty"` + DateTime time.Time `json:"dateTime,omitempty"` + Map map[string]Animal `json:"map,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_name.go b/samples/openapi3/client/petstore/go/go-petstore/model_name.go new file mode 100644 index 0000000000000000000000000000000000000000..dde1b92eb6ab9b3fc68382d14db2a437863d84c3 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_name.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +// Model for testing model name same as property name +type Name struct { + Name int32 `json:"name"` + SnakeCase int32 `json:"snake_case,omitempty"` + Property string `json:"property,omitempty"` + Var123Number int32 `json:"123Number,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_number_only.go b/samples/openapi3/client/petstore/go/go-petstore/model_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..7a2fd5fd8f6d19b71b9154dd01ac9bdf12a31030 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_number_only.go @@ -0,0 +1,14 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type NumberOnly struct { + JustNumber float32 `json:"JustNumber,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_order.go b/samples/openapi3/client/petstore/go/go-petstore/model_order.go new file mode 100644 index 0000000000000000000000000000000000000000..c81d67ae0fa4760f5b37b46ab766dcc68952b165 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_order.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +import ( + "time" +) + +type Order struct { + Id int64 `json:"id,omitempty"` + PetId int64 `json:"petId,omitempty"` + Quantity int32 `json:"quantity,omitempty"` + ShipDate time.Time `json:"shipDate,omitempty"` + // Order Status + Status string `json:"status,omitempty"` + Complete bool `json:"complete,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_outer_composite.go b/samples/openapi3/client/petstore/go/go-petstore/model_outer_composite.go new file mode 100644 index 0000000000000000000000000000000000000000..0ebb526267e8000abf255ed41d8beaee352748aa --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_outer_composite.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type OuterComposite struct { + MyNumber float32 `json:"my_number,omitempty"` + MyString string `json:"my_string,omitempty"` + MyBoolean bool `json:"my_boolean,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_outer_enum.go b/samples/openapi3/client/petstore/go/go-petstore/model_outer_enum.go new file mode 100644 index 0000000000000000000000000000000000000000..903d31e82690594e87959c80f519b97e0d5e2b7e --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_outer_enum.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +type OuterEnum string + +// List of OuterEnum +const ( + PLACED OuterEnum = "placed" + APPROVED OuterEnum = "approved" + DELIVERED OuterEnum = "delivered" +) \ No newline at end of file diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_pet.go b/samples/openapi3/client/petstore/go/go-petstore/model_pet.go new file mode 100644 index 0000000000000000000000000000000000000000..4930dbb92e8ed654b15f63af501e44f1d186ce29 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_pet.go @@ -0,0 +1,20 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type Pet struct { + Id int64 `json:"id,omitempty"` + Category Category `json:"category,omitempty"` + Name string `json:"name"` + PhotoUrls []string `json:"photoUrls"` + Tags []Tag `json:"tags,omitempty"` + // pet status in the store + Status string `json:"status,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_read_only_first.go b/samples/openapi3/client/petstore/go/go-petstore/model_read_only_first.go new file mode 100644 index 0000000000000000000000000000000000000000..6b22163900b034680a4bfda6adbefa5b863d7ebb --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_read_only_first.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type ReadOnlyFirst struct { + Bar string `json:"bar,omitempty"` + Baz string `json:"baz,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_return.go b/samples/openapi3/client/petstore/go/go-petstore/model_return.go new file mode 100644 index 0000000000000000000000000000000000000000..7851dd851d314c9589c78113770333fe31675974 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_return.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +// Model for testing reserved words +type Return struct { + Return int32 `json:"return,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_tag.go b/samples/openapi3/client/petstore/go/go-petstore/model_tag.go new file mode 100644 index 0000000000000000000000000000000000000000..37a2b63d4451430e092f35ab375a689f2dcfe940 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_tag.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type Tag struct { + Id int64 `json:"id,omitempty"` + Name string `json:"name,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_user.go b/samples/openapi3/client/petstore/go/go-petstore/model_user.go new file mode 100644 index 0000000000000000000000000000000000000000..caff75ebc2c5dcd04216caf478f4c82a22b1e51b --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_user.go @@ -0,0 +1,22 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type User struct { + Id int64 `json:"id,omitempty"` + Username string `json:"username,omitempty"` + FirstName string `json:"firstName,omitempty"` + LastName string `json:"lastName,omitempty"` + Email string `json:"email,omitempty"` + Password string `json:"password,omitempty"` + Phone string `json:"phone,omitempty"` + // User Status + UserStatus int32 `json:"userStatus,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/response.go b/samples/openapi3/client/petstore/go/go-petstore/response.go new file mode 100644 index 0000000000000000000000000000000000000000..38f373df75ee06769b3de789bed52c0493678327 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/response.go @@ -0,0 +1,43 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "net/http" +) + +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md index bac4d14fe8e369748233f3270c612e243457edb2..7819f9ea689dab047bcee3089f6f9a14bcee7a87 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md @@ -83,6 +83,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123TestSpecialTags**](docs/Api/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/Api/DefaultApi.md#fooget) | **GET** /foo | +*FakeApi* | [**fakeHealthGet**](docs/Api/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -141,6 +142,7 @@ Class | Method | HTTP request | Description - [Foo](docs/Model/Foo.md) - [FormatTest](docs/Model/FormatTest.md) - [HasOnlyReadOnly](docs/Model/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/Model/HealthCheckResult.md) - [InlineObject](docs/Model/InlineObject.md) - [InlineObject1](docs/Model/InlineObject1.md) - [InlineObject2](docs/Model/InlineObject2.md) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md index e6804845b95f48b777c2e30867d84641f1edcf6c..f201520a75be91cc0826bdf27487e9211af708d7 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | @@ -18,6 +19,50 @@ Method | HTTP request | Description [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +# **fakeHealthGet** +> \OpenAPI\Client\Model\HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```php +<?php +require_once(__DIR__ . '/vendor/autoload.php'); + + +$apiInstance = new OpenAPI\Client\Api\FakeApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client() +); + +try { + $result = $apiInstance->fakeHealthGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeHealthGet: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**\OpenAPI\Client\Model\HealthCheckResult**](../Model/HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[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) + # **fakeOuterBooleanSerialize** > bool fakeOuterBooleanSerialize($body) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/HealthCheckResult.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/HealthCheckResult.md new file mode 100644 index 0000000000000000000000000000000000000000..9126cec80ae59cc2d7ab6340ac7dcbaf0ffd9920 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/HealthCheckResult.md @@ -0,0 +1,10 @@ +# HealthCheckResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullable_message** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 5e86d0aeed0972c119eb78b19268d3efe1431429..df86d4d43f8931b991e687adc88993101d2f2b08 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -87,6 +87,259 @@ class FakeApi return $this->config; } + /** + * Operation fakeHealthGet + * + * Health check endpoint + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\HealthCheckResult + */ + public function fakeHealthGet() + { + list($response) = $this->fakeHealthGetWithHttpInfo(); + return $response; + } + + /** + * Operation fakeHealthGetWithHttpInfo + * + * Health check endpoint + * + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\HealthCheckResult, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeHealthGetWithHttpInfo() + { + $request = $this->fakeHealthGetRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\HealthCheckResult' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\HealthCheckResult', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\HealthCheckResult'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\HealthCheckResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fakeHealthGetAsync + * + * Health check endpoint + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeHealthGetAsync() + { + return $this->fakeHealthGetAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fakeHealthGetAsyncWithHttpInfo + * + * Health check endpoint + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeHealthGetAsyncWithHttpInfo() + { + $returnType = '\OpenAPI\Client\Model\HealthCheckResult'; + $request = $this->fakeHealthGetRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fakeHealthGet' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function fakeHealthGetRequest() + { + + $resourcePath = '/fake/health'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation fakeOuterBooleanSerialize * diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php new file mode 100644 index 0000000000000000000000000000000000000000..1c73c1363b51febebca7adac4e45e959b74011ab --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php @@ -0,0 +1,298 @@ +<?php +/** + * HealthCheckResult + * + * PHP version 5 + * + * @category Class + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 4.0.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace OpenAPI\Client\Model; + +use \ArrayAccess; +use \OpenAPI\Client\ObjectSerializer; + +/** + * HealthCheckResult Class Doc Comment + * + * @category Class + * @description Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class HealthCheckResult implements ModelInterface, ArrayAccess +{ + const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'HealthCheckResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'nullable_message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'nullable_message' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'nullable_message' => 'NullableMessage' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'nullable_message' => 'setNullableMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'nullable_message' => 'getNullableMessage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['nullable_message'] = isset($data['nullable_message']) ? $data['nullable_message'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets nullable_message + * + * @return string|null + */ + public function getNullableMessage() + { + return $this->container['nullable_message']; + } + + /** + * Sets nullable_message + * + * @param string|null $nullable_message nullable_message + * + * @return $this + */ + public function setNullableMessage($nullable_message) + { + $this->container['nullable_message'] = $nullable_message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php index bd8bb23f6bb4d1981c850f3937e5428cb77801a3..a50e5947a59e80cb36c99077b6b0facfe427d708 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php @@ -72,6 +72,16 @@ class FakeApiTest extends TestCase { } + /** + * Test case for fakeHealthGet + * + * Health check endpoint. + * + */ + public function testFakeHealthGet() + { + } + /** * Test case for fakeOuterBooleanSerialize * diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/HealthCheckResultTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/HealthCheckResultTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c89c17682908afb159034718ae7ce45104aeaf74 --- /dev/null +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Model/HealthCheckResultTest.php @@ -0,0 +1,87 @@ +<?php +/** + * HealthCheckResultTest + * + * PHP version 5 + * + * @category Class + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +/** + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 4.0.0-SNAPSHOT + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Please update the test case below to test the model. + */ + +namespace OpenAPI\Client; + +use PHPUnit\Framework\TestCase; + +/** + * HealthCheckResultTest Class Doc Comment + * + * @category Class + * @description Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class HealthCheckResultTest extends TestCase +{ + + /** + * Setup before running any test case + */ + public static function setUpBeforeClass() + { + } + + /** + * Setup before running each test case + */ + public function setUp() + { + } + + /** + * Clean up after running each test case + */ + public function tearDown() + { + } + + /** + * Clean up after running all test cases + */ + public static function tearDownAfterClass() + { + } + + /** + * Test "HealthCheckResult" + */ + public function testHealthCheckResult() + { + } + + /** + * Test attribute "nullable_message" + */ + public function testPropertyNullableMessage() + { + } +} diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 080ec68a50563782e29b687819a105455b3d407f..c3165fba18d6ada4ab90ac4d96d923cd90fe4256 100644 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -73,6 +73,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -131,6 +132,7 @@ Class | Method | HTTP request | Description - [Foo](docs/Foo.md) - [FormatTest](docs/FormatTest.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) - [InlineObject](docs/InlineObject.md) - [InlineObject1](docs/InlineObject1.md) - [InlineObject2](docs/InlineObject2.md) diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index 6e4f1f2d3107b6fd7401a54cfd80565dd8e92603..2a95b367e6e0e0e746a1fcd1529b5243098762b7 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -18,6 +19,49 @@ Method | HTTP request | Description [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +# **fake_health_get** +> HealthCheckResult fake_health_get() + +Health check endpoint + +### Example + +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() + +try: + # Health check endpoint + api_response = api_instance.fake_health_get() + pprint(api_response) +except ApiException as e: + print("Exception when calling FakeApi->fake_health_get: %s\n" % e) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[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) + # **fake_outer_boolean_serialize** > bool fake_outer_boolean_serialize(body=body) diff --git a/samples/openapi3/client/petstore/python/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/python/docs/HealthCheckResult.md new file mode 100644 index 0000000000000000000000000000000000000000..346889210a3de45e7821239d962a72dc7c80bb0e --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/HealthCheckResult.md @@ -0,0 +1,10 @@ +# HealthCheckResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullable_message** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/__init__.py index 4ee9bd7e038123993798fcb8e9693dc780db2dab..df8345695b7613732ac3bdccbbb96b0acdc196fb 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/__init__.py @@ -49,6 +49,7 @@ from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.foo import Foo from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly +from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inline_object import InlineObject from petstore_api.models.inline_object1 import InlineObject1 from petstore_api.models.inline_object2 import InlineObject2 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 7dbc1cdfc111512f08ab11b77a8505b9006d9c16..cf6ff848c63d78732a1c5fbcdeea473cbeff6c46 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -32,6 +32,92 @@ class FakeApi(object): api_client = ApiClient() self.api_client = api_client + def fake_health_get(self, **kwargs): # noqa: E501 + """Health check endpoint # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.fake_health_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HealthCheckResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.fake_health_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.fake_health_get_with_http_info(**kwargs) # noqa: E501 + return data + + def fake_health_get_with_http_info(self, **kwargs): # noqa: E501 + """Health check endpoint # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.fake_health_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HealthCheckResult + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_health_get" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/fake/health', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HealthCheckResult', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + def fake_outer_boolean_serialize(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py index 7850d84c1ae1c06c180f96a3b103240a1b2e9abb..7a05aad257bb5aacccf72c0f16ee3874e4df146c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -34,6 +34,7 @@ from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.foo import Foo from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly +from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inline_object import InlineObject from petstore_api.models.inline_object1 import InlineObject1 from petstore_api.models.inline_object2 import InlineObject2 diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py new file mode 100644 index 0000000000000000000000000000000000000000..cf091b3db7bcc879953da066c8654eb6302bfa04 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class HealthCheckResult(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'nullable_message': 'str' + } + + attribute_map = { + 'nullable_message': 'NullableMessage' + } + + def __init__(self, nullable_message=None): # noqa: E501 + """HealthCheckResult - a model defined in OpenAPI""" # noqa: E501 + + self._nullable_message = None + self.discriminator = None + + self.nullable_message = nullable_message + + @property + def nullable_message(self): + """Gets the nullable_message of this HealthCheckResult. # noqa: E501 + + + :return: The nullable_message of this HealthCheckResult. # noqa: E501 + :rtype: str + """ + return self._nullable_message + + @nullable_message.setter + def nullable_message(self, nullable_message): + """Sets the nullable_message of this HealthCheckResult. + + + :param nullable_message: The nullable_message of this HealthCheckResult. # noqa: E501 + :type: str + """ + + self._nullable_message = nullable_message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HealthCheckResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/samples/openapi3/client/petstore/python/test/test_health_check_result.py b/samples/openapi3/client/petstore/python/test/test_health_check_result.py new file mode 100644 index 0000000000000000000000000000000000000000..c98be1e8cbc4160686df83a63a678d5ad663f0c6 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_health_check_result.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.health_check_result import HealthCheckResult # noqa: E501 +from petstore_api.rest import ApiException + + +class TestHealthCheckResult(unittest.TestCase): + """HealthCheckResult unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testHealthCheckResult(self): + """Test HealthCheckResult""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.health_check_result.HealthCheckResult() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/ruby/README.md b/samples/openapi3/client/petstore/ruby/README.md index dceec8a4747cbad699970d72a4280068d3bda7aa..dffb3a16227cee165ae925fa694fbd44f618dfe7 100644 --- a/samples/openapi3/client/petstore/ruby/README.md +++ b/samples/openapi3/client/petstore/ruby/README.md @@ -75,6 +75,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*Petstore::FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint *Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -133,6 +134,7 @@ Class | Method | HTTP request | Description - [Petstore::Foo](docs/Foo.md) - [Petstore::FormatTest](docs/FormatTest.md) - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [Petstore::HealthCheckResult](docs/HealthCheckResult.md) - [Petstore::InlineResponseDefault](docs/InlineResponseDefault.md) - [Petstore::List](docs/List.md) - [Petstore::MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/ruby/docs/FakeApi.md b/samples/openapi3/client/petstore/ruby/docs/FakeApi.md index e4d8e11915ccf57256b94724bdd10a23dab62f14..94005dd00a674bdce88e682f7852d580d5efd8f2 100644 --- a/samples/openapi3/client/petstore/ruby/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/ruby/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -18,6 +19,45 @@ Method | HTTP request | Description [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +# **fake_health_get** +> HealthCheckResult fake_health_get + +Health check endpoint + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new + +begin + #Health check endpoint + result = api_instance.fake_health_get + p result +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->fake_health_get: #{e}" +end +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + # **fake_outer_boolean_serialize** > BOOLEAN fake_outer_boolean_serialize(opts) diff --git a/samples/openapi3/client/petstore/ruby/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/ruby/docs/HealthCheckResult.md new file mode 100644 index 0000000000000000000000000000000000000000..07d74e293b0319261f6aa9da03c67cabd9f44755 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/HealthCheckResult.md @@ -0,0 +1,8 @@ +# Petstore::HealthCheckResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullable_message** | **String** | | [optional] + + diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore.rb b/samples/openapi3/client/petstore/ruby/lib/petstore.rb index ae6f359e36eb5efc1d25324e2c6909b3f07f396f..f2d16071e2c8573c02010e49763abd840ecf2124 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore.rb @@ -37,6 +37,7 @@ require 'petstore/models/file_schema_test_class' require 'petstore/models/foo' require 'petstore/models/format_test' require 'petstore/models/has_only_read_only' +require 'petstore/models/health_check_result' require 'petstore/models/inline_response_default' require 'petstore/models/list' require 'petstore/models/map_test' diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb index 9dfdc4ad60be81857070accc100a9b8048539918..3881a831143990267283aac345673575d52d0617 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -19,6 +19,51 @@ module Petstore def initialize(api_client = ApiClient.default) @api_client = api_client end + # Health check endpoint + # @param [Hash] opts the optional parameters + # @return [HealthCheckResult] + def fake_health_get(opts = {}) + data, _status_code, _headers = fake_health_get_with_http_info(opts) + data + end + + # Health check endpoint + # @param [Hash] opts the optional parameters + # @return [Array<(HealthCheckResult, Fixnum, Hash)>] HealthCheckResult data, response status code and response headers + def fake_health_get_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.fake_health_get ...' + end + # resource path + local_var_path = '/fake/health' + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = [] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'HealthCheckResult') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_health_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test serialization of outer boolean types # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :body Input boolean as post body diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/health_check_result.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/health_check_result.rb new file mode 100644 index 0000000000000000000000000000000000000000..b8f8d2761f24c354d08e7e158d455acdd016e1bd --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/health_check_result.rb @@ -0,0 +1,192 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.0.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + # Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + class HealthCheckResult + attr_accessor :nullable_message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'nullable_message' => :'NullableMessage' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'nullable_message' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'NullableMessage') + self.nullable_message = attributes[:'NullableMessage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + nullable_message == o.nullable_message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [nullable_message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?<inner_type>.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/health_check_result_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/health_check_result_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..765553e97eea5bcc3892164d32401b295a8cb5b2 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/health_check_result_spec.rb @@ -0,0 +1,41 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::HealthCheckResult +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'HealthCheckResult' do + before do + # run before each test + @instance = Petstore::HealthCheckResult.new + end + + after do + # run after each test + end + + describe 'test an instance of HealthCheckResult' do + it 'should create an instance of HealthCheckResult' do + expect(@instance).to be_instance_of(Petstore::HealthCheckResult) + end + end + describe 'test attribute "nullable_message"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/server/petstore/go-api-server/.openapi-generator-ignore b/samples/openapi3/server/petstore/go-api-server/.openapi-generator-ignore new file mode 100644 index 0000000000000000000000000000000000000000..7484ee590a3894506cf063799b885428f95a71be --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/server/petstore/go-api-server/.openapi-generator/VERSION b/samples/openapi3/server/petstore/go-api-server/.openapi-generator/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..afa6365606414bf56f925745712166af5b4a2be0 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/go-api-server/Dockerfile b/samples/openapi3/server/petstore/go-api-server/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cfdfbaed08045b296f019852dc3b8b388d4aadcf --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.10 AS build +WORKDIR /go/src +COPY go ./go +COPY main.go . + +ENV CGO_ENABLED=0 +RUN go get -d -v ./... + +RUN go build -a -installsuffix cgo -o petstoreserver . + +FROM scratch AS runtime +COPY --from=build /go/src/petstoreserver ./ +EXPOSE 8080/tcp +ENTRYPOINT ["./petstoreserver"] diff --git a/samples/openapi3/server/petstore/go-api-server/api/openapi.yaml b/samples/openapi3/server/petstore/go-api-server/api/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bea7646c738ca6e8d1d3a6064c22a52f9cd433d9 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/api/openapi.yaml @@ -0,0 +1,1911 @@ +openapi: 3.0.0 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: http://{server}.swagger.io:{port}/v2 + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: https://localhost:8080/{version} + variables: + version: + default: v2 + enum: + - v1 + - v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_default' + description: response + /pet: + post: + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 400: + description: Invalid ID supplied + 404: + description: Pet not found + 405: + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + 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: + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + 400: + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + description: Invalid user supplied + 404: + description: User not found + summary: Updated user + tags: + - user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + format: int32 + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + format: int32 + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + 400: + description: Someting wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + $ref: '#/components/requestBodies/inline_object_2' + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + responses: + 400: + description: Invalid request + 404: + description: Not found + summary: To test enum parameters + tags: + - fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + post: + description: | + Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ + operationId: testEndpointParameters + requestBody: + $ref: '#/components/requestBodies/inline_object_3' + content: + application/x-www-form-urlencoded: + schema: + 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 + type: object + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ + tags: + - fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + $ref: '#/components/requestBodies/inline_object_4' + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + responses: + 200: + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + 200: + description: successful operation + summary: test inline additionalProperties + tags: + - fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + 200: + description: Success + tags: + - fake + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + /fake/body-with-file-schema: + put: + description: For this test, the body for this request much reference a schema named `File`. + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + 200: + description: Success + tags: + - fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_5' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake/health: + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + inline_object_2: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_2' + inline_object_3: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_3' + inline_object_4: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_4' + inline_object_5: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_5' + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + 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 + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + format: int32 + readOnly: true + type: integer + required: + - name + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: + properties: + integer: + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: ^\d{10}$ + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + pattern: /^image_\d{1,3}$/i + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + 123-list: + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + 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 + 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 + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: $special[model.name] + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + inline_response_default: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + inline_object_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 + type: object + inline_object_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 + type: object + inline_object_4: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + inline_object_5: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http diff --git a/samples/openapi3/server/petstore/go-api-server/go/README.md b/samples/openapi3/server/petstore/go-api-server/go/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c8907b0052e90b5d10056b50d2e3806070c7ffc3 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/README.md @@ -0,0 +1,35 @@ +# Go API Server for petstoreserver + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## Overview +This server was generated by the [openapi-generator] +(https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. +- + +To see how to make this your own, look here: + +[README](https://openapi-generator.tech) + +- API version: 1.0.0 + + +### Running the server +To run the server, follow these simple steps: + +``` +go run main.go +``` + +To run the server in a docker container +``` +docker build --network=host -t petstoreserver . +``` + +Once image is built use +``` +docker run --rm -it petstoreserver +``` + + diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_another_fake.go b/samples/openapi3/server/petstore/go-api-server/go/api_another_fake.go new file mode 100644 index 0000000000000000000000000000000000000000..b30ab1a1acbafbcf8c2616745814bd6aa62ce49a --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/api_another_fake.go @@ -0,0 +1,20 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" +) + +// Call123TestSpecialTags - To test special tags +func Call123TestSpecialTags(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_default.go b/samples/openapi3/server/petstore/go-api-server/go/api_default.go new file mode 100644 index 0000000000000000000000000000000000000000..8de510a0dd82e69de8dacf3153d12eef117a8db9 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/api_default.go @@ -0,0 +1,20 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" +) + +// FooGet - +func FooGet(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_fake.go b/samples/openapi3/server/petstore/go-api-server/go/api_fake.go new file mode 100644 index 0000000000000000000000000000000000000000..6ac1fa43554bdc232c4d6b7ca8a0ac8ff12aa555 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/api_fake.go @@ -0,0 +1,92 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" +) + +// FakeHealthGet - Health check endpoint +func FakeHealthGet(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// FakeOuterBooleanSerialize - +func FakeOuterBooleanSerialize(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// FakeOuterCompositeSerialize - +func FakeOuterCompositeSerialize(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// FakeOuterNumberSerialize - +func FakeOuterNumberSerialize(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// FakeOuterStringSerialize - +func FakeOuterStringSerialize(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestBodyWithFileSchema - +func TestBodyWithFileSchema(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestBodyWithQueryParams - +func TestBodyWithQueryParams(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestClientModel - To test \"client\" model +func TestClientModel(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestEndpointParameters - Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +func TestEndpointParameters(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestEnumParameters - To test enum parameters +func TestEnumParameters(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestGroupParameters - Fake endpoint to test group parameters (optional) +func TestGroupParameters(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestInlineAdditionalProperties - test inline additionalProperties +func TestInlineAdditionalProperties(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// TestJsonFormData - test json serialization of form data +func TestJsonFormData(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_fake_classname_tags123.go b/samples/openapi3/server/petstore/go-api-server/go/api_fake_classname_tags123.go new file mode 100644 index 0000000000000000000000000000000000000000..395c1b2534620a175c974f87df776d0d6f170044 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/api_fake_classname_tags123.go @@ -0,0 +1,20 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" +) + +// TestClassname - To test class name in snake case +func TestClassname(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_pet.go b/samples/openapi3/server/petstore/go-api-server/go/api_pet.go new file mode 100644 index 0000000000000000000000000000000000000000..fc0d47c146c5e452c6b69da5e7cf0aa65c37c15b --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/api_pet.go @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" +) + +// AddPet - Add a new pet to the store +func AddPet(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// DeletePet - Deletes a pet +func DeletePet(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// FindPetsByStatus - Finds Pets by status +func FindPetsByStatus(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// FindPetsByTags - Finds Pets by tags +func FindPetsByTags(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// GetPetById - Find pet by ID +func GetPetById(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// UpdatePet - Update an existing pet +func UpdatePet(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// UpdatePetWithForm - Updates a pet in the store with form data +func UpdatePetWithForm(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// UploadFile - uploads an image +func UploadFile(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// UploadFileWithRequiredFile - uploads an image (required) +func UploadFileWithRequiredFile(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_store.go b/samples/openapi3/server/petstore/go-api-server/go/api_store.go new file mode 100644 index 0000000000000000000000000000000000000000..aa5d01548b8d421f9e007b2baf2e7a00ec99ff5f --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/api_store.go @@ -0,0 +1,38 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" +) + +// DeleteOrder - Delete purchase order by ID +func DeleteOrder(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// GetInventory - Returns pet inventories by status +func GetInventory(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// GetOrderById - Find purchase order by ID +func GetOrderById(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// PlaceOrder - Place an order for a pet +func PlaceOrder(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_user.go b/samples/openapi3/server/petstore/go-api-server/go/api_user.go new file mode 100644 index 0000000000000000000000000000000000000000..aca15233a09475e86190405d7de1fe25f7332c13 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/api_user.go @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" +) + +// CreateUser - Create user +func CreateUser(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// CreateUsersWithArrayInput - Creates list of users with given input array +func CreateUsersWithArrayInput(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// CreateUsersWithListInput - Creates list of users with given input array +func CreateUsersWithListInput(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// DeleteUser - Delete user +func DeleteUser(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// GetUserByName - Get user by user name +func GetUserByName(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// LoginUser - Logs user into the system +func LoginUser(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// LogoutUser - Logs out current logged in user session +func LogoutUser(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + +// UpdateUser - Updated user +func UpdateUser(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/logger.go b/samples/openapi3/server/petstore/go-api-server/go/logger.go new file mode 100644 index 0000000000000000000000000000000000000000..644ec5e51fb429b26f81ed6a5757a12f15b6b589 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/logger.go @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "log" + "net/http" + "time" +) + +func Logger(inner http.Handler, name string) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + + inner.ServeHTTP(w, r) + + log.Printf( + "%s %s %s %s", + r.Method, + r.RequestURI, + name, + time.Since(start), + ) + }) +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_200_response.go b/samples/openapi3/server/petstore/go-api-server/go/model_200_response.go new file mode 100644 index 0000000000000000000000000000000000000000..217fe24e4378a8eb4d23302fa6b57568e55c0f04 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_200_response.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Model200Response - Model for testing model name starting with number +type Model200Response struct { + + Name int32 `json:"name,omitempty"` + + Class string `json:"class,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model__special_model_name_.go b/samples/openapi3/server/petstore/go-api-server/go/model__special_model_name_.go new file mode 100644 index 0000000000000000000000000000000000000000..ffc27255ae9bc7470ba233c9e39b094b7f5905c5 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model__special_model_name_.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type SpecialModelName struct { + + SpecialPropertyName int64 `json:"$special[property.name],omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_additional_properties_class.go b/samples/openapi3/server/petstore/go-api-server/go/model_additional_properties_class.go new file mode 100644 index 0000000000000000000000000000000000000000..430177a300741d2cc4a71e8fc480744a80bc4bec --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_additional_properties_class.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type AdditionalPropertiesClass struct { + + MapProperty map[string]string `json:"map_property,omitempty"` + + MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_animal.go b/samples/openapi3/server/petstore/go-api-server/go/model_animal.go new file mode 100644 index 0000000000000000000000000000000000000000..14d9295d875a92f188233a644761d9d01d81bb5a --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_animal.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Animal struct { + + ClassName string `json:"className"` + + Color string `json:"color,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_api_response.go b/samples/openapi3/server/petstore/go-api-server/go/model_api_response.go new file mode 100644 index 0000000000000000000000000000000000000000..380b8dee0089318dbbbb6eeed3cba29dc337fd80 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_api_response.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ApiResponse struct { + + Code int32 `json:"code,omitempty"` + + Type string `json:"type,omitempty"` + + Message string `json:"message,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_array_of_array_of_number_only.go b/samples/openapi3/server/petstore/go-api-server/go/model_array_of_array_of_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..e0347d8260aea705f9838112aa3830ac09c64362 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_array_of_array_of_number_only.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ArrayOfArrayOfNumberOnly struct { + + ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_array_of_number_only.go b/samples/openapi3/server/petstore/go-api-server/go/model_array_of_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..04d7c86a5e1e8a493fe51185af4ec863e26c6c25 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_array_of_number_only.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ArrayOfNumberOnly struct { + + ArrayNumber []float32 `json:"ArrayNumber,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_array_test_.go b/samples/openapi3/server/petstore/go-api-server/go/model_array_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..a85e460d8c767fc9cd7ecc24bd52a8c43db51d72 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_array_test_.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ArrayTest struct { + + ArrayOfString []string `json:"array_of_string,omitempty"` + + ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"` + + ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_capitalization.go b/samples/openapi3/server/petstore/go-api-server/go/model_capitalization.go new file mode 100644 index 0000000000000000000000000000000000000000..1e1cb8acc3fc6d1be2a2e990eb94a944191d11dc --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_capitalization.go @@ -0,0 +1,26 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Capitalization struct { + + SmallCamel string `json:"smallCamel,omitempty"` + + CapitalCamel string `json:"CapitalCamel,omitempty"` + + SmallSnake string `json:"small_Snake,omitempty"` + + CapitalSnake string `json:"Capital_Snake,omitempty"` + + SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"` + + // Name of the pet + ATT_NAME string `json:"ATT_NAME,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_cat.go b/samples/openapi3/server/petstore/go-api-server/go/model_cat.go new file mode 100644 index 0000000000000000000000000000000000000000..78261ede6121a4733cff641a91341a4552681be4 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_cat.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Cat struct { + + ClassName string `json:"className"` + + Color string `json:"color,omitempty"` + + Declawed bool `json:"declawed,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_category.go b/samples/openapi3/server/petstore/go-api-server/go/model_category.go new file mode 100644 index 0000000000000000000000000000000000000000..373c419af55906038b6734aa4461e6a8d8cf9b9a --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_category.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Category struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_class_model.go b/samples/openapi3/server/petstore/go-api-server/go/model_class_model.go new file mode 100644 index 0000000000000000000000000000000000000000..d9fcd475b7bc243fce82181c970ed95862bd770c --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_class_model.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// ClassModel - Model for testing model with \"_class\" property +type ClassModel struct { + + Class string `json:"_class,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_client.go b/samples/openapi3/server/petstore/go-api-server/go/model_client.go new file mode 100644 index 0000000000000000000000000000000000000000..f49c616f021f9abda8574e1ffa765a8a4e1a9c95 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_client.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Client struct { + + Client string `json:"client,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_dog.go b/samples/openapi3/server/petstore/go-api-server/go/model_dog.go new file mode 100644 index 0000000000000000000000000000000000000000..04b2a9ba9aae7db4c3af8b56022a111ed6f186be --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_dog.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Dog struct { + + ClassName string `json:"className"` + + Color string `json:"color,omitempty"` + + Breed string `json:"breed,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_enum_arrays.go b/samples/openapi3/server/petstore/go-api-server/go/model_enum_arrays.go new file mode 100644 index 0000000000000000000000000000000000000000..813af5d870128f677e56e36e6f069f2c178fb1f1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_enum_arrays.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type EnumArrays struct { + + JustSymbol string `json:"just_symbol,omitempty"` + + ArrayEnum []string `json:"array_enum,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_enum_class.go b/samples/openapi3/server/petstore/go-api-server/go/model_enum_class.go new file mode 100644 index 0000000000000000000000000000000000000000..da4428a5d41d6db362389c8fd61edd8601bc0619 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_enum_class.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type EnumClass string + +// List of EnumClass +const ( + ABC EnumClass = "_abc" + EFG EnumClass = "-efg" + XYZ EnumClass = "(xyz)" +) diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_enum_test_.go b/samples/openapi3/server/petstore/go-api-server/go/model_enum_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..ce8e479d7b96366daa2b120b60036e5d84ad9645 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_enum_test_.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type EnumTest struct { + + EnumString string `json:"enum_string,omitempty"` + + EnumStringRequired string `json:"enum_string_required"` + + EnumInteger int32 `json:"enum_integer,omitempty"` + + EnumNumber float64 `json:"enum_number,omitempty"` + + OuterEnum OuterEnum `json:"outerEnum,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_file.go b/samples/openapi3/server/petstore/go-api-server/go/model_file.go new file mode 100644 index 0000000000000000000000000000000000000000..9bbc4164c2e206329577cb990053de2fbd66241f --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_file.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// File - Must be named `File` for test. +type File struct { + + // Test capitalization + SourceURI string `json:"sourceURI,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_file_schema_test_class.go b/samples/openapi3/server/petstore/go-api-server/go/model_file_schema_test_class.go new file mode 100644 index 0000000000000000000000000000000000000000..c9e7600031eafc4fc965f68ba6f1391895669f25 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_file_schema_test_class.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type FileSchemaTestClass struct { + + File File `json:"file,omitempty"` + + Files []File `json:"files,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_foo.go b/samples/openapi3/server/petstore/go-api-server/go/model_foo.go new file mode 100644 index 0000000000000000000000000000000000000000..9e85ac9ab6c7506d9a66a2b7fc24b47e9c1b6653 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_foo.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Foo struct { + + Bar string `json:"bar,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_format_test_.go b/samples/openapi3/server/petstore/go-api-server/go/model_format_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..eaa3ce019a7473d5f1f0c8aeef66ab3b3c86e2ad --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_format_test_.go @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" + "time" +) + +type FormatTest struct { + + Integer int32 `json:"integer,omitempty"` + + Int32 int32 `json:"int32,omitempty"` + + Int64 int64 `json:"int64,omitempty"` + + Number float32 `json:"number"` + + Float float32 `json:"float,omitempty"` + + Double float64 `json:"double,omitempty"` + + String string `json:"string,omitempty"` + + Byte string `json:"byte"` + + Binary *os.File `json:"binary,omitempty"` + + Date string `json:"date"` + + DateTime time.Time `json:"dateTime,omitempty"` + + Uuid string `json:"uuid,omitempty"` + + Password string `json:"password"` + + // A string that is a 10 digit number. Can have leading zeros. + PatternWithDigits string `json:"pattern_with_digits,omitempty"` + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + PatternWithDigitsAndDelimiter string `json:"pattern_with_digits_and_delimiter,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_has_only_read_only.go b/samples/openapi3/server/petstore/go-api-server/go/model_has_only_read_only.go new file mode 100644 index 0000000000000000000000000000000000000000..d64b0e012c7dbc6f8d519d309eb608b20ec8b059 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_has_only_read_only.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type HasOnlyReadOnly struct { + + Bar string `json:"bar,omitempty"` + + Foo string `json:"foo,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_health_check_result.go b/samples/openapi3/server/petstore/go-api-server/go/model_health_check_result.go new file mode 100644 index 0000000000000000000000000000000000000000..9cebb74d3cbbc13431191537c72f3b893db12458 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_health_check_result.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// HealthCheckResult - Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +type HealthCheckResult struct { + + NullableMessage *string `json:"NullableMessage,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_inline_object.go b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object.go new file mode 100644 index 0000000000000000000000000000000000000000..bcf674af316a089fe8057aa74812dc5385d977b1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineObject struct { + + // Updated name of the pet + Name string `json:"name,omitempty"` + + // Updated status of the pet + Status string `json:"status,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_1.go b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_1.go new file mode 100644 index 0000000000000000000000000000000000000000..aafa96f4352a765544ef4ccc4e5c2a9fb92f9c4d --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_1.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" +) + +type InlineObject1 struct { + + // Additional data to pass to server + AdditionalMetadata string `json:"additionalMetadata,omitempty"` + + // file to upload + File *os.File `json:"file,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_2.go b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_2.go new file mode 100644 index 0000000000000000000000000000000000000000..3babd0cfac996d3485a34e5833ec112ab421ccd9 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_2.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineObject2 struct { + + // Form parameter enum test (string array) + EnumFormStringArray []string `json:"enum_form_string_array,omitempty"` + + // Form parameter enum test (string) + EnumFormString string `json:"enum_form_string,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_3.go b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_3.go new file mode 100644 index 0000000000000000000000000000000000000000..226092059da7eeab69e5be59cb754e3787e426ed --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_3.go @@ -0,0 +1,60 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" + "time" +) + +type InlineObject3 struct { + + // None + Integer int32 `json:"integer,omitempty"` + + // None + Int32 int32 `json:"int32,omitempty"` + + // None + Int64 int64 `json:"int64,omitempty"` + + // None + Number float32 `json:"number"` + + // None + Float float32 `json:"float,omitempty"` + + // None + Double float64 `json:"double"` + + // None + String string `json:"string,omitempty"` + + // None + PatternWithoutDelimiter string `json:"pattern_without_delimiter"` + + // None + Byte string `json:"byte"` + + // None + Binary *os.File `json:"binary,omitempty"` + + // None + Date string `json:"date,omitempty"` + + // None + DateTime time.Time `json:"dateTime,omitempty"` + + // None + Password string `json:"password,omitempty"` + + // None + Callback string `json:"callback,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_4.go b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_4.go new file mode 100644 index 0000000000000000000000000000000000000000..23db282a2e15013b498f08420c22c8b7e4f89919 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_4.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineObject4 struct { + + // field1 + Param string `json:"param"` + + // field2 + Param2 string `json:"param2"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_5.go b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_5.go new file mode 100644 index 0000000000000000000000000000000000000000..8004ded7ce51cf9b21aaef4e02299f16333c9078 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_inline_object_5.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" +) + +type InlineObject5 struct { + + // Additional data to pass to server + AdditionalMetadata string `json:"additionalMetadata,omitempty"` + + // file to upload + RequiredFile *os.File `json:"requiredFile"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_inline_response_default.go b/samples/openapi3/server/petstore/go-api-server/go/model_inline_response_default.go new file mode 100644 index 0000000000000000000000000000000000000000..50f4bb4f2bd4edcabf1bd1bb2c9babc1464c18f6 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_inline_response_default.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineResponseDefault struct { + + String Foo `json:"string,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_list.go b/samples/openapi3/server/petstore/go-api-server/go/model_list.go new file mode 100644 index 0000000000000000000000000000000000000000..a6bf160a13c4a8b76cfe9101421fb1efb13b9b52 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_list.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type List struct { + + Var123List string `json:"123-list,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_map_test_.go b/samples/openapi3/server/petstore/go-api-server/go/model_map_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..49a86a792ac934b9de719706cfef7eca34ecacb1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_map_test_.go @@ -0,0 +1,21 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type MapTest struct { + + MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"` + + MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"` + + DirectMap map[string]bool `json:"direct_map,omitempty"` + + IndirectMap map[string]bool `json:"indirect_map,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_mixed_properties_and_additional_properties_class.go b/samples/openapi3/server/petstore/go-api-server/go/model_mixed_properties_and_additional_properties_class.go new file mode 100644 index 0000000000000000000000000000000000000000..e25d32587cd5489a297255fd47c0268202739c75 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_mixed_properties_and_additional_properties_class.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "time" +) + +type MixedPropertiesAndAdditionalPropertiesClass struct { + + Uuid string `json:"uuid,omitempty"` + + DateTime time.Time `json:"dateTime,omitempty"` + + Map map[string]Animal `json:"map,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_name.go b/samples/openapi3/server/petstore/go-api-server/go/model_name.go new file mode 100644 index 0000000000000000000000000000000000000000..cd9a874c4190ada2520a33648d1bff4a165de54c --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_name.go @@ -0,0 +1,22 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Name - Model for testing model name same as property name +type Name struct { + + Name int32 `json:"name"` + + SnakeCase int32 `json:"snake_case,omitempty"` + + Property string `json:"property,omitempty"` + + Var123Number int32 `json:"123Number,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_number_only.go b/samples/openapi3/server/petstore/go-api-server/go/model_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..ba6f4af6401538c2562ff2999f0b9b51ee1ba923 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_number_only.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type NumberOnly struct { + + JustNumber float32 `json:"JustNumber,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_order.go b/samples/openapi3/server/petstore/go-api-server/go/model_order.go new file mode 100644 index 0000000000000000000000000000000000000000..6849a9f76d69126d74f414863af6cd1a4364cb08 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_order.go @@ -0,0 +1,30 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "time" +) + +type Order struct { + + Id int64 `json:"id,omitempty"` + + PetId int64 `json:"petId,omitempty"` + + Quantity int32 `json:"quantity,omitempty"` + + ShipDate time.Time `json:"shipDate,omitempty"` + + // Order Status + Status string `json:"status,omitempty"` + + Complete bool `json:"complete,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_outer_composite.go b/samples/openapi3/server/petstore/go-api-server/go/model_outer_composite.go new file mode 100644 index 0000000000000000000000000000000000000000..7534db47c2e41a567930004faf5332c220bf830e --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_outer_composite.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type OuterComposite struct { + + MyNumber float32 `json:"my_number,omitempty"` + + MyString string `json:"my_string,omitempty"` + + MyBoolean bool `json:"my_boolean,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_outer_enum.go b/samples/openapi3/server/petstore/go-api-server/go/model_outer_enum.go new file mode 100644 index 0000000000000000000000000000000000000000..d01d988ccda2109b0665cf50a717ada6db9f2439 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_outer_enum.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type OuterEnum string + +// List of OuterEnum +const ( + PLACED OuterEnum = "placed" + APPROVED OuterEnum = "approved" + DELIVERED OuterEnum = "delivered" +) diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_pet.go b/samples/openapi3/server/petstore/go-api-server/go/model_pet.go new file mode 100644 index 0000000000000000000000000000000000000000..2271730674e2d67aacdaf6caf702a1bac332a1a4 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_pet.go @@ -0,0 +1,26 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Pet struct { + + Id int64 `json:"id,omitempty"` + + Category Category `json:"category,omitempty"` + + Name string `json:"name"` + + PhotoUrls []string `json:"photoUrls"` + + Tags []Tag `json:"tags,omitempty"` + + // pet status in the store + Status string `json:"status,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_read_only_first.go b/samples/openapi3/server/petstore/go-api-server/go/model_read_only_first.go new file mode 100644 index 0000000000000000000000000000000000000000..c4192d91ee2671455c19a55637d315841f3f893f --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_read_only_first.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ReadOnlyFirst struct { + + Bar string `json:"bar,omitempty"` + + Baz string `json:"baz,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_return.go b/samples/openapi3/server/petstore/go-api-server/go/model_return.go new file mode 100644 index 0000000000000000000000000000000000000000..0ff664525de8077e69f7ade07f7c0e2083d4c463 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_return.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Return - Model for testing reserved words +type Return struct { + + Return int32 `json:"return,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_tag.go b/samples/openapi3/server/petstore/go-api-server/go/model_tag.go new file mode 100644 index 0000000000000000000000000000000000000000..29cd4d64ae3570520fc620f384ea38045f9d53a1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_tag.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Tag struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/model_user.go b/samples/openapi3/server/petstore/go-api-server/go/model_user.go new file mode 100644 index 0000000000000000000000000000000000000000..1eda4c6f763f1add4aed966489a42b2c76ed8e99 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/model_user.go @@ -0,0 +1,30 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type User struct { + + Id int64 `json:"id,omitempty"` + + Username string `json:"username,omitempty"` + + FirstName string `json:"firstName,omitempty"` + + LastName string `json:"lastName,omitempty"` + + Email string `json:"email,omitempty"` + + Password string `json:"password,omitempty"` + + Phone string `json:"phone,omitempty"` + + // User Status + UserStatus int32 `json:"userStatus,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-api-server/go/routers.go b/samples/openapi3/server/petstore/go-api-server/go/routers.go new file mode 100644 index 0000000000000000000000000000000000000000..215c2ba072a6063fb8e5445e787bb77daf75fa6d --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/go/routers.go @@ -0,0 +1,316 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "fmt" + "net/http" + "strings" + + "github.com/gorilla/mux" +) + +type Route struct { + Name string + Method string + Pattern string + HandlerFunc http.HandlerFunc +} + +type Routes []Route + +func NewRouter() *mux.Router { + router := mux.NewRouter().StrictSlash(true) + for _, route := range routes { + var handler http.Handler + handler = route.HandlerFunc + handler = Logger(handler, route.Name) + + router. + Methods(route.Method). + Path(route.Pattern). + Name(route.Name). + Handler(handler) + } + + return router +} + +func Index(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello World!") +} + +var routes = Routes{ + { + "Index", + "GET", + "/v2/", + Index, + }, + + { + "Call123TestSpecialTags", + strings.ToUpper("Patch"), + "/v2/another-fake/dummy", + Call123TestSpecialTags, + }, + + { + "FooGet", + strings.ToUpper("Get"), + "/v2/foo", + FooGet, + }, + + { + "FakeHealthGet", + strings.ToUpper("Get"), + "/v2/fake/health", + FakeHealthGet, + }, + + { + "FakeOuterBooleanSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/boolean", + FakeOuterBooleanSerialize, + }, + + { + "FakeOuterCompositeSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/composite", + FakeOuterCompositeSerialize, + }, + + { + "FakeOuterNumberSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/number", + FakeOuterNumberSerialize, + }, + + { + "FakeOuterStringSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/string", + FakeOuterStringSerialize, + }, + + { + "TestBodyWithFileSchema", + strings.ToUpper("Put"), + "/v2/fake/body-with-file-schema", + TestBodyWithFileSchema, + }, + + { + "TestBodyWithQueryParams", + strings.ToUpper("Put"), + "/v2/fake/body-with-query-params", + TestBodyWithQueryParams, + }, + + { + "TestClientModel", + strings.ToUpper("Patch"), + "/v2/fake", + TestClientModel, + }, + + { + "TestEndpointParameters", + strings.ToUpper("Post"), + "/v2/fake", + TestEndpointParameters, + }, + + { + "TestEnumParameters", + strings.ToUpper("Get"), + "/v2/fake", + TestEnumParameters, + }, + + { + "TestGroupParameters", + strings.ToUpper("Delete"), + "/v2/fake", + TestGroupParameters, + }, + + { + "TestInlineAdditionalProperties", + strings.ToUpper("Post"), + "/v2/fake/inline-additionalProperties", + TestInlineAdditionalProperties, + }, + + { + "TestJsonFormData", + strings.ToUpper("Get"), + "/v2/fake/jsonFormData", + TestJsonFormData, + }, + + { + "TestClassname", + strings.ToUpper("Patch"), + "/v2/fake_classname_test", + TestClassname, + }, + + { + "AddPet", + strings.ToUpper("Post"), + "/v2/pet", + AddPet, + }, + + { + "DeletePet", + strings.ToUpper("Delete"), + "/v2/pet/{petId}", + DeletePet, + }, + + { + "FindPetsByStatus", + strings.ToUpper("Get"), + "/v2/pet/findByStatus", + FindPetsByStatus, + }, + + { + "FindPetsByTags", + strings.ToUpper("Get"), + "/v2/pet/findByTags", + FindPetsByTags, + }, + + { + "GetPetById", + strings.ToUpper("Get"), + "/v2/pet/{petId}", + GetPetById, + }, + + { + "UpdatePet", + strings.ToUpper("Put"), + "/v2/pet", + UpdatePet, + }, + + { + "UpdatePetWithForm", + strings.ToUpper("Post"), + "/v2/pet/{petId}", + UpdatePetWithForm, + }, + + { + "UploadFile", + strings.ToUpper("Post"), + "/v2/pet/{petId}/uploadImage", + UploadFile, + }, + + { + "UploadFileWithRequiredFile", + strings.ToUpper("Post"), + "/v2/fake/{petId}/uploadImageWithRequiredFile", + UploadFileWithRequiredFile, + }, + + { + "DeleteOrder", + strings.ToUpper("Delete"), + "/v2/store/order/{order_id}", + DeleteOrder, + }, + + { + "GetInventory", + strings.ToUpper("Get"), + "/v2/store/inventory", + GetInventory, + }, + + { + "GetOrderById", + strings.ToUpper("Get"), + "/v2/store/order/{order_id}", + GetOrderById, + }, + + { + "PlaceOrder", + strings.ToUpper("Post"), + "/v2/store/order", + PlaceOrder, + }, + + { + "CreateUser", + strings.ToUpper("Post"), + "/v2/user", + CreateUser, + }, + + { + "CreateUsersWithArrayInput", + strings.ToUpper("Post"), + "/v2/user/createWithArray", + CreateUsersWithArrayInput, + }, + + { + "CreateUsersWithListInput", + strings.ToUpper("Post"), + "/v2/user/createWithList", + CreateUsersWithListInput, + }, + + { + "DeleteUser", + strings.ToUpper("Delete"), + "/v2/user/{username}", + DeleteUser, + }, + + { + "GetUserByName", + strings.ToUpper("Get"), + "/v2/user/{username}", + GetUserByName, + }, + + { + "LoginUser", + strings.ToUpper("Get"), + "/v2/user/login", + LoginUser, + }, + + { + "LogoutUser", + strings.ToUpper("Get"), + "/v2/user/logout", + LogoutUser, + }, + + { + "UpdateUser", + strings.ToUpper("Put"), + "/v2/user/{username}", + UpdateUser, + }, +} diff --git a/samples/openapi3/server/petstore/go-api-server/main.go b/samples/openapi3/server/petstore/go-api-server/main.go new file mode 100644 index 0000000000000000000000000000000000000000..235915e27a201d2f0eee402140eac3d76363bbc3 --- /dev/null +++ b/samples/openapi3/server/petstore/go-api-server/main.go @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package main + +import ( + "log" + "net/http" + + // WARNING! + // Change this to a fully-qualified import path + // once you place this file into your project. + // For example, + // + // sw "github.com/myname/myrepo/go" + // + sw "./go" +) + +func main() { + log.Printf("Server started") + + router := sw.NewRouter() + + log.Fatal(http.ListenAndServe(":8080", router)) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator-ignore b/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator-ignore new file mode 100644 index 0000000000000000000000000000000000000000..7484ee590a3894506cf063799b885428f95a71be --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator/VERSION b/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..afa6365606414bf56f925745712166af5b4a2be0 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/go-gin-api-server/Dockerfile b/samples/openapi3/server/petstore/go-gin-api-server/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cfdfbaed08045b296f019852dc3b8b388d4aadcf --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.10 AS build +WORKDIR /go/src +COPY go ./go +COPY main.go . + +ENV CGO_ENABLED=0 +RUN go get -d -v ./... + +RUN go build -a -installsuffix cgo -o petstoreserver . + +FROM scratch AS runtime +COPY --from=build /go/src/petstoreserver ./ +EXPOSE 8080/tcp +ENTRYPOINT ["./petstoreserver"] diff --git a/samples/openapi3/server/petstore/go-gin-api-server/api/openapi.yaml b/samples/openapi3/server/petstore/go-gin-api-server/api/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bea7646c738ca6e8d1d3a6064c22a52f9cd433d9 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/api/openapi.yaml @@ -0,0 +1,1911 @@ +openapi: 3.0.0 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: http://{server}.swagger.io:{port}/v2 + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: https://localhost:8080/{version} + variables: + version: + default: v2 + enum: + - v1 + - v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_default' + description: response + /pet: + post: + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 400: + description: Invalid ID supplied + 404: + description: Pet not found + 405: + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + 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: + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + 400: + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + description: Invalid user supplied + 404: + description: User not found + summary: Updated user + tags: + - user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + format: int32 + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + format: int32 + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + 400: + description: Someting wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + $ref: '#/components/requestBodies/inline_object_2' + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + responses: + 400: + description: Invalid request + 404: + description: Not found + summary: To test enum parameters + tags: + - fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + post: + description: | + Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ + operationId: testEndpointParameters + requestBody: + $ref: '#/components/requestBodies/inline_object_3' + content: + application/x-www-form-urlencoded: + schema: + 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 + type: object + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + å‡ç«¯é»ž + å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ + 가짜 엔드 í¬ì¸íЏ + tags: + - fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + responses: + 200: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + $ref: '#/components/requestBodies/inline_object_4' + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + responses: + 200: + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + 200: + description: successful operation + summary: test inline additionalProperties + tags: + - fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + 200: + description: Success + tags: + - fake + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + /fake/body-with-file-schema: + put: + description: For this test, the body for this request much reference a schema named `File`. + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + 200: + description: Success + tags: + - fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_5' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake/health: + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + inline_object_2: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_2' + inline_object_3: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_3' + inline_object_4: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_4' + inline_object_5: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_5' + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + 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 + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + format: int32 + readOnly: true + type: integer + required: + - name + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: + properties: + integer: + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: ^\d{10}$ + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + pattern: /^image_\d{1,3}$/i + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + 123-list: + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + 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 + 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 + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: $special[model.name] + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + inline_response_default: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + inline_object_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 + type: object + inline_object_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 + type: object + inline_object_4: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + inline_object_5: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/README.md b/samples/openapi3/server/petstore/go-gin-api-server/go/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dd21f447d5d8c24471546ce53e9a053bc5860d49 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/README.md @@ -0,0 +1,40 @@ +# Go API Server for petstoreserver + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## Overview +This server was generated by the [openapi-generator] +(https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. +- + +To see how to make this your own, look here: + +[README](https://openapi-generator.tech) + +- API version: 1.0.0 + +### Running the server + +To run the server, follow these simple steps: + +``` +go run main.go +``` + +To run the server in a docker container +``` +docker build --network=host -t petstoreserver . +``` + +Once the image is built, just run +``` +docker run --rm -it petstoreserver +``` + +### Known Issue + +Endpoints sharing a common path may result in issues. For example, `/v2/pet/findByTags` and `/v2/pet/:petId` will result in an issue with the Gin framework. For more information about this known limitation, please refer to [gin-gonic/gin#388](https://github.com/gin-gonic/gin/issues/388) for more information. + +A workaround is to manually update the path and handler. Please refer to [gin-gonic/gin/issues/205#issuecomment-296155497](https://github.com/gin-gonic/gin/issues/205#issuecomment-296155497) for more information. + diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/api_another_fake.go b/samples/openapi3/server/petstore/go-gin-api-server/go/api_another_fake.go new file mode 100644 index 0000000000000000000000000000000000000000..93986aa66eeeea885780155b2b9207897dc403d0 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/api_another_fake.go @@ -0,0 +1,21 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// Call123TestSpecialTags - To test special tags +func Call123TestSpecialTags(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/api_default.go b/samples/openapi3/server/petstore/go-gin-api-server/go/api_default.go new file mode 100644 index 0000000000000000000000000000000000000000..d19a1886d0ca9ea3384214a6a9e638ccedc715cd --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/api_default.go @@ -0,0 +1,21 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// FooGet - +func FooGet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/api_fake.go b/samples/openapi3/server/petstore/go-gin-api-server/go/api_fake.go new file mode 100644 index 0000000000000000000000000000000000000000..ec2f170ad53657fd2623380141982226cd10b3f6 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/api_fake.go @@ -0,0 +1,81 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// FakeHealthGet - Health check endpoint +func FakeHealthGet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FakeOuterBooleanSerialize - +func FakeOuterBooleanSerialize(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FakeOuterCompositeSerialize - +func FakeOuterCompositeSerialize(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FakeOuterNumberSerialize - +func FakeOuterNumberSerialize(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FakeOuterStringSerialize - +func FakeOuterStringSerialize(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestBodyWithFileSchema - +func TestBodyWithFileSchema(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestBodyWithQueryParams - +func TestBodyWithQueryParams(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestClientModel - To test \"client\" model +func TestClientModel(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestEndpointParameters - Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ +func TestEndpointParameters(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestEnumParameters - To test enum parameters +func TestEnumParameters(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestGroupParameters - Fake endpoint to test group parameters (optional) +func TestGroupParameters(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestInlineAdditionalProperties - test inline additionalProperties +func TestInlineAdditionalProperties(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// TestJsonFormData - test json serialization of form data +func TestJsonFormData(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/api_fake_classname_tags123.go b/samples/openapi3/server/petstore/go-gin-api-server/go/api_fake_classname_tags123.go new file mode 100644 index 0000000000000000000000000000000000000000..97fd3a46d6082822dd193c37e453b2d574fcd036 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/api_fake_classname_tags123.go @@ -0,0 +1,21 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// TestClassname - To test class name in snake case +func TestClassname(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/api_pet.go b/samples/openapi3/server/petstore/go-gin-api-server/go/api_pet.go new file mode 100644 index 0000000000000000000000000000000000000000..a24a7d2e5e211ededb8b70c4baba20171894a6fd --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/api_pet.go @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// AddPet - Add a new pet to the store +func AddPet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// DeletePet - Deletes a pet +func DeletePet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FindPetsByStatus - Finds Pets by status +func FindPetsByStatus(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FindPetsByTags - Finds Pets by tags +func FindPetsByTags(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetPetById - Find pet by ID +func GetPetById(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UpdatePet - Update an existing pet +func UpdatePet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UpdatePetWithForm - Updates a pet in the store with form data +func UpdatePetWithForm(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UploadFile - uploads an image +func UploadFile(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UploadFileWithRequiredFile - uploads an image (required) +func UploadFileWithRequiredFile(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/api_store.go b/samples/openapi3/server/petstore/go-gin-api-server/go/api_store.go new file mode 100644 index 0000000000000000000000000000000000000000..fd95d3d9541c03424d668dd870f2c4231d382b50 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/api_store.go @@ -0,0 +1,36 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// DeleteOrder - Delete purchase order by ID +func DeleteOrder(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetInventory - Returns pet inventories by status +func GetInventory(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetOrderById - Find purchase order by ID +func GetOrderById(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// PlaceOrder - Place an order for a pet +func PlaceOrder(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/api_user.go b/samples/openapi3/server/petstore/go-gin-api-server/go/api_user.go new file mode 100644 index 0000000000000000000000000000000000000000..710931c2136c29d6fa2aa1dd95d1bd2cbef1d908 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/api_user.go @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// CreateUser - Create user +func CreateUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// CreateUsersWithArrayInput - Creates list of users with given input array +func CreateUsersWithArrayInput(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// CreateUsersWithListInput - Creates list of users with given input array +func CreateUsersWithListInput(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// DeleteUser - Delete user +func DeleteUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetUserByName - Get user by user name +func GetUserByName(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// LoginUser - Logs user into the system +func LoginUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// LogoutUser - Logs out current logged in user session +func LogoutUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UpdateUser - Updated user +func UpdateUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_200_response.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_200_response.go new file mode 100644 index 0000000000000000000000000000000000000000..217fe24e4378a8eb4d23302fa6b57568e55c0f04 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_200_response.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Model200Response - Model for testing model name starting with number +type Model200Response struct { + + Name int32 `json:"name,omitempty"` + + Class string `json:"class,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model__special_model_name_.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model__special_model_name_.go new file mode 100644 index 0000000000000000000000000000000000000000..ffc27255ae9bc7470ba233c9e39b094b7f5905c5 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model__special_model_name_.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type SpecialModelName struct { + + SpecialPropertyName int64 `json:"$special[property.name],omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_additional_properties_class.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_additional_properties_class.go new file mode 100644 index 0000000000000000000000000000000000000000..430177a300741d2cc4a71e8fc480744a80bc4bec --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_additional_properties_class.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type AdditionalPropertiesClass struct { + + MapProperty map[string]string `json:"map_property,omitempty"` + + MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_animal.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_animal.go new file mode 100644 index 0000000000000000000000000000000000000000..14d9295d875a92f188233a644761d9d01d81bb5a --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_animal.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Animal struct { + + ClassName string `json:"className"` + + Color string `json:"color,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_api_response.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_api_response.go new file mode 100644 index 0000000000000000000000000000000000000000..380b8dee0089318dbbbb6eeed3cba29dc337fd80 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_api_response.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ApiResponse struct { + + Code int32 `json:"code,omitempty"` + + Type string `json:"type,omitempty"` + + Message string `json:"message,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_of_array_of_number_only.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_of_array_of_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..e0347d8260aea705f9838112aa3830ac09c64362 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_of_array_of_number_only.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ArrayOfArrayOfNumberOnly struct { + + ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_of_number_only.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_of_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..04d7c86a5e1e8a493fe51185af4ec863e26c6c25 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_of_number_only.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ArrayOfNumberOnly struct { + + ArrayNumber []float32 `json:"ArrayNumber,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_test_.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..a85e460d8c767fc9cd7ecc24bd52a8c43db51d72 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_array_test_.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ArrayTest struct { + + ArrayOfString []string `json:"array_of_string,omitempty"` + + ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"` + + ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_capitalization.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_capitalization.go new file mode 100644 index 0000000000000000000000000000000000000000..1e1cb8acc3fc6d1be2a2e990eb94a944191d11dc --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_capitalization.go @@ -0,0 +1,26 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Capitalization struct { + + SmallCamel string `json:"smallCamel,omitempty"` + + CapitalCamel string `json:"CapitalCamel,omitempty"` + + SmallSnake string `json:"small_Snake,omitempty"` + + CapitalSnake string `json:"Capital_Snake,omitempty"` + + SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"` + + // Name of the pet + ATT_NAME string `json:"ATT_NAME,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_cat.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_cat.go new file mode 100644 index 0000000000000000000000000000000000000000..78261ede6121a4733cff641a91341a4552681be4 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_cat.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Cat struct { + + ClassName string `json:"className"` + + Color string `json:"color,omitempty"` + + Declawed bool `json:"declawed,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_category.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_category.go new file mode 100644 index 0000000000000000000000000000000000000000..373c419af55906038b6734aa4461e6a8d8cf9b9a --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_category.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Category struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_class_model.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_class_model.go new file mode 100644 index 0000000000000000000000000000000000000000..d9fcd475b7bc243fce82181c970ed95862bd770c --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_class_model.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// ClassModel - Model for testing model with \"_class\" property +type ClassModel struct { + + Class string `json:"_class,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_client.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_client.go new file mode 100644 index 0000000000000000000000000000000000000000..f49c616f021f9abda8574e1ffa765a8a4e1a9c95 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_client.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Client struct { + + Client string `json:"client,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_dog.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_dog.go new file mode 100644 index 0000000000000000000000000000000000000000..04b2a9ba9aae7db4c3af8b56022a111ed6f186be --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_dog.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Dog struct { + + ClassName string `json:"className"` + + Color string `json:"color,omitempty"` + + Breed string `json:"breed,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_arrays.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_arrays.go new file mode 100644 index 0000000000000000000000000000000000000000..813af5d870128f677e56e36e6f069f2c178fb1f1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_arrays.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type EnumArrays struct { + + JustSymbol string `json:"just_symbol,omitempty"` + + ArrayEnum []string `json:"array_enum,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_class.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_class.go new file mode 100644 index 0000000000000000000000000000000000000000..da4428a5d41d6db362389c8fd61edd8601bc0619 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_class.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type EnumClass string + +// List of EnumClass +const ( + ABC EnumClass = "_abc" + EFG EnumClass = "-efg" + XYZ EnumClass = "(xyz)" +) diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_test_.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..ce8e479d7b96366daa2b120b60036e5d84ad9645 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_enum_test_.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type EnumTest struct { + + EnumString string `json:"enum_string,omitempty"` + + EnumStringRequired string `json:"enum_string_required"` + + EnumInteger int32 `json:"enum_integer,omitempty"` + + EnumNumber float64 `json:"enum_number,omitempty"` + + OuterEnum OuterEnum `json:"outerEnum,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_file.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_file.go new file mode 100644 index 0000000000000000000000000000000000000000..9bbc4164c2e206329577cb990053de2fbd66241f --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_file.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// File - Must be named `File` for test. +type File struct { + + // Test capitalization + SourceURI string `json:"sourceURI,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_file_schema_test_class.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_file_schema_test_class.go new file mode 100644 index 0000000000000000000000000000000000000000..c9e7600031eafc4fc965f68ba6f1391895669f25 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_file_schema_test_class.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type FileSchemaTestClass struct { + + File File `json:"file,omitempty"` + + Files []File `json:"files,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_foo.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_foo.go new file mode 100644 index 0000000000000000000000000000000000000000..9e85ac9ab6c7506d9a66a2b7fc24b47e9c1b6653 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_foo.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Foo struct { + + Bar string `json:"bar,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_format_test_.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_format_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..eaa3ce019a7473d5f1f0c8aeef66ab3b3c86e2ad --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_format_test_.go @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" + "time" +) + +type FormatTest struct { + + Integer int32 `json:"integer,omitempty"` + + Int32 int32 `json:"int32,omitempty"` + + Int64 int64 `json:"int64,omitempty"` + + Number float32 `json:"number"` + + Float float32 `json:"float,omitempty"` + + Double float64 `json:"double,omitempty"` + + String string `json:"string,omitempty"` + + Byte string `json:"byte"` + + Binary *os.File `json:"binary,omitempty"` + + Date string `json:"date"` + + DateTime time.Time `json:"dateTime,omitempty"` + + Uuid string `json:"uuid,omitempty"` + + Password string `json:"password"` + + // A string that is a 10 digit number. Can have leading zeros. + PatternWithDigits string `json:"pattern_with_digits,omitempty"` + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + PatternWithDigitsAndDelimiter string `json:"pattern_with_digits_and_delimiter,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_has_only_read_only.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_has_only_read_only.go new file mode 100644 index 0000000000000000000000000000000000000000..d64b0e012c7dbc6f8d519d309eb608b20ec8b059 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_has_only_read_only.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type HasOnlyReadOnly struct { + + Bar string `json:"bar,omitempty"` + + Foo string `json:"foo,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_health_check_result.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_health_check_result.go new file mode 100644 index 0000000000000000000000000000000000000000..9cebb74d3cbbc13431191537c72f3b893db12458 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_health_check_result.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// HealthCheckResult - Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +type HealthCheckResult struct { + + NullableMessage *string `json:"NullableMessage,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object.go new file mode 100644 index 0000000000000000000000000000000000000000..bcf674af316a089fe8057aa74812dc5385d977b1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineObject struct { + + // Updated name of the pet + Name string `json:"name,omitempty"` + + // Updated status of the pet + Status string `json:"status,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_1.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_1.go new file mode 100644 index 0000000000000000000000000000000000000000..aafa96f4352a765544ef4ccc4e5c2a9fb92f9c4d --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_1.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" +) + +type InlineObject1 struct { + + // Additional data to pass to server + AdditionalMetadata string `json:"additionalMetadata,omitempty"` + + // file to upload + File *os.File `json:"file,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_2.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_2.go new file mode 100644 index 0000000000000000000000000000000000000000..3babd0cfac996d3485a34e5833ec112ab421ccd9 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_2.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineObject2 struct { + + // Form parameter enum test (string array) + EnumFormStringArray []string `json:"enum_form_string_array,omitempty"` + + // Form parameter enum test (string) + EnumFormString string `json:"enum_form_string,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_3.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_3.go new file mode 100644 index 0000000000000000000000000000000000000000..226092059da7eeab69e5be59cb754e3787e426ed --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_3.go @@ -0,0 +1,60 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" + "time" +) + +type InlineObject3 struct { + + // None + Integer int32 `json:"integer,omitempty"` + + // None + Int32 int32 `json:"int32,omitempty"` + + // None + Int64 int64 `json:"int64,omitempty"` + + // None + Number float32 `json:"number"` + + // None + Float float32 `json:"float,omitempty"` + + // None + Double float64 `json:"double"` + + // None + String string `json:"string,omitempty"` + + // None + PatternWithoutDelimiter string `json:"pattern_without_delimiter"` + + // None + Byte string `json:"byte"` + + // None + Binary *os.File `json:"binary,omitempty"` + + // None + Date string `json:"date,omitempty"` + + // None + DateTime time.Time `json:"dateTime,omitempty"` + + // None + Password string `json:"password,omitempty"` + + // None + Callback string `json:"callback,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_4.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_4.go new file mode 100644 index 0000000000000000000000000000000000000000..23db282a2e15013b498f08420c22c8b7e4f89919 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_4.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineObject4 struct { + + // field1 + Param string `json:"param"` + + // field2 + Param2 string `json:"param2"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_5.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_5.go new file mode 100644 index 0000000000000000000000000000000000000000..8004ded7ce51cf9b21aaef4e02299f16333c9078 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_object_5.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "os" +) + +type InlineObject5 struct { + + // Additional data to pass to server + AdditionalMetadata string `json:"additionalMetadata,omitempty"` + + // file to upload + RequiredFile *os.File `json:"requiredFile"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_response_default.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_response_default.go new file mode 100644 index 0000000000000000000000000000000000000000..50f4bb4f2bd4edcabf1bd1bb2c9babc1464c18f6 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_inline_response_default.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type InlineResponseDefault struct { + + String Foo `json:"string,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_list.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_list.go new file mode 100644 index 0000000000000000000000000000000000000000..a6bf160a13c4a8b76cfe9101421fb1efb13b9b52 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_list.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type List struct { + + Var123List string `json:"123-list,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_map_test_.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_map_test_.go new file mode 100644 index 0000000000000000000000000000000000000000..49a86a792ac934b9de719706cfef7eca34ecacb1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_map_test_.go @@ -0,0 +1,21 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type MapTest struct { + + MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"` + + MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"` + + DirectMap map[string]bool `json:"direct_map,omitempty"` + + IndirectMap map[string]bool `json:"indirect_map,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_mixed_properties_and_additional_properties_class.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_mixed_properties_and_additional_properties_class.go new file mode 100644 index 0000000000000000000000000000000000000000..e25d32587cd5489a297255fd47c0268202739c75 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_mixed_properties_and_additional_properties_class.go @@ -0,0 +1,23 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "time" +) + +type MixedPropertiesAndAdditionalPropertiesClass struct { + + Uuid string `json:"uuid,omitempty"` + + DateTime time.Time `json:"dateTime,omitempty"` + + Map map[string]Animal `json:"map,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_name.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_name.go new file mode 100644 index 0000000000000000000000000000000000000000..cd9a874c4190ada2520a33648d1bff4a165de54c --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_name.go @@ -0,0 +1,22 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Name - Model for testing model name same as property name +type Name struct { + + Name int32 `json:"name"` + + SnakeCase int32 `json:"snake_case,omitempty"` + + Property string `json:"property,omitempty"` + + Var123Number int32 `json:"123Number,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_number_only.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_number_only.go new file mode 100644 index 0000000000000000000000000000000000000000..ba6f4af6401538c2562ff2999f0b9b51ee1ba923 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_number_only.go @@ -0,0 +1,15 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type NumberOnly struct { + + JustNumber float32 `json:"JustNumber,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_order.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_order.go new file mode 100644 index 0000000000000000000000000000000000000000..6849a9f76d69126d74f414863af6cd1a4364cb08 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_order.go @@ -0,0 +1,30 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "time" +) + +type Order struct { + + Id int64 `json:"id,omitempty"` + + PetId int64 `json:"petId,omitempty"` + + Quantity int32 `json:"quantity,omitempty"` + + ShipDate time.Time `json:"shipDate,omitempty"` + + // Order Status + Status string `json:"status,omitempty"` + + Complete bool `json:"complete,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_outer_composite.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_outer_composite.go new file mode 100644 index 0000000000000000000000000000000000000000..7534db47c2e41a567930004faf5332c220bf830e --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_outer_composite.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type OuterComposite struct { + + MyNumber float32 `json:"my_number,omitempty"` + + MyString string `json:"my_string,omitempty"` + + MyBoolean bool `json:"my_boolean,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_outer_enum.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_outer_enum.go new file mode 100644 index 0000000000000000000000000000000000000000..d01d988ccda2109b0665cf50a717ada6db9f2439 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_outer_enum.go @@ -0,0 +1,19 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type OuterEnum string + +// List of OuterEnum +const ( + PLACED OuterEnum = "placed" + APPROVED OuterEnum = "approved" + DELIVERED OuterEnum = "delivered" +) diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_pet.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_pet.go new file mode 100644 index 0000000000000000000000000000000000000000..2271730674e2d67aacdaf6caf702a1bac332a1a4 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_pet.go @@ -0,0 +1,26 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Pet struct { + + Id int64 `json:"id,omitempty"` + + Category Category `json:"category,omitempty"` + + Name string `json:"name"` + + PhotoUrls []string `json:"photoUrls"` + + Tags []Tag `json:"tags,omitempty"` + + // pet status in the store + Status string `json:"status,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_read_only_first.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_read_only_first.go new file mode 100644 index 0000000000000000000000000000000000000000..c4192d91ee2671455c19a55637d315841f3f893f --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_read_only_first.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type ReadOnlyFirst struct { + + Bar string `json:"bar,omitempty"` + + Baz string `json:"baz,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_return.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_return.go new file mode 100644 index 0000000000000000000000000000000000000000..0ff664525de8077e69f7ade07f7c0e2083d4c463 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_return.go @@ -0,0 +1,16 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Return - Model for testing reserved words +type Return struct { + + Return int32 `json:"return,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_tag.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_tag.go new file mode 100644 index 0000000000000000000000000000000000000000..29cd4d64ae3570520fc620f384ea38045f9d53a1 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_tag.go @@ -0,0 +1,17 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type Tag struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/model_user.go b/samples/openapi3/server/petstore/go-gin-api-server/go/model_user.go new file mode 100644 index 0000000000000000000000000000000000000000..1eda4c6f763f1add4aed966489a42b2c76ed8e99 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/model_user.go @@ -0,0 +1,30 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +type User struct { + + Id int64 `json:"id,omitempty"` + + Username string `json:"username,omitempty"` + + FirstName string `json:"firstName,omitempty"` + + LastName string `json:"lastName,omitempty"` + + Email string `json:"email,omitempty"` + + Password string `json:"password,omitempty"` + + Phone string `json:"phone,omitempty"` + + // User Status + UserStatus int32 `json:"userStatus,omitempty"` +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/go/routers.go b/samples/openapi3/server/petstore/go-gin-api-server/go/routers.go new file mode 100644 index 0000000000000000000000000000000000000000..fd73305ca41a3d531eb41845f29afaae43b966a8 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/go/routers.go @@ -0,0 +1,324 @@ +/* + * 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 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + "strings" + + "github.com/gin-gonic/gin" +) + +// Route is the information for every URI. +type Route struct { + // Name is the name of this Route. + Name string + // Method is the string for the HTTP method. ex) GET, POST etc.. + Method string + // Pattern is the pattern of the URI. + Pattern string + // HandlerFunc is the handler function of this route. + HandlerFunc gin.HandlerFunc +} + +// Routes is the list of the generated Route. +type Routes []Route + +// NewRouter returns a new router. +func NewRouter() *gin.Engine { + router := gin.Default() + for _, route := range routes { + switch route.Method { + case "GET": + router.GET(route.Pattern, route.HandlerFunc) + case "POST": + router.POST(route.Pattern, route.HandlerFunc) + case "PUT": + router.PUT(route.Pattern, route.HandlerFunc) + case "DELETE": + router.DELETE(route.Pattern, route.HandlerFunc) + } + } + + return router +} + +// Index is the index handler. +func Index(c *gin.Context) { + c.String(http.StatusOK, "Hello World!") +} + +var routes = Routes{ + { + "Index", + "GET", + "/v2/", + Index, + }, + + { + "Call123TestSpecialTags", + strings.ToUpper("Patch"), + "/v2/another-fake/dummy", + Call123TestSpecialTags, + }, + + { + "FooGet", + strings.ToUpper("Get"), + "/v2/foo", + FooGet, + }, + + { + "FakeHealthGet", + strings.ToUpper("Get"), + "/v2/fake/health", + FakeHealthGet, + }, + + { + "FakeOuterBooleanSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/boolean", + FakeOuterBooleanSerialize, + }, + + { + "FakeOuterCompositeSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/composite", + FakeOuterCompositeSerialize, + }, + + { + "FakeOuterNumberSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/number", + FakeOuterNumberSerialize, + }, + + { + "FakeOuterStringSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/string", + FakeOuterStringSerialize, + }, + + { + "TestBodyWithFileSchema", + strings.ToUpper("Put"), + "/v2/fake/body-with-file-schema", + TestBodyWithFileSchema, + }, + + { + "TestBodyWithQueryParams", + strings.ToUpper("Put"), + "/v2/fake/body-with-query-params", + TestBodyWithQueryParams, + }, + + { + "TestClientModel", + strings.ToUpper("Patch"), + "/v2/fake", + TestClientModel, + }, + + { + "TestEndpointParameters", + strings.ToUpper("Post"), + "/v2/fake", + TestEndpointParameters, + }, + + { + "TestEnumParameters", + strings.ToUpper("Get"), + "/v2/fake", + TestEnumParameters, + }, + + { + "TestGroupParameters", + strings.ToUpper("Delete"), + "/v2/fake", + TestGroupParameters, + }, + + { + "TestInlineAdditionalProperties", + strings.ToUpper("Post"), + "/v2/fake/inline-additionalProperties", + TestInlineAdditionalProperties, + }, + + { + "TestJsonFormData", + strings.ToUpper("Get"), + "/v2/fake/jsonFormData", + TestJsonFormData, + }, + + { + "TestClassname", + strings.ToUpper("Patch"), + "/v2/fake_classname_test", + TestClassname, + }, + + { + "AddPet", + strings.ToUpper("Post"), + "/v2/pet", + AddPet, + }, + + { + "DeletePet", + strings.ToUpper("Delete"), + "/v2/pet/:petId", + DeletePet, + }, + + { + "FindPetsByStatus", + strings.ToUpper("Get"), + "/v2/pet/findByStatus", + FindPetsByStatus, + }, + + { + "FindPetsByTags", + strings.ToUpper("Get"), + "/v2/pet/findByTags", + FindPetsByTags, + }, + + { + "GetPetById", + strings.ToUpper("Get"), + "/v2/pet/:petId", + GetPetById, + }, + + { + "UpdatePet", + strings.ToUpper("Put"), + "/v2/pet", + UpdatePet, + }, + + { + "UpdatePetWithForm", + strings.ToUpper("Post"), + "/v2/pet/:petId", + UpdatePetWithForm, + }, + + { + "UploadFile", + strings.ToUpper("Post"), + "/v2/pet/:petId/uploadImage", + UploadFile, + }, + + { + "UploadFileWithRequiredFile", + strings.ToUpper("Post"), + "/v2/fake/:petId/uploadImageWithRequiredFile", + UploadFileWithRequiredFile, + }, + + { + "DeleteOrder", + strings.ToUpper("Delete"), + "/v2/store/order/:order_id", + DeleteOrder, + }, + + { + "GetInventory", + strings.ToUpper("Get"), + "/v2/store/inventory", + GetInventory, + }, + + { + "GetOrderById", + strings.ToUpper("Get"), + "/v2/store/order/:order_id", + GetOrderById, + }, + + { + "PlaceOrder", + strings.ToUpper("Post"), + "/v2/store/order", + PlaceOrder, + }, + + { + "CreateUser", + strings.ToUpper("Post"), + "/v2/user", + CreateUser, + }, + + { + "CreateUsersWithArrayInput", + strings.ToUpper("Post"), + "/v2/user/createWithArray", + CreateUsersWithArrayInput, + }, + + { + "CreateUsersWithListInput", + strings.ToUpper("Post"), + "/v2/user/createWithList", + CreateUsersWithListInput, + }, + + { + "DeleteUser", + strings.ToUpper("Delete"), + "/v2/user/:username", + DeleteUser, + }, + + { + "GetUserByName", + strings.ToUpper("Get"), + "/v2/user/:username", + GetUserByName, + }, + + { + "LoginUser", + strings.ToUpper("Get"), + "/v2/user/login", + LoginUser, + }, + + { + "LogoutUser", + strings.ToUpper("Get"), + "/v2/user/logout", + LogoutUser, + }, + + { + "UpdateUser", + strings.ToUpper("Put"), + "/v2/user/:username", + UpdateUser, + }, +} diff --git a/samples/openapi3/server/petstore/go-gin-api-server/main.go b/samples/openapi3/server/petstore/go-gin-api-server/main.go new file mode 100644 index 0000000000000000000000000000000000000000..ce68d62b90fed024a65c694fb411240a8b62a8a3 --- /dev/null +++ b/samples/openapi3/server/petstore/go-gin-api-server/main.go @@ -0,0 +1,31 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package main + +import ( + "log" + + // WARNING! + // Change this to a fully-qualified import path + // once you place this file into your project. + // For example, + // + // sw "github.com/myname/myrepo/go" + // + sw "./go" +) + +func main() { + log.Printf("Server started") + + router := sw.NewRouter() + + log.Fatal(router.Run(":8080")) +} diff --git a/samples/server/openapi3/petstore/python-flask-python2/.dockerignore b/samples/server/openapi3/petstore/python-flask-python2/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..f9619601908b43d5d90c9befea5aa6ef6a732fa9 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/.dockerignore @@ -0,0 +1,72 @@ +.travis.yaml +.openapi-generator-ignore +README.md +tox.ini +git_push.sh +test-requirements.txt +setup.py + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/server/openapi3/petstore/python-flask-python2/.gitignore b/samples/server/openapi3/petstore/python-flask-python2/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a655050c2631466828b5b8bfc59ae27f9ac02dc5 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/.gitignore @@ -0,0 +1,64 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/server/openapi3/petstore/python-flask-python2/.openapi-generator-ignore b/samples/server/openapi3/petstore/python-flask-python2/.openapi-generator-ignore new file mode 100644 index 0000000000000000000000000000000000000000..7484ee590a3894506cf063799b885428f95a71be --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/openapi3/petstore/python-flask-python2/.openapi-generator/VERSION b/samples/server/openapi3/petstore/python-flask-python2/.openapi-generator/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..afa6365606414bf56f925745712166af5b4a2be0 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/openapi3/petstore/python-flask-python2/.travis.yml b/samples/server/openapi3/petstore/python-flask-python2/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..86211e2d4a26c825aaff70415938fb63231952f8 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/.travis.yml @@ -0,0 +1,14 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "2.7" + - "3.2" + - "3.3" + - "3.4" + - "3.5" + #- "3.5-dev" # 3.5 development branch + #- "nightly" # points to the latest development branch e.g. 3.6-dev +# command to install dependencies +install: "pip install -r requirements.txt" +# command to run tests +script: nosetests diff --git a/samples/server/openapi3/petstore/python-flask-python2/Dockerfile b/samples/server/openapi3/petstore/python-flask-python2/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d51d2b7a856813972060feaafe96cae2840b66c1 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/Dockerfile @@ -0,0 +1,16 @@ +FROM python:2-alpine + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +COPY requirements.txt /usr/src/app/ + +RUN pip install --no-cache-dir -r requirements.txt + +COPY . /usr/src/app + +EXPOSE 8080 + +ENTRYPOINT ["python"] + +CMD ["-m", "openapi_server"] \ No newline at end of file diff --git a/samples/server/openapi3/petstore/python-flask-python2/README.md b/samples/server/openapi3/petstore/python-flask-python2/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ceebd18c340b906489178c3a1ffa04cba37564e5 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/README.md @@ -0,0 +1,49 @@ +# OpenAPI generated server + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the +[OpenAPI-Spec](https://openapis.org) from a remote server, you can easily generate a server stub. This +is an example of building a OpenAPI-enabled Flask server. + +This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask. + +## Requirements +Python 2.7+ + +## Usage +To run the server, please execute the following from the root directory: + +``` +pip install -r requirements.txt +python -m openapi_server +``` + +and open your browser to here: + +``` +http://localhost:8080/v2/ui/ +``` + +Your OpenAPI definition lives here: + +``` +http://localhost:8080/v2/openapi.json +``` + +To launch the integration tests, use tox: +``` +sudo pip install tox +tox +``` + +## Running with Docker + +To run the server on a Docker container, please execute the following from the root directory: + +```bash +# building the image +docker build -t openapi_server . + +# starting up a container +docker run -p 8080:8080 openapi_server +``` \ No newline at end of file diff --git a/samples/server/openapi3/petstore/python-flask-python2/git_push.sh b/samples/server/openapi3/petstore/python-flask-python2/git_push.sh new file mode 100644 index 0000000000000000000000000000000000000000..20057f67ade43fcf46af7bd9435fe98f20cf327a --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/__init__.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/__main__.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..22778377da12b8468c7aa7c13c3f872243da684c --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/__main__.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import connexion + +from openapi_server import encoder + + +def main(): + app = connexion.App(__name__, specification_dir='./openapi/') + app.app.json_encoder = encoder.JSONEncoder + app.add_api('openapi.yaml', arguments={'title': 'OpenAPI Petstore'}) + app.run(port=8080) + + +if __name__ == '__main__': + main() diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/__init__.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/pet_controller.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/pet_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..125820f00549afda3346a08a01ae71b4501d929e --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/pet_controller.py @@ -0,0 +1,124 @@ +import connexion +import six + +from openapi_server.models.api_response import ApiResponse # noqa: E501 +from openapi_server.models.pet import Pet # noqa: E501 +from openapi_server import util + + +def add_pet(pet): # noqa: E501 + """Add a new pet to the store + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store + :type pet: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def delete_pet(pet_id, api_key=None): # noqa: E501 + """Deletes a pet + + # noqa: E501 + + :param pet_id: Pet id to delete + :type pet_id: int + :param api_key: + :type api_key: str + + :rtype: None + """ + return 'do some magic!' + + +def find_pets_by_status(status): # noqa: E501 + """Finds Pets by status + + Multiple status values can be provided with comma separated strings # noqa: E501 + + :param status: Status values that need to be considered for filter + :type status: List[str] + + :rtype: List[Pet] + """ + return 'do some magic!' + + +def find_pets_by_tags(tags): # noqa: E501 + """Finds Pets by tags + + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 + + :param tags: Tags to filter by + :type tags: List[str] + + :rtype: List[Pet] + """ + return 'do some magic!' + + +def get_pet_by_id(pet_id): # noqa: E501 + """Find pet by ID + + Returns a single pet # noqa: E501 + + :param pet_id: ID of pet to return + :type pet_id: int + + :rtype: Pet + """ + return 'do some magic!' + + +def update_pet(pet): # noqa: E501 + """Update an existing pet + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store + :type pet: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def update_pet_with_form(pet_id, name=None, status=None): # noqa: E501 + """Updates a pet in the store with form data + + # noqa: E501 + + :param pet_id: ID of pet that needs to be updated + :type pet_id: int + :param name: Updated name of the pet + :type name: str + :param status: Updated status of the pet + :type status: str + + :rtype: None + """ + return 'do some magic!' + + +def upload_file(pet_id, additional_metadata=None, file=None): # noqa: E501 + """uploads an image + + # noqa: E501 + + :param pet_id: ID of pet to update + :type pet_id: int + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param file: file to upload + :type file: str + + :rtype: ApiResponse + """ + return 'do some magic!' diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/security_controller_.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/security_controller_.py new file mode 100644 index 0000000000000000000000000000000000000000..1db7a68f466531e077bdb27c51c3dda71961f21b --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/security_controller_.py @@ -0,0 +1,48 @@ +from typing import List + + +def info_from_api_key(api_key, required_scopes): + """ + Check and retrieve authentication information from api_key. + Returned value will be passed in 'token_info' parameter of your operation function, if there is one. + 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. + + :param api_key API key provided by Authorization header + :type api_key: str + :param required_scopes Always None. Used for other authentication method + :type required_scopes: None + :return: Information attached to provided api_key or None if api_key is invalid or does not allow access to called API + :rtype: dict | None + """ + return {'uid': 'user_id'} + + +def info_from_petstore_auth(token): + """ + Validate and decode token. + Returned value will be passed in 'token_info' parameter of your operation function, if there is one. + 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. + 'scope' or 'scopes' will be passed to scope validation function. + + :param token Token provided by Authorization header + :type token: str + :return: Decoded token information or None if token is invalid + :rtype: dict | None + """ + return {'scopes': ['read:pets', 'write:pets'], 'uid': 'user_id'} + + +def validate_scope_petstore_auth(required_scopes, token_scopes): + """ + Validate required scopes are included in token scope + + :param required_scopes Required scope to access called API + :type required_scopes: List[str] + :param token_scopes Scope present in token + :type token_scopes: List[str] + :return: True if access to called API is allowed + :rtype: bool + """ + return set(required_scopes).issubset(set(token_scopes)) + + diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/store_controller.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/store_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..3d16d99859e7f23770ef5d178fc6244e9f23dc90 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/store_controller.py @@ -0,0 +1,57 @@ +import connexion +import six + +from openapi_server.models.order import Order # noqa: E501 +from openapi_server import util + + +def delete_order(order_id): # noqa: E501 + """Delete purchase order by ID + + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501 + + :param order_id: ID of the order that needs to be deleted + :type order_id: str + + :rtype: None + """ + return 'do some magic!' + + +def get_inventory(): # noqa: E501 + """Returns pet inventories by status + + Returns a map of status codes to quantities # noqa: E501 + + + :rtype: Dict[str, int] + """ + return 'do some magic!' + + +def get_order_by_id(order_id): # noqa: E501 + """Find purchase order by ID + + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501 + + :param order_id: ID of pet that needs to be fetched + :type order_id: int + + :rtype: Order + """ + return 'do some magic!' + + +def place_order(order): # noqa: E501 + """Place an order for a pet + + # noqa: E501 + + :param order: order placed for purchasing the pet + :type order: dict | bytes + + :rtype: Order + """ + if connexion.request.is_json: + order = Order.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/user_controller.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/user_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..9b9706262121761ae9eaf386750a1fee930942be --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/controllers/user_controller.py @@ -0,0 +1,119 @@ +import connexion +import six + +from openapi_server.models.user import User # noqa: E501 +from openapi_server import util + + +def create_user(user): # noqa: E501 + """Create user + + This can only be done by the logged in user. # noqa: E501 + + :param user: Created user object + :type user: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = User.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def create_users_with_array_input(user): # noqa: E501 + """Creates list of users with given input array + + # noqa: E501 + + :param user: List of user object + :type user: list | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 + return 'do some magic!' + + +def create_users_with_list_input(user): # noqa: E501 + """Creates list of users with given input array + + # noqa: E501 + + :param user: List of user object + :type user: list | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 + return 'do some magic!' + + +def delete_user(username): # noqa: E501 + """Delete user + + This can only be done by the logged in user. # noqa: E501 + + :param username: The name that needs to be deleted + :type username: str + + :rtype: None + """ + return 'do some magic!' + + +def get_user_by_name(username): # noqa: E501 + """Get user by user name + + # noqa: E501 + + :param username: The name that needs to be fetched. Use user1 for testing. + :type username: str + + :rtype: User + """ + return 'do some magic!' + + +def login_user(username, password): # noqa: E501 + """Logs user into the system + + # noqa: E501 + + :param username: The user name for login + :type username: str + :param password: The password for login in clear text + :type password: str + + :rtype: str + """ + return 'do some magic!' + + +def logout_user(): # noqa: E501 + """Logs out current logged in user session + + # noqa: E501 + + + :rtype: None + """ + return 'do some magic!' + + +def update_user(username, user): # noqa: E501 + """Updated user + + This can only be done by the logged in user. # noqa: E501 + + :param username: name that need to be deleted + :type username: str + :param user: Updated user object + :type user: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = User.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/encoder.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..3bbef854f3b83dc985aea885756fd7147fa00001 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/encoder.py @@ -0,0 +1,20 @@ +from connexion.apps.flask_app import FlaskJSONEncoder +import six + +from openapi_server.models.base_model_ import Model + + +class JSONEncoder(FlaskJSONEncoder): + include_nulls = False + + def default(self, o): + if isinstance(o, Model): + dikt = {} + for attr, _ in six.iteritems(o.openapi_types): + value = getattr(o, attr) + if value is None and not self.include_nulls: + continue + attr = o.attribute_map[attr] + dikt[attr] = value + return dikt + return FlaskJSONEncoder.default(self, o) diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/__init__.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..689233630d14ba2f934adb8cb408afafe4bff5d6 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/__init__.py @@ -0,0 +1,13 @@ +# coding: utf-8 + +# flake8: noqa +from __future__ import absolute_import +# import models into model package +from openapi_server.models.api_response import ApiResponse +from openapi_server.models.category import Category +from openapi_server.models.inline_object import InlineObject +from openapi_server.models.inline_object1 import InlineObject1 +from openapi_server.models.order import Order +from openapi_server.models.pet import Pet +from openapi_server.models.tag import Tag +from openapi_server.models.user import User diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/api_response.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/api_response.py new file mode 100644 index 0000000000000000000000000000000000000000..f4f26e834a277b2c752391f27c8152eb7654deb6 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/api_response.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class ApiResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, code=None, type=None, message=None): # noqa: E501 + """ApiResponse - a model defined in OpenAPI + + :param code: The code of this ApiResponse. # noqa: E501 + :type code: int + :param type: The type of this ApiResponse. # noqa: E501 + :type type: str + :param message: The message of this ApiResponse. # noqa: E501 + :type message: str + """ + self.openapi_types = { + 'code': int, + 'type': str, + 'message': str + } + + self.attribute_map = { + 'code': 'code', + 'type': 'type', + 'message': 'message' + } + + self._code = code + self._type = type + self._message = message + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The ApiResponse of this ApiResponse. # noqa: E501 + :rtype: ApiResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def code(self): + """Gets the code of this ApiResponse. + + + :return: The code of this ApiResponse. + :rtype: int + """ + return self._code + + @code.setter + def code(self, code): + """Sets the code of this ApiResponse. + + + :param code: The code of this ApiResponse. + :type code: int + """ + + self._code = code + + @property + def type(self): + """Gets the type of this ApiResponse. + + + :return: The type of this ApiResponse. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ApiResponse. + + + :param type: The type of this ApiResponse. + :type type: str + """ + + self._type = type + + @property + def message(self): + """Gets the message of this ApiResponse. + + + :return: The message of this ApiResponse. + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ApiResponse. + + + :param message: The message of this ApiResponse. + :type message: str + """ + + self._message = message diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/base_model_.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/base_model_.py new file mode 100644 index 0000000000000000000000000000000000000000..2f7f96c14e478a1a4424db2ff395f30f88e832bf --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/base_model_.py @@ -0,0 +1,66 @@ +import pprint + +import six + +from openapi_server import util + + +class Model(object): + # openapiTypes: The key is attribute name and the + # value is attribute type. + openapi_types = {} + + # attributeMap: The key is attribute name and the + # value is json key in definition. + attribute_map = {} + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model""" + return util.deserialize_model(dikt, cls) + + def to_dict(self): + """Returns the model properties as a dict + + :rtype: dict + """ + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model + + :rtype: str + """ + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/category.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/category.py new file mode 100644 index 0000000000000000000000000000000000000000..fc2b224078a34d315e050598c10395d2039b9c89 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/category.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class Category(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, name=None): # noqa: E501 + """Category - a model defined in OpenAPI + + :param id: The id of this Category. # noqa: E501 + :type id: long + :param name: The name of this Category. # noqa: E501 + :type name: str + """ + self.openapi_types = { + 'id': long, + 'name': str + } + + self.attribute_map = { + 'id': 'id', + 'name': 'name' + } + + self._id = id + self._name = name + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Category of this Category. # noqa: E501 + :rtype: Category + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Category. + + + :return: The id of this Category. + :rtype: long + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Category. + + + :param id: The id of this Category. + :type id: long + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Category. + + + :return: The name of this Category. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Category. + + + :param name: The name of this Category. + :type name: str + """ + + self._name = name diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/inline_object.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/inline_object.py new file mode 100644 index 0000000000000000000000000000000000000000..f8fe9cb4af8fba7df1edc11b86f41bb186af0bde --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/inline_object.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class InlineObject(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, status=None): # noqa: E501 + """InlineObject - a model defined in OpenAPI + + :param name: The name of this InlineObject. # noqa: E501 + :type name: str + :param status: The status of this InlineObject. # noqa: E501 + :type status: str + """ + self.openapi_types = { + 'name': str, + 'status': str + } + + self.attribute_map = { + 'name': 'name', + 'status': 'status' + } + + self._name = name + self._status = status + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The inline_object of this InlineObject. # noqa: E501 + :rtype: InlineObject + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self): + """Gets the name of this InlineObject. + + Updated name of the pet # noqa: E501 + + :return: The name of this InlineObject. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this InlineObject. + + Updated name of the pet # noqa: E501 + + :param name: The name of this InlineObject. + :type name: str + """ + + self._name = name + + @property + def status(self): + """Gets the status of this InlineObject. + + Updated status of the pet # noqa: E501 + + :return: The status of this InlineObject. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this InlineObject. + + Updated status of the pet # noqa: E501 + + :param status: The status of this InlineObject. + :type status: str + """ + + self._status = status diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/inline_object1.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/inline_object1.py new file mode 100644 index 0000000000000000000000000000000000000000..a3517cf579821589971d60579b0e39857735c3ed --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/inline_object1.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class InlineObject1(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, additional_metadata=None, file=None): # noqa: E501 + """InlineObject1 - a model defined in OpenAPI + + :param additional_metadata: The additional_metadata of this InlineObject1. # noqa: E501 + :type additional_metadata: str + :param file: The file of this InlineObject1. # noqa: E501 + :type file: file + """ + self.openapi_types = { + 'additional_metadata': str, + 'file': file + } + + self.attribute_map = { + 'additional_metadata': 'additionalMetadata', + 'file': 'file' + } + + self._additional_metadata = additional_metadata + self._file = file + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The inline_object_1 of this InlineObject1. # noqa: E501 + :rtype: InlineObject1 + """ + return util.deserialize_model(dikt, cls) + + @property + def additional_metadata(self): + """Gets the additional_metadata of this InlineObject1. + + Additional data to pass to server # noqa: E501 + + :return: The additional_metadata of this InlineObject1. + :rtype: str + """ + return self._additional_metadata + + @additional_metadata.setter + def additional_metadata(self, additional_metadata): + """Sets the additional_metadata of this InlineObject1. + + Additional data to pass to server # noqa: E501 + + :param additional_metadata: The additional_metadata of this InlineObject1. + :type additional_metadata: str + """ + + self._additional_metadata = additional_metadata + + @property + def file(self): + """Gets the file of this InlineObject1. + + file to upload # noqa: E501 + + :return: The file of this InlineObject1. + :rtype: file + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this InlineObject1. + + file to upload # noqa: E501 + + :param file: The file of this InlineObject1. + :type file: file + """ + + self._file = file diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/order.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/order.py new file mode 100644 index 0000000000000000000000000000000000000000..02ea8c4fd7287619b17f5e745238180655cbd7b7 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/order.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class Order(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501 + """Order - a model defined in OpenAPI + + :param id: The id of this Order. # noqa: E501 + :type id: long + :param pet_id: The pet_id of this Order. # noqa: E501 + :type pet_id: long + :param quantity: The quantity of this Order. # noqa: E501 + :type quantity: int + :param ship_date: The ship_date of this Order. # noqa: E501 + :type ship_date: datetime + :param status: The status of this Order. # noqa: E501 + :type status: str + :param complete: The complete of this Order. # noqa: E501 + :type complete: bool + """ + self.openapi_types = { + 'id': long, + 'pet_id': long, + 'quantity': int, + 'ship_date': datetime, + 'status': str, + 'complete': bool + } + + self.attribute_map = { + 'id': 'id', + 'pet_id': 'petId', + 'quantity': 'quantity', + 'ship_date': 'shipDate', + 'status': 'status', + 'complete': 'complete' + } + + self._id = id + self._pet_id = pet_id + self._quantity = quantity + self._ship_date = ship_date + self._status = status + self._complete = complete + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Order of this Order. # noqa: E501 + :rtype: Order + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Order. + + + :return: The id of this Order. + :rtype: long + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Order. + + + :param id: The id of this Order. + :type id: long + """ + + self._id = id + + @property + def pet_id(self): + """Gets the pet_id of this Order. + + + :return: The pet_id of this Order. + :rtype: long + """ + return self._pet_id + + @pet_id.setter + def pet_id(self, pet_id): + """Sets the pet_id of this Order. + + + :param pet_id: The pet_id of this Order. + :type pet_id: long + """ + + self._pet_id = pet_id + + @property + def quantity(self): + """Gets the quantity of this Order. + + + :return: The quantity of this Order. + :rtype: int + """ + return self._quantity + + @quantity.setter + def quantity(self, quantity): + """Sets the quantity of this Order. + + + :param quantity: The quantity of this Order. + :type quantity: int + """ + + self._quantity = quantity + + @property + def ship_date(self): + """Gets the ship_date of this Order. + + + :return: The ship_date of this Order. + :rtype: datetime + """ + return self._ship_date + + @ship_date.setter + def ship_date(self, ship_date): + """Sets the ship_date of this Order. + + + :param ship_date: The ship_date of this Order. + :type ship_date: datetime + """ + + self._ship_date = ship_date + + @property + def status(self): + """Gets the status of this Order. + + Order Status # noqa: E501 + + :return: The status of this Order. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Order. + + Order Status # noqa: E501 + + :param status: The status of this Order. + :type status: str + """ + allowed_values = ["placed", "approved", "delivered"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status + + @property + def complete(self): + """Gets the complete of this Order. + + + :return: The complete of this Order. + :rtype: bool + """ + return self._complete + + @complete.setter + def complete(self, complete): + """Sets the complete of this Order. + + + :param complete: The complete of this Order. + :type complete: bool + """ + + self._complete = complete diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/pet.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/pet.py new file mode 100644 index 0000000000000000000000000000000000000000..a9c5e52330fcefed3938b69b50d32ea5daed632d --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/pet.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server.models.category import Category +from openapi_server.models.tag import Tag +from openapi_server import util + +from openapi_server.models.category import Category # noqa: E501 +from openapi_server.models.tag import Tag # noqa: E501 + +class Pet(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501 + """Pet - a model defined in OpenAPI + + :param id: The id of this Pet. # noqa: E501 + :type id: long + :param category: The category of this Pet. # noqa: E501 + :type category: Category + :param name: The name of this Pet. # noqa: E501 + :type name: str + :param photo_urls: The photo_urls of this Pet. # noqa: E501 + :type photo_urls: List[str] + :param tags: The tags of this Pet. # noqa: E501 + :type tags: List[Tag] + :param status: The status of this Pet. # noqa: E501 + :type status: str + """ + self.openapi_types = { + 'id': long, + 'category': Category, + 'name': str, + 'photo_urls': List[str], + 'tags': List[Tag], + 'status': str + } + + self.attribute_map = { + 'id': 'id', + 'category': 'category', + 'name': 'name', + 'photo_urls': 'photoUrls', + 'tags': 'tags', + 'status': 'status' + } + + self._id = id + self._category = category + self._name = name + self._photo_urls = photo_urls + self._tags = tags + self._status = status + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Pet of this Pet. # noqa: E501 + :rtype: Pet + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Pet. + + + :return: The id of this Pet. + :rtype: long + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Pet. + + + :param id: The id of this Pet. + :type id: long + """ + + self._id = id + + @property + def category(self): + """Gets the category of this Pet. + + + :return: The category of this Pet. + :rtype: Category + """ + return self._category + + @category.setter + def category(self, category): + """Sets the category of this Pet. + + + :param category: The category of this Pet. + :type category: Category + """ + + self._category = category + + @property + def name(self): + """Gets the name of this Pet. + + + :return: The name of this Pet. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Pet. + + + :param name: The name of this Pet. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def photo_urls(self): + """Gets the photo_urls of this Pet. + + + :return: The photo_urls of this Pet. + :rtype: List[str] + """ + return self._photo_urls + + @photo_urls.setter + def photo_urls(self, photo_urls): + """Sets the photo_urls of this Pet. + + + :param photo_urls: The photo_urls of this Pet. + :type photo_urls: List[str] + """ + if photo_urls is None: + raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501 + + self._photo_urls = photo_urls + + @property + def tags(self): + """Gets the tags of this Pet. + + + :return: The tags of this Pet. + :rtype: List[Tag] + """ + return self._tags + + @tags.setter + def tags(self, tags): + """Sets the tags of this Pet. + + + :param tags: The tags of this Pet. + :type tags: List[Tag] + """ + + self._tags = tags + + @property + def status(self): + """Gets the status of this Pet. + + pet status in the store # noqa: E501 + + :return: The status of this Pet. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Pet. + + pet status in the store # noqa: E501 + + :param status: The status of this Pet. + :type status: str + """ + allowed_values = ["available", "pending", "sold"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/tag.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/tag.py new file mode 100644 index 0000000000000000000000000000000000000000..24a262951ed93ba0187f3519309593dcc0dc71c7 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/tag.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class Tag(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, name=None): # noqa: E501 + """Tag - a model defined in OpenAPI + + :param id: The id of this Tag. # noqa: E501 + :type id: long + :param name: The name of this Tag. # noqa: E501 + :type name: str + """ + self.openapi_types = { + 'id': long, + 'name': str + } + + self.attribute_map = { + 'id': 'id', + 'name': 'name' + } + + self._id = id + self._name = name + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Tag of this Tag. # noqa: E501 + :rtype: Tag + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Tag. + + + :return: The id of this Tag. + :rtype: long + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Tag. + + + :param id: The id of this Tag. + :type id: long + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Tag. + + + :return: The name of this Tag. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Tag. + + + :param name: The name of this Tag. + :type name: str + """ + + self._name = name diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/user.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/user.py new file mode 100644 index 0000000000000000000000000000000000000000..3807bfe997821e15923de0f55064e24d5938f419 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/models/user.py @@ -0,0 +1,248 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class User(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501 + """User - a model defined in OpenAPI + + :param id: The id of this User. # noqa: E501 + :type id: long + :param username: The username of this User. # noqa: E501 + :type username: str + :param first_name: The first_name of this User. # noqa: E501 + :type first_name: str + :param last_name: The last_name of this User. # noqa: E501 + :type last_name: str + :param email: The email of this User. # noqa: E501 + :type email: str + :param password: The password of this User. # noqa: E501 + :type password: str + :param phone: The phone of this User. # noqa: E501 + :type phone: str + :param user_status: The user_status of this User. # noqa: E501 + :type user_status: int + """ + self.openapi_types = { + 'id': long, + 'username': str, + 'first_name': str, + 'last_name': str, + 'email': str, + 'password': str, + 'phone': str, + 'user_status': int + } + + self.attribute_map = { + 'id': 'id', + 'username': 'username', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'email': 'email', + 'password': 'password', + 'phone': 'phone', + 'user_status': 'userStatus' + } + + self._id = id + self._username = username + self._first_name = first_name + self._last_name = last_name + self._email = email + self._password = password + self._phone = phone + self._user_status = user_status + + @classmethod + def from_dict(cls, dikt): + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The User of this User. # noqa: E501 + :rtype: User + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this User. + + + :return: The id of this User. + :rtype: long + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + + :param id: The id of this User. + :type id: long + """ + + self._id = id + + @property + def username(self): + """Gets the username of this User. + + + :return: The username of this User. + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this User. + + + :param username: The username of this User. + :type username: str + """ + + self._username = username + + @property + def first_name(self): + """Gets the first_name of this User. + + + :return: The first_name of this User. + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + + :param first_name: The first_name of this User. + :type first_name: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. + + + :return: The last_name of this User. + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + + :param last_name: The last_name of this User. + :type last_name: str + """ + + self._last_name = last_name + + @property + def email(self): + """Gets the email of this User. + + + :return: The email of this User. + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this User. + + + :param email: The email of this User. + :type email: str + """ + + self._email = email + + @property + def password(self): + """Gets the password of this User. + + + :return: The password of this User. + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this User. + + + :param password: The password of this User. + :type password: str + """ + + self._password = password + + @property + def phone(self): + """Gets the phone of this User. + + + :return: The phone of this User. + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this User. + + + :param phone: The phone of this User. + :type phone: str + """ + + self._phone = phone + + @property + def user_status(self): + """Gets the user_status of this User. + + User Status # noqa: E501 + + :return: The user_status of this User. + :rtype: int + """ + return self._user_status + + @user_status.setter + def user_status(self, user_status): + """Sets the user_status of this User. + + User Status # noqa: E501 + + :param user_status: The user_status of this User. + :type user_status: int + """ + + self._user_status = user_status diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/openapi/openapi.yaml b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/openapi/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..19e24c5964588144f1549e2f4dc5b9b6cf953b03 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/openapi/openapi.yaml @@ -0,0 +1,803 @@ +openapi: 3.0.0 +info: + description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: add_pet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + put: + operationId: update_pet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 400: + description: Invalid ID supplied + 404: + description: Pet not found + 405: + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: find_pets_by_status + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: find_pets_by_tags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{pet_id}: + delete: + operationId: delete_pet + 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: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 400: + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + get: + description: Returns a single pet + operationId: get_pet_by_id + parameters: + - description: ID of pet to return + explode: false + in: path + name: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + post: + operationId: update_pet_with_form + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{pet_id}/uploadImage: + post: + operationId: upload_file + parameters: + - description: ID of pet to update + explode: false + in: path + name: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: get_inventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /store/order: + post: + operationId: place_order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: delete_order + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: get_order_by_id + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /user: + post: + description: This can only be done by the logged in user. + operationId: create_user + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/createWithArray: + post: + operationId: create_users_with_array_input + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/createWithList: + post: + operationId: create_users_with_list_input + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/login: + get: + operationId: login_user + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when toekn expires + explode: false + schema: + format: date-time + type: string + style: simple + 400: + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/logout: + get: + operationId: logout_user + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: delete_user + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Delete user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + get: + operationId: get_user_by_name + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Get user by user name + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + put: + description: This can only be done by the logged in user. + operationId: update_user + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + description: Invalid user supplied + 404: + description: User not found + summary: Updated user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + schemas: + Order: + description: An order for a pets from the pet store + 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 + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + 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: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + 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 + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + x-tokenInfoFunc: openapi_server.controllers.security_controller_.info_from_petstore_auth + x-scopeValidateFunc: openapi_server.controllers.security_controller_.validate_scope_petstore_auth + api_key: + in: header + name: api_key + type: apiKey + x-apikeyInfoFunc: openapi_server.controllers.security_controller_.info_from_api_key diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/__init__.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cf6b70fce26b20861d0b1bc2ffe9dc3306709abe --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/__init__.py @@ -0,0 +1,16 @@ +import logging + +import connexion +from flask_testing import TestCase + +from openapi_server.encoder import JSONEncoder + + +class BaseTestCase(TestCase): + + def create_app(self): + logging.getLogger('connexion.operation').setLevel('ERROR') + app = connexion.App(__name__, specification_dir='../openapi/') + app.app.json_encoder = JSONEncoder + app.add_api('openapi.yaml') + return app.app diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_pet_controller.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_pet_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..230ac4a4b6074922d7f234b14a7182208fa93e6d --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_pet_controller.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +from __future__ import absolute_import +import unittest + +from flask import json +from six import BytesIO + +from openapi_server.models.api_response import ApiResponse # noqa: E501 +from openapi_server.models.pet import Pet # noqa: E501 +from openapi_server.test import BaseTestCase + + +class TestPetController(BaseTestCase): + """PetController integration test stubs""" + + @unittest.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760") + def test_add_pet(self): + """Test case for add_pet + + Add a new pet to the store + """ + pet = { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" +} + headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet', + method='POST', + headers=headers, + data=json.dumps(pet), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_delete_pet(self): + """Test case for delete_pet + + Deletes a pet + """ + headers = { + 'api_key': 'api_key_example', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet/{pet_id}'.format(pet_id=789), + method='DELETE', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_find_pets_by_status(self): + """Test case for find_pets_by_status + + Finds Pets by status + """ + query_string = [('status', 'available')] + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet/findByStatus', + method='GET', + headers=headers, + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_find_pets_by_tags(self): + """Test case for find_pets_by_tags + + Finds Pets by tags + """ + query_string = [('tags', 'tags_example')] + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet/findByTags', + method='GET', + headers=headers, + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_pet_by_id(self): + """Test case for get_pet_by_id + + Find pet by ID + """ + headers = { + 'Accept': 'application/json', + 'api_key': 'special-key', + } + response = self.client.open( + '/v2/pet/{pet_id}'.format(pet_id=789), + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + @unittest.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760") + def test_update_pet(self): + """Test case for update_pet + + Update an existing pet + """ + pet = { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" +} + headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet', + method='PUT', + headers=headers, + data=json.dumps(pet), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + @unittest.skip("application/x-www-form-urlencoded not supported by Connexion") + def test_update_pet_with_form(self): + """Test case for update_pet_with_form + + Updates a pet in the store with form data + """ + headers = { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Authorization': 'Bearer special-key', + } + data = dict(name='name_example', + status='status_example') + response = self.client.open( + '/v2/pet/{pet_id}'.format(pet_id=789), + method='POST', + headers=headers, + data=data, + content_type='application/x-www-form-urlencoded') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + @unittest.skip("multipart/form-data not supported by Connexion") + def test_upload_file(self): + """Test case for upload_file + + uploads an image + """ + headers = { + 'Accept': 'application/json', + 'Content-Type': 'multipart/form-data', + 'Authorization': 'Bearer special-key', + } + data = dict(additional_metadata='additional_metadata_example', + file=(BytesIO(b'some file data'), 'file.txt')) + response = self.client.open( + '/v2/pet/{pet_id}/uploadImage'.format(pet_id=789), + method='POST', + headers=headers, + data=data, + content_type='multipart/form-data') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_store_controller.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_store_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..e232ef3aad488b2e9cbc859aa321a0eb3415a578 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_store_controller.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +from __future__ import absolute_import +import unittest + +from flask import json +from six import BytesIO + +from openapi_server.models.order import Order # noqa: E501 +from openapi_server.test import BaseTestCase + + +class TestStoreController(BaseTestCase): + """StoreController integration test stubs""" + + def test_delete_order(self): + """Test case for delete_order + + Delete purchase order by ID + """ + headers = { + } + response = self.client.open( + '/v2/store/order/{order_id}'.format(order_id='order_id_example'), + method='DELETE', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_inventory(self): + """Test case for get_inventory + + Returns pet inventories by status + """ + headers = { + 'Accept': 'application/json', + 'api_key': 'special-key', + } + response = self.client.open( + '/v2/store/inventory', + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_order_by_id(self): + """Test case for get_order_by_id + + Find purchase order by ID + """ + headers = { + 'Accept': 'application/json', + } + response = self.client.open( + '/v2/store/order/{order_id}'.format(order_id=5), + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_place_order(self): + """Test case for place_order + + Place an order for a pet + """ + order = { + "petId" : 6, + "quantity" : 1, + "id" : 0, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : false, + "status" : "placed" +} + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/store/order', + method='POST', + headers=headers, + data=json.dumps(order), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_user_controller.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_user_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..c71f332d0de21e46a4eb267fce361495de94bca1 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/test/test_user_controller.py @@ -0,0 +1,169 @@ +# coding: utf-8 + +from __future__ import absolute_import +import unittest + +from flask import json +from six import BytesIO + +from openapi_server.models.user import User # noqa: E501 +from openapi_server.test import BaseTestCase + + +class TestUserController(BaseTestCase): + """UserController integration test stubs""" + + def test_create_user(self): + """Test case for create_user + + Create user + """ + user = { + "firstName" : "firstName", + "lastName" : "lastName", + "password" : "password", + "userStatus" : 6, + "phone" : "phone", + "id" : 0, + "email" : "email", + "username" : "username" +} + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user', + method='POST', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_create_users_with_array_input(self): + """Test case for create_users_with_array_input + + Creates list of users with given input array + """ + user = [] + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user/createWithArray', + method='POST', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_create_users_with_list_input(self): + """Test case for create_users_with_list_input + + Creates list of users with given input array + """ + user = [] + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user/createWithList', + method='POST', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_delete_user(self): + """Test case for delete_user + + Delete user + """ + headers = { + } + response = self.client.open( + '/v2/user/{username}'.format(username='username_example'), + method='DELETE', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_user_by_name(self): + """Test case for get_user_by_name + + Get user by user name + """ + headers = { + 'Accept': 'application/json', + } + response = self.client.open( + '/v2/user/{username}'.format(username='username_example'), + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_login_user(self): + """Test case for login_user + + Logs user into the system + """ + query_string = [('username', 'username_example'), + ('password', 'password_example')] + headers = { + 'Accept': 'application/json', + } + response = self.client.open( + '/v2/user/login', + method='GET', + headers=headers, + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_logout_user(self): + """Test case for logout_user + + Logs out current logged in user session + """ + headers = { + } + response = self.client.open( + '/v2/user/logout', + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_update_user(self): + """Test case for update_user + + Updated user + """ + user = { + "firstName" : "firstName", + "lastName" : "lastName", + "password" : "password", + "userStatus" : 6, + "phone" : "phone", + "id" : 0, + "email" : "email", + "username" : "username" +} + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user/{username}'.format(username='username_example'), + method='PUT', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/server/openapi3/petstore/python-flask-python2/openapi_server/util.py b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/util.py new file mode 100644 index 0000000000000000000000000000000000000000..c7340cd000598f16e12d04e0f1824040d91f7459 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/openapi_server/util.py @@ -0,0 +1,141 @@ +import datetime + +import six +import typing + + +def _deserialize(data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if klass in six.integer_types or klass in (float, str, bool): + return _deserialize_primitive(data, klass) + elif klass == object: + return _deserialize_object(data) + elif klass == datetime.date: + return deserialize_date(data) + elif klass == datetime.datetime: + return deserialize_datetime(data) + elif type(klass) == typing.GenericMeta: + if klass.__extra__ == list: + return _deserialize_list(data, klass.__args__[0]) + if klass.__extra__ == dict: + return _deserialize_dict(data, klass.__args__[1]) + else: + return deserialize_model(data, klass) + + +def _deserialize_primitive(data, klass): + """Deserializes to primitive type. + + :param data: data to deserialize. + :param klass: class literal. + + :return: int, long, float, str, bool. + :rtype: int | long | float | str | bool + """ + try: + value = klass(data) + except UnicodeEncodeError: + value = six.u(data) + except TypeError: + value = data + return value + + +def _deserialize_object(value): + """Return an original value. + + :return: object. + """ + return value + + +def deserialize_date(string): + """Deserializes string to date. + + :param string: str. + :type string: str + :return: date. + :rtype: date + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + + +def deserialize_datetime(string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :type string: str + :return: datetime. + :rtype: datetime + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + + +def deserialize_model(data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :type data: dict | list + :param klass: class literal. + :return: model object. + """ + instance = klass() + + if not instance.openapi_types: + return data + + for attr, attr_type in six.iteritems(instance.openapi_types): + if data is not None \ + and instance.attribute_map[attr] in data \ + and isinstance(data, (list, dict)): + value = data[instance.attribute_map[attr]] + setattr(instance, attr, _deserialize(value, attr_type)) + + return instance + + +def _deserialize_list(data, boxed_type): + """Deserializes a list and its elements. + + :param data: list to deserialize. + :type data: list + :param boxed_type: class literal. + + :return: deserialized list. + :rtype: list + """ + return [_deserialize(sub_data, boxed_type) + for sub_data in data] + + +def _deserialize_dict(data, boxed_type): + """Deserializes a dict and its elements. + + :param data: dict to deserialize. + :type data: dict + :param boxed_type: class literal. + + :return: deserialized dict. + :rtype: dict + """ + return {k: _deserialize(v, boxed_type) + for k, v in six.iteritems(data)} diff --git a/samples/server/openapi3/petstore/python-flask-python2/requirements.txt b/samples/server/openapi3/petstore/python-flask-python2/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..de4b8821af6b9c5869db01fe2697e6794cf6fbe0 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/requirements.txt @@ -0,0 +1,5 @@ +connexion == 2.0.2 +swagger-ui-bundle == 0.0.2 +python_dateutil == 2.6.0 +typing == 3.5.2.2 +setuptools >= 21.0.0 diff --git a/samples/server/openapi3/petstore/python-flask-python2/setup.py b/samples/server/openapi3/petstore/python-flask-python2/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..e18faf930bc5eb524d630172add2626156896d15 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/setup.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +import sys +from setuptools import setup, find_packages + +NAME = "openapi_server" +VERSION = "1.0.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = [ + "connexion==2.0.0", + "swagger-ui-bundle==0.0.2", + "python_dateutil==2.6.0", + "typing==3.5.2.2" +] + +setup( + name=NAME, + version=VERSION, + description="OpenAPI Petstore", + author_email="", + url="", + keywords=["OpenAPI", "OpenAPI Petstore"], + install_requires=REQUIRES, + packages=find_packages(), + package_data={'': ['openapi/openapi.yaml']}, + include_package_data=True, + entry_points={ + 'console_scripts': ['openapi_server=openapi_server.__main__:main']}, + long_description="""\ + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + """ +) + diff --git a/samples/server/openapi3/petstore/python-flask-python2/test-requirements.txt b/samples/server/openapi3/petstore/python-flask-python2/test-requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8d96e6b40e853d658f88fa745ddcf37ff7644c --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/test-requirements.txt @@ -0,0 +1,6 @@ +flask_testing==0.6.1 +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13 diff --git a/samples/server/openapi3/petstore/python-flask-python2/tox.ini b/samples/server/openapi3/petstore/python-flask-python2/tox.ini new file mode 100644 index 0000000000000000000000000000000000000000..26985414c882b56ef2dedccd70b435c10a6f86f9 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask-python2/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py27, py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + nosetests \ + [] \ No newline at end of file diff --git a/samples/server/openapi3/petstore/python-flask/.dockerignore b/samples/server/openapi3/petstore/python-flask/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..f9619601908b43d5d90c9befea5aa6ef6a732fa9 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/.dockerignore @@ -0,0 +1,72 @@ +.travis.yaml +.openapi-generator-ignore +README.md +tox.ini +git_push.sh +test-requirements.txt +setup.py + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/server/openapi3/petstore/python-flask/.gitignore b/samples/server/openapi3/petstore/python-flask/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a655050c2631466828b5b8bfc59ae27f9ac02dc5 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/.gitignore @@ -0,0 +1,64 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/server/openapi3/petstore/python-flask/.openapi-generator-ignore b/samples/server/openapi3/petstore/python-flask/.openapi-generator-ignore new file mode 100644 index 0000000000000000000000000000000000000000..7484ee590a3894506cf063799b885428f95a71be --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/openapi3/petstore/python-flask/.openapi-generator/VERSION b/samples/server/openapi3/petstore/python-flask/.openapi-generator/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..afa6365606414bf56f925745712166af5b4a2be0 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/openapi3/petstore/python-flask/.travis.yml b/samples/server/openapi3/petstore/python-flask/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..dd6c4450aa902ae68479c3d76d45145e18d6052e --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/.travis.yml @@ -0,0 +1,13 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.2" + - "3.3" + - "3.4" + - "3.5" + #- "3.5-dev" # 3.5 development branch + #- "nightly" # points to the latest development branch e.g. 3.6-dev +# command to install dependencies +install: "pip install -r requirements.txt" +# command to run tests +script: nosetests diff --git a/samples/server/openapi3/petstore/python-flask/Dockerfile b/samples/server/openapi3/petstore/python-flask/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4857637c3799f904ed177ef39c030be1b90d556d --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3-alpine + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +COPY requirements.txt /usr/src/app/ + +RUN pip3 install --no-cache-dir -r requirements.txt + +COPY . /usr/src/app + +EXPOSE 8080 + +ENTRYPOINT ["python3"] + +CMD ["-m", "openapi_server"] \ No newline at end of file diff --git a/samples/server/openapi3/petstore/python-flask/README.md b/samples/server/openapi3/petstore/python-flask/README.md new file mode 100644 index 0000000000000000000000000000000000000000..673c8b3b5a01375d7af47977e5a32dc16f64e879 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/README.md @@ -0,0 +1,49 @@ +# OpenAPI generated server + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the +[OpenAPI-Spec](https://openapis.org) from a remote server, you can easily generate a server stub. This +is an example of building a OpenAPI-enabled Flask server. + +This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask. + +## Requirements +Python 3.5.2+ + +## Usage +To run the server, please execute the following from the root directory: + +``` +pip3 install -r requirements.txt +python3 -m openapi_server +``` + +and open your browser to here: + +``` +http://localhost:8080/v2/ui/ +``` + +Your OpenAPI definition lives here: + +``` +http://localhost:8080/v2/openapi.json +``` + +To launch the integration tests, use tox: +``` +sudo pip install tox +tox +``` + +## Running with Docker + +To run the server on a Docker container, please execute the following from the root directory: + +```bash +# building the image +docker build -t openapi_server . + +# starting up a container +docker run -p 8080:8080 openapi_server +``` \ No newline at end of file diff --git a/samples/server/openapi3/petstore/python-flask/git_push.sh b/samples/server/openapi3/petstore/python-flask/git_push.sh new file mode 100644 index 0000000000000000000000000000000000000000..20057f67ade43fcf46af7bd9435fe98f20cf327a --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/__init__.py b/samples/server/openapi3/petstore/python-flask/openapi_server/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/__main__.py b/samples/server/openapi3/petstore/python-flask/openapi_server/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..cd039f104929dc54726f1411a3a11f2bdb0cd8d6 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/__main__.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import connexion + +from openapi_server import encoder + + +def main(): + app = connexion.App(__name__, specification_dir='./openapi/') + app.app.json_encoder = encoder.JSONEncoder + app.add_api('openapi.yaml', arguments={'title': 'OpenAPI Petstore'}) + app.run(port=8080) + + +if __name__ == '__main__': + main() diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/__init__.py b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/pet_controller.py b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/pet_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..125820f00549afda3346a08a01ae71b4501d929e --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/pet_controller.py @@ -0,0 +1,124 @@ +import connexion +import six + +from openapi_server.models.api_response import ApiResponse # noqa: E501 +from openapi_server.models.pet import Pet # noqa: E501 +from openapi_server import util + + +def add_pet(pet): # noqa: E501 + """Add a new pet to the store + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store + :type pet: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def delete_pet(pet_id, api_key=None): # noqa: E501 + """Deletes a pet + + # noqa: E501 + + :param pet_id: Pet id to delete + :type pet_id: int + :param api_key: + :type api_key: str + + :rtype: None + """ + return 'do some magic!' + + +def find_pets_by_status(status): # noqa: E501 + """Finds Pets by status + + Multiple status values can be provided with comma separated strings # noqa: E501 + + :param status: Status values that need to be considered for filter + :type status: List[str] + + :rtype: List[Pet] + """ + return 'do some magic!' + + +def find_pets_by_tags(tags): # noqa: E501 + """Finds Pets by tags + + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 + + :param tags: Tags to filter by + :type tags: List[str] + + :rtype: List[Pet] + """ + return 'do some magic!' + + +def get_pet_by_id(pet_id): # noqa: E501 + """Find pet by ID + + Returns a single pet # noqa: E501 + + :param pet_id: ID of pet to return + :type pet_id: int + + :rtype: Pet + """ + return 'do some magic!' + + +def update_pet(pet): # noqa: E501 + """Update an existing pet + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store + :type pet: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def update_pet_with_form(pet_id, name=None, status=None): # noqa: E501 + """Updates a pet in the store with form data + + # noqa: E501 + + :param pet_id: ID of pet that needs to be updated + :type pet_id: int + :param name: Updated name of the pet + :type name: str + :param status: Updated status of the pet + :type status: str + + :rtype: None + """ + return 'do some magic!' + + +def upload_file(pet_id, additional_metadata=None, file=None): # noqa: E501 + """uploads an image + + # noqa: E501 + + :param pet_id: ID of pet to update + :type pet_id: int + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param file: file to upload + :type file: str + + :rtype: ApiResponse + """ + return 'do some magic!' diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/security_controller_.py b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/security_controller_.py new file mode 100644 index 0000000000000000000000000000000000000000..1db7a68f466531e077bdb27c51c3dda71961f21b --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/security_controller_.py @@ -0,0 +1,48 @@ +from typing import List + + +def info_from_api_key(api_key, required_scopes): + """ + Check and retrieve authentication information from api_key. + Returned value will be passed in 'token_info' parameter of your operation function, if there is one. + 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. + + :param api_key API key provided by Authorization header + :type api_key: str + :param required_scopes Always None. Used for other authentication method + :type required_scopes: None + :return: Information attached to provided api_key or None if api_key is invalid or does not allow access to called API + :rtype: dict | None + """ + return {'uid': 'user_id'} + + +def info_from_petstore_auth(token): + """ + Validate and decode token. + Returned value will be passed in 'token_info' parameter of your operation function, if there is one. + 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. + 'scope' or 'scopes' will be passed to scope validation function. + + :param token Token provided by Authorization header + :type token: str + :return: Decoded token information or None if token is invalid + :rtype: dict | None + """ + return {'scopes': ['read:pets', 'write:pets'], 'uid': 'user_id'} + + +def validate_scope_petstore_auth(required_scopes, token_scopes): + """ + Validate required scopes are included in token scope + + :param required_scopes Required scope to access called API + :type required_scopes: List[str] + :param token_scopes Scope present in token + :type token_scopes: List[str] + :return: True if access to called API is allowed + :rtype: bool + """ + return set(required_scopes).issubset(set(token_scopes)) + + diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/store_controller.py b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/store_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..3d16d99859e7f23770ef5d178fc6244e9f23dc90 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/store_controller.py @@ -0,0 +1,57 @@ +import connexion +import six + +from openapi_server.models.order import Order # noqa: E501 +from openapi_server import util + + +def delete_order(order_id): # noqa: E501 + """Delete purchase order by ID + + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501 + + :param order_id: ID of the order that needs to be deleted + :type order_id: str + + :rtype: None + """ + return 'do some magic!' + + +def get_inventory(): # noqa: E501 + """Returns pet inventories by status + + Returns a map of status codes to quantities # noqa: E501 + + + :rtype: Dict[str, int] + """ + return 'do some magic!' + + +def get_order_by_id(order_id): # noqa: E501 + """Find purchase order by ID + + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501 + + :param order_id: ID of pet that needs to be fetched + :type order_id: int + + :rtype: Order + """ + return 'do some magic!' + + +def place_order(order): # noqa: E501 + """Place an order for a pet + + # noqa: E501 + + :param order: order placed for purchasing the pet + :type order: dict | bytes + + :rtype: Order + """ + if connexion.request.is_json: + order = Order.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/user_controller.py b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/user_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..9b9706262121761ae9eaf386750a1fee930942be --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/controllers/user_controller.py @@ -0,0 +1,119 @@ +import connexion +import six + +from openapi_server.models.user import User # noqa: E501 +from openapi_server import util + + +def create_user(user): # noqa: E501 + """Create user + + This can only be done by the logged in user. # noqa: E501 + + :param user: Created user object + :type user: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = User.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def create_users_with_array_input(user): # noqa: E501 + """Creates list of users with given input array + + # noqa: E501 + + :param user: List of user object + :type user: list | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 + return 'do some magic!' + + +def create_users_with_list_input(user): # noqa: E501 + """Creates list of users with given input array + + # noqa: E501 + + :param user: List of user object + :type user: list | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 + return 'do some magic!' + + +def delete_user(username): # noqa: E501 + """Delete user + + This can only be done by the logged in user. # noqa: E501 + + :param username: The name that needs to be deleted + :type username: str + + :rtype: None + """ + return 'do some magic!' + + +def get_user_by_name(username): # noqa: E501 + """Get user by user name + + # noqa: E501 + + :param username: The name that needs to be fetched. Use user1 for testing. + :type username: str + + :rtype: User + """ + return 'do some magic!' + + +def login_user(username, password): # noqa: E501 + """Logs user into the system + + # noqa: E501 + + :param username: The user name for login + :type username: str + :param password: The password for login in clear text + :type password: str + + :rtype: str + """ + return 'do some magic!' + + +def logout_user(): # noqa: E501 + """Logs out current logged in user session + + # noqa: E501 + + + :rtype: None + """ + return 'do some magic!' + + +def update_user(username, user): # noqa: E501 + """Updated user + + This can only be done by the logged in user. # noqa: E501 + + :param username: name that need to be deleted + :type username: str + :param user: Updated user object + :type user: dict | bytes + + :rtype: None + """ + if connexion.request.is_json: + user = User.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/encoder.py b/samples/server/openapi3/petstore/python-flask/openapi_server/encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..3bbef854f3b83dc985aea885756fd7147fa00001 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/encoder.py @@ -0,0 +1,20 @@ +from connexion.apps.flask_app import FlaskJSONEncoder +import six + +from openapi_server.models.base_model_ import Model + + +class JSONEncoder(FlaskJSONEncoder): + include_nulls = False + + def default(self, o): + if isinstance(o, Model): + dikt = {} + for attr, _ in six.iteritems(o.openapi_types): + value = getattr(o, attr) + if value is None and not self.include_nulls: + continue + attr = o.attribute_map[attr] + dikt[attr] = value + return dikt + return FlaskJSONEncoder.default(self, o) diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/__init__.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..689233630d14ba2f934adb8cb408afafe4bff5d6 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/__init__.py @@ -0,0 +1,13 @@ +# coding: utf-8 + +# flake8: noqa +from __future__ import absolute_import +# import models into model package +from openapi_server.models.api_response import ApiResponse +from openapi_server.models.category import Category +from openapi_server.models.inline_object import InlineObject +from openapi_server.models.inline_object1 import InlineObject1 +from openapi_server.models.order import Order +from openapi_server.models.pet import Pet +from openapi_server.models.tag import Tag +from openapi_server.models.user import User diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/api_response.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/api_response.py new file mode 100644 index 0000000000000000000000000000000000000000..1e23da9c2304ed01c8e44c26d7d642094946a709 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/api_response.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class ApiResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, code=None, type=None, message=None): # noqa: E501 + """ApiResponse - a model defined in OpenAPI + + :param code: The code of this ApiResponse. # noqa: E501 + :type code: int + :param type: The type of this ApiResponse. # noqa: E501 + :type type: str + :param message: The message of this ApiResponse. # noqa: E501 + :type message: str + """ + self.openapi_types = { + 'code': int, + 'type': str, + 'message': str + } + + self.attribute_map = { + 'code': 'code', + 'type': 'type', + 'message': 'message' + } + + self._code = code + self._type = type + self._message = message + + @classmethod + def from_dict(cls, dikt) -> 'ApiResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The ApiResponse of this ApiResponse. # noqa: E501 + :rtype: ApiResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def code(self): + """Gets the code of this ApiResponse. + + + :return: The code of this ApiResponse. + :rtype: int + """ + return self._code + + @code.setter + def code(self, code): + """Sets the code of this ApiResponse. + + + :param code: The code of this ApiResponse. + :type code: int + """ + + self._code = code + + @property + def type(self): + """Gets the type of this ApiResponse. + + + :return: The type of this ApiResponse. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ApiResponse. + + + :param type: The type of this ApiResponse. + :type type: str + """ + + self._type = type + + @property + def message(self): + """Gets the message of this ApiResponse. + + + :return: The message of this ApiResponse. + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ApiResponse. + + + :param message: The message of this ApiResponse. + :type message: str + """ + + self._message = message diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/base_model_.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/base_model_.py new file mode 100644 index 0000000000000000000000000000000000000000..ec33e3ba3cff3295c23bd0cef2443f8c8ba464d6 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/base_model_.py @@ -0,0 +1,69 @@ +import pprint + +import six +import typing + +from openapi_server import util + +T = typing.TypeVar('T') + + +class Model(object): + # openapiTypes: The key is attribute name and the + # value is attribute type. + openapi_types = {} + + # attributeMap: The key is attribute name and the + # value is json key in definition. + attribute_map = {} + + @classmethod + def from_dict(cls: typing.Type[T], dikt) -> T: + """Returns the dict as a model""" + return util.deserialize_model(dikt, cls) + + def to_dict(self): + """Returns the model properties as a dict + + :rtype: dict + """ + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model + + :rtype: str + """ + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/category.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/category.py new file mode 100644 index 0000000000000000000000000000000000000000..3a68d86c250c8def470431bdf0904431b3d679e0 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/category.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class Category(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, name=None): # noqa: E501 + """Category - a model defined in OpenAPI + + :param id: The id of this Category. # noqa: E501 + :type id: int + :param name: The name of this Category. # noqa: E501 + :type name: str + """ + self.openapi_types = { + 'id': int, + 'name': str + } + + self.attribute_map = { + 'id': 'id', + 'name': 'name' + } + + self._id = id + self._name = name + + @classmethod + def from_dict(cls, dikt) -> 'Category': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Category of this Category. # noqa: E501 + :rtype: Category + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Category. + + + :return: The id of this Category. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Category. + + + :param id: The id of this Category. + :type id: int + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Category. + + + :return: The name of this Category. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Category. + + + :param name: The name of this Category. + :type name: str + """ + + self._name = name diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/inline_object.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/inline_object.py new file mode 100644 index 0000000000000000000000000000000000000000..1178d560625cc88b29318fe37a9233a030ceefa6 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/inline_object.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class InlineObject(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, status=None): # noqa: E501 + """InlineObject - a model defined in OpenAPI + + :param name: The name of this InlineObject. # noqa: E501 + :type name: str + :param status: The status of this InlineObject. # noqa: E501 + :type status: str + """ + self.openapi_types = { + 'name': str, + 'status': str + } + + self.attribute_map = { + 'name': 'name', + 'status': 'status' + } + + self._name = name + self._status = status + + @classmethod + def from_dict(cls, dikt) -> 'InlineObject': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The inline_object of this InlineObject. # noqa: E501 + :rtype: InlineObject + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self): + """Gets the name of this InlineObject. + + Updated name of the pet # noqa: E501 + + :return: The name of this InlineObject. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this InlineObject. + + Updated name of the pet # noqa: E501 + + :param name: The name of this InlineObject. + :type name: str + """ + + self._name = name + + @property + def status(self): + """Gets the status of this InlineObject. + + Updated status of the pet # noqa: E501 + + :return: The status of this InlineObject. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this InlineObject. + + Updated status of the pet # noqa: E501 + + :param status: The status of this InlineObject. + :type status: str + """ + + self._status = status diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/inline_object1.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/inline_object1.py new file mode 100644 index 0000000000000000000000000000000000000000..349041c0c8fce69adeef06c47773eb3a82a2e698 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/inline_object1.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class InlineObject1(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, additional_metadata=None, file=None): # noqa: E501 + """InlineObject1 - a model defined in OpenAPI + + :param additional_metadata: The additional_metadata of this InlineObject1. # noqa: E501 + :type additional_metadata: str + :param file: The file of this InlineObject1. # noqa: E501 + :type file: file + """ + self.openapi_types = { + 'additional_metadata': str, + 'file': file + } + + self.attribute_map = { + 'additional_metadata': 'additionalMetadata', + 'file': 'file' + } + + self._additional_metadata = additional_metadata + self._file = file + + @classmethod + def from_dict(cls, dikt) -> 'InlineObject1': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The inline_object_1 of this InlineObject1. # noqa: E501 + :rtype: InlineObject1 + """ + return util.deserialize_model(dikt, cls) + + @property + def additional_metadata(self): + """Gets the additional_metadata of this InlineObject1. + + Additional data to pass to server # noqa: E501 + + :return: The additional_metadata of this InlineObject1. + :rtype: str + """ + return self._additional_metadata + + @additional_metadata.setter + def additional_metadata(self, additional_metadata): + """Sets the additional_metadata of this InlineObject1. + + Additional data to pass to server # noqa: E501 + + :param additional_metadata: The additional_metadata of this InlineObject1. + :type additional_metadata: str + """ + + self._additional_metadata = additional_metadata + + @property + def file(self): + """Gets the file of this InlineObject1. + + file to upload # noqa: E501 + + :return: The file of this InlineObject1. + :rtype: file + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this InlineObject1. + + file to upload # noqa: E501 + + :param file: The file of this InlineObject1. + :type file: file + """ + + self._file = file diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/order.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/order.py new file mode 100644 index 0000000000000000000000000000000000000000..aa8a7a71c393fe517abfef471b4af37bcb1769f9 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/order.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class Order(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501 + """Order - a model defined in OpenAPI + + :param id: The id of this Order. # noqa: E501 + :type id: int + :param pet_id: The pet_id of this Order. # noqa: E501 + :type pet_id: int + :param quantity: The quantity of this Order. # noqa: E501 + :type quantity: int + :param ship_date: The ship_date of this Order. # noqa: E501 + :type ship_date: datetime + :param status: The status of this Order. # noqa: E501 + :type status: str + :param complete: The complete of this Order. # noqa: E501 + :type complete: bool + """ + self.openapi_types = { + 'id': int, + 'pet_id': int, + 'quantity': int, + 'ship_date': datetime, + 'status': str, + 'complete': bool + } + + self.attribute_map = { + 'id': 'id', + 'pet_id': 'petId', + 'quantity': 'quantity', + 'ship_date': 'shipDate', + 'status': 'status', + 'complete': 'complete' + } + + self._id = id + self._pet_id = pet_id + self._quantity = quantity + self._ship_date = ship_date + self._status = status + self._complete = complete + + @classmethod + def from_dict(cls, dikt) -> 'Order': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Order of this Order. # noqa: E501 + :rtype: Order + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Order. + + + :return: The id of this Order. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Order. + + + :param id: The id of this Order. + :type id: int + """ + + self._id = id + + @property + def pet_id(self): + """Gets the pet_id of this Order. + + + :return: The pet_id of this Order. + :rtype: int + """ + return self._pet_id + + @pet_id.setter + def pet_id(self, pet_id): + """Sets the pet_id of this Order. + + + :param pet_id: The pet_id of this Order. + :type pet_id: int + """ + + self._pet_id = pet_id + + @property + def quantity(self): + """Gets the quantity of this Order. + + + :return: The quantity of this Order. + :rtype: int + """ + return self._quantity + + @quantity.setter + def quantity(self, quantity): + """Sets the quantity of this Order. + + + :param quantity: The quantity of this Order. + :type quantity: int + """ + + self._quantity = quantity + + @property + def ship_date(self): + """Gets the ship_date of this Order. + + + :return: The ship_date of this Order. + :rtype: datetime + """ + return self._ship_date + + @ship_date.setter + def ship_date(self, ship_date): + """Sets the ship_date of this Order. + + + :param ship_date: The ship_date of this Order. + :type ship_date: datetime + """ + + self._ship_date = ship_date + + @property + def status(self): + """Gets the status of this Order. + + Order Status # noqa: E501 + + :return: The status of this Order. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Order. + + Order Status # noqa: E501 + + :param status: The status of this Order. + :type status: str + """ + allowed_values = ["placed", "approved", "delivered"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status + + @property + def complete(self): + """Gets the complete of this Order. + + + :return: The complete of this Order. + :rtype: bool + """ + return self._complete + + @complete.setter + def complete(self, complete): + """Sets the complete of this Order. + + + :param complete: The complete of this Order. + :type complete: bool + """ + + self._complete = complete diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/pet.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/pet.py new file mode 100644 index 0000000000000000000000000000000000000000..e61674165e1cddaafee4d3f25558a0861e4d40e3 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/pet.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server.models.category import Category +from openapi_server.models.tag import Tag +from openapi_server import util + +from openapi_server.models.category import Category # noqa: E501 +from openapi_server.models.tag import Tag # noqa: E501 + +class Pet(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501 + """Pet - a model defined in OpenAPI + + :param id: The id of this Pet. # noqa: E501 + :type id: int + :param category: The category of this Pet. # noqa: E501 + :type category: Category + :param name: The name of this Pet. # noqa: E501 + :type name: str + :param photo_urls: The photo_urls of this Pet. # noqa: E501 + :type photo_urls: List[str] + :param tags: The tags of this Pet. # noqa: E501 + :type tags: List[Tag] + :param status: The status of this Pet. # noqa: E501 + :type status: str + """ + self.openapi_types = { + 'id': int, + 'category': Category, + 'name': str, + 'photo_urls': List[str], + 'tags': List[Tag], + 'status': str + } + + self.attribute_map = { + 'id': 'id', + 'category': 'category', + 'name': 'name', + 'photo_urls': 'photoUrls', + 'tags': 'tags', + 'status': 'status' + } + + self._id = id + self._category = category + self._name = name + self._photo_urls = photo_urls + self._tags = tags + self._status = status + + @classmethod + def from_dict(cls, dikt) -> 'Pet': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Pet of this Pet. # noqa: E501 + :rtype: Pet + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Pet. + + + :return: The id of this Pet. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Pet. + + + :param id: The id of this Pet. + :type id: int + """ + + self._id = id + + @property + def category(self): + """Gets the category of this Pet. + + + :return: The category of this Pet. + :rtype: Category + """ + return self._category + + @category.setter + def category(self, category): + """Sets the category of this Pet. + + + :param category: The category of this Pet. + :type category: Category + """ + + self._category = category + + @property + def name(self): + """Gets the name of this Pet. + + + :return: The name of this Pet. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Pet. + + + :param name: The name of this Pet. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def photo_urls(self): + """Gets the photo_urls of this Pet. + + + :return: The photo_urls of this Pet. + :rtype: List[str] + """ + return self._photo_urls + + @photo_urls.setter + def photo_urls(self, photo_urls): + """Sets the photo_urls of this Pet. + + + :param photo_urls: The photo_urls of this Pet. + :type photo_urls: List[str] + """ + if photo_urls is None: + raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501 + + self._photo_urls = photo_urls + + @property + def tags(self): + """Gets the tags of this Pet. + + + :return: The tags of this Pet. + :rtype: List[Tag] + """ + return self._tags + + @tags.setter + def tags(self, tags): + """Sets the tags of this Pet. + + + :param tags: The tags of this Pet. + :type tags: List[Tag] + """ + + self._tags = tags + + @property + def status(self): + """Gets the status of this Pet. + + pet status in the store # noqa: E501 + + :return: The status of this Pet. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Pet. + + pet status in the store # noqa: E501 + + :param status: The status of this Pet. + :type status: str + """ + allowed_values = ["available", "pending", "sold"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/tag.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/tag.py new file mode 100644 index 0000000000000000000000000000000000000000..bd6fff169078cc6ca0cfc0f3b27507c02a8a0b9f --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/tag.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class Tag(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, name=None): # noqa: E501 + """Tag - a model defined in OpenAPI + + :param id: The id of this Tag. # noqa: E501 + :type id: int + :param name: The name of this Tag. # noqa: E501 + :type name: str + """ + self.openapi_types = { + 'id': int, + 'name': str + } + + self.attribute_map = { + 'id': 'id', + 'name': 'name' + } + + self._id = id + self._name = name + + @classmethod + def from_dict(cls, dikt) -> 'Tag': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Tag of this Tag. # noqa: E501 + :rtype: Tag + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this Tag. + + + :return: The id of this Tag. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Tag. + + + :param id: The id of this Tag. + :type id: int + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Tag. + + + :return: The name of this Tag. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Tag. + + + :param name: The name of this Tag. + :type name: str + """ + + self._name = name diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/models/user.py b/samples/server/openapi3/petstore/python-flask/openapi_server/models/user.py new file mode 100644 index 0000000000000000000000000000000000000000..1b1f4bdae7268dce5c6434f13660ebe31ce7cb74 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/models/user.py @@ -0,0 +1,248 @@ +# coding: utf-8 + +from __future__ import absolute_import +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from openapi_server.models.base_model_ import Model +from openapi_server import util + + +class User(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501 + """User - a model defined in OpenAPI + + :param id: The id of this User. # noqa: E501 + :type id: int + :param username: The username of this User. # noqa: E501 + :type username: str + :param first_name: The first_name of this User. # noqa: E501 + :type first_name: str + :param last_name: The last_name of this User. # noqa: E501 + :type last_name: str + :param email: The email of this User. # noqa: E501 + :type email: str + :param password: The password of this User. # noqa: E501 + :type password: str + :param phone: The phone of this User. # noqa: E501 + :type phone: str + :param user_status: The user_status of this User. # noqa: E501 + :type user_status: int + """ + self.openapi_types = { + 'id': int, + 'username': str, + 'first_name': str, + 'last_name': str, + 'email': str, + 'password': str, + 'phone': str, + 'user_status': int + } + + self.attribute_map = { + 'id': 'id', + 'username': 'username', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'email': 'email', + 'password': 'password', + 'phone': 'phone', + 'user_status': 'userStatus' + } + + self._id = id + self._username = username + self._first_name = first_name + self._last_name = last_name + self._email = email + self._password = password + self._phone = phone + self._user_status = user_status + + @classmethod + def from_dict(cls, dikt) -> 'User': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The User of this User. # noqa: E501 + :rtype: User + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self): + """Gets the id of this User. + + + :return: The id of this User. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + + :param id: The id of this User. + :type id: int + """ + + self._id = id + + @property + def username(self): + """Gets the username of this User. + + + :return: The username of this User. + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this User. + + + :param username: The username of this User. + :type username: str + """ + + self._username = username + + @property + def first_name(self): + """Gets the first_name of this User. + + + :return: The first_name of this User. + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + + :param first_name: The first_name of this User. + :type first_name: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. + + + :return: The last_name of this User. + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + + :param last_name: The last_name of this User. + :type last_name: str + """ + + self._last_name = last_name + + @property + def email(self): + """Gets the email of this User. + + + :return: The email of this User. + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this User. + + + :param email: The email of this User. + :type email: str + """ + + self._email = email + + @property + def password(self): + """Gets the password of this User. + + + :return: The password of this User. + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this User. + + + :param password: The password of this User. + :type password: str + """ + + self._password = password + + @property + def phone(self): + """Gets the phone of this User. + + + :return: The phone of this User. + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this User. + + + :param phone: The phone of this User. + :type phone: str + """ + + self._phone = phone + + @property + def user_status(self): + """Gets the user_status of this User. + + User Status # noqa: E501 + + :return: The user_status of this User. + :rtype: int + """ + return self._user_status + + @user_status.setter + def user_status(self, user_status): + """Sets the user_status of this User. + + User Status # noqa: E501 + + :param user_status: The user_status of this User. + :type user_status: int + """ + + self._user_status = user_status diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/openapi/openapi.yaml b/samples/server/openapi3/petstore/python-flask/openapi_server/openapi/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..19e24c5964588144f1549e2f4dc5b9b6cf953b03 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/openapi/openapi.yaml @@ -0,0 +1,803 @@ +openapi: 3.0.0 +info: + description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: add_pet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + put: + operationId: update_pet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 400: + description: Invalid ID supplied + 404: + description: Pet not found + 405: + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: find_pets_by_status + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: find_pets_by_tags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{pet_id}: + delete: + operationId: delete_pet + 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: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 400: + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + get: + description: Returns a single pet + operationId: get_pet_by_id + parameters: + - description: ID of pet to return + explode: false + in: path + name: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + post: + operationId: update_pet_with_form + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + 405: + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{pet_id}/uploadImage: + post: + operationId: upload_file + parameters: + - description: ID of pet to update + explode: false + in: path + name: pet_id + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: get_inventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /store/order: + post: + operationId: place_order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: delete_order + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: get_order_by_id + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /user: + post: + description: This can only be done by the logged in user. + operationId: create_user + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/createWithArray: + post: + operationId: create_users_with_array_input + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/createWithList: + post: + operationId: create_users_with_list_input + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/login: + get: + operationId: login_user + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when toekn expires + explode: false + schema: + format: date-time + type: string + style: simple + 400: + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/logout: + get: + operationId: logout_user + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: delete_user + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Delete user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + get: + operationId: get_user_by_name + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + description: Invalid username supplied + 404: + description: User not found + summary: Get user by user name + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + put: + description: This can only be done by the logged in user. + operationId: update_user + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + description: Invalid user supplied + 404: + description: User not found + summary: Updated user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + schemas: + Order: + description: An order for a pets from the pet store + 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 + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + 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: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + 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 + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + x-tokenInfoFunc: openapi_server.controllers.security_controller_.info_from_petstore_auth + x-scopeValidateFunc: openapi_server.controllers.security_controller_.validate_scope_petstore_auth + api_key: + in: header + name: api_key + type: apiKey + x-apikeyInfoFunc: openapi_server.controllers.security_controller_.info_from_api_key diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/test/__init__.py b/samples/server/openapi3/petstore/python-flask/openapi_server/test/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cf6b70fce26b20861d0b1bc2ffe9dc3306709abe --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/test/__init__.py @@ -0,0 +1,16 @@ +import logging + +import connexion +from flask_testing import TestCase + +from openapi_server.encoder import JSONEncoder + + +class BaseTestCase(TestCase): + + def create_app(self): + logging.getLogger('connexion.operation').setLevel('ERROR') + app = connexion.App(__name__, specification_dir='../openapi/') + app.app.json_encoder = JSONEncoder + app.add_api('openapi.yaml') + return app.app diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_pet_controller.py b/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_pet_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..c756d7bb2ca15dd1c75fd5b45d31d9a4be5cb941 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_pet_controller.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +from __future__ import absolute_import +import unittest + +from flask import json +from six import BytesIO + +from openapi_server.models.api_response import ApiResponse # noqa: E501 +from openapi_server.models.pet import Pet # noqa: E501 +from openapi_server.test import BaseTestCase + + +class TestPetController(BaseTestCase): + """PetController integration test stubs""" + + @unittest.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760") + def test_add_pet(self): + """Test case for add_pet + + Add a new pet to the store + """ + pet = { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" +} + headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet', + method='POST', + headers=headers, + data=json.dumps(pet), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_delete_pet(self): + """Test case for delete_pet + + Deletes a pet + """ + headers = { + 'api_key': 'api_key_example', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet/{pet_id}'.format(pet_id=56), + method='DELETE', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_find_pets_by_status(self): + """Test case for find_pets_by_status + + Finds Pets by status + """ + query_string = [('status', 'available')] + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet/findByStatus', + method='GET', + headers=headers, + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_find_pets_by_tags(self): + """Test case for find_pets_by_tags + + Finds Pets by tags + """ + query_string = [('tags', 'tags_example')] + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet/findByTags', + method='GET', + headers=headers, + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_pet_by_id(self): + """Test case for get_pet_by_id + + Find pet by ID + """ + headers = { + 'Accept': 'application/json', + 'api_key': 'special-key', + } + response = self.client.open( + '/v2/pet/{pet_id}'.format(pet_id=56), + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + @unittest.skip("Connexion does not support multiple consummes. See https://github.com/zalando/connexion/pull/760") + def test_update_pet(self): + """Test case for update_pet + + Update an existing pet + """ + pet = { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" +} + headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer special-key', + } + response = self.client.open( + '/v2/pet', + method='PUT', + headers=headers, + data=json.dumps(pet), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + @unittest.skip("application/x-www-form-urlencoded not supported by Connexion") + def test_update_pet_with_form(self): + """Test case for update_pet_with_form + + Updates a pet in the store with form data + """ + headers = { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Authorization': 'Bearer special-key', + } + data = dict(name='name_example', + status='status_example') + response = self.client.open( + '/v2/pet/{pet_id}'.format(pet_id=56), + method='POST', + headers=headers, + data=data, + content_type='application/x-www-form-urlencoded') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + @unittest.skip("multipart/form-data not supported by Connexion") + def test_upload_file(self): + """Test case for upload_file + + uploads an image + """ + headers = { + 'Accept': 'application/json', + 'Content-Type': 'multipart/form-data', + 'Authorization': 'Bearer special-key', + } + data = dict(additional_metadata='additional_metadata_example', + file=(BytesIO(b'some file data'), 'file.txt')) + response = self.client.open( + '/v2/pet/{pet_id}/uploadImage'.format(pet_id=56), + method='POST', + headers=headers, + data=data, + content_type='multipart/form-data') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_store_controller.py b/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_store_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..e232ef3aad488b2e9cbc859aa321a0eb3415a578 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_store_controller.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +from __future__ import absolute_import +import unittest + +from flask import json +from six import BytesIO + +from openapi_server.models.order import Order # noqa: E501 +from openapi_server.test import BaseTestCase + + +class TestStoreController(BaseTestCase): + """StoreController integration test stubs""" + + def test_delete_order(self): + """Test case for delete_order + + Delete purchase order by ID + """ + headers = { + } + response = self.client.open( + '/v2/store/order/{order_id}'.format(order_id='order_id_example'), + method='DELETE', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_inventory(self): + """Test case for get_inventory + + Returns pet inventories by status + """ + headers = { + 'Accept': 'application/json', + 'api_key': 'special-key', + } + response = self.client.open( + '/v2/store/inventory', + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_order_by_id(self): + """Test case for get_order_by_id + + Find purchase order by ID + """ + headers = { + 'Accept': 'application/json', + } + response = self.client.open( + '/v2/store/order/{order_id}'.format(order_id=5), + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_place_order(self): + """Test case for place_order + + Place an order for a pet + """ + order = { + "petId" : 6, + "quantity" : 1, + "id" : 0, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : false, + "status" : "placed" +} + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/store/order', + method='POST', + headers=headers, + data=json.dumps(order), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_user_controller.py b/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_user_controller.py new file mode 100644 index 0000000000000000000000000000000000000000..c71f332d0de21e46a4eb267fce361495de94bca1 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/test/test_user_controller.py @@ -0,0 +1,169 @@ +# coding: utf-8 + +from __future__ import absolute_import +import unittest + +from flask import json +from six import BytesIO + +from openapi_server.models.user import User # noqa: E501 +from openapi_server.test import BaseTestCase + + +class TestUserController(BaseTestCase): + """UserController integration test stubs""" + + def test_create_user(self): + """Test case for create_user + + Create user + """ + user = { + "firstName" : "firstName", + "lastName" : "lastName", + "password" : "password", + "userStatus" : 6, + "phone" : "phone", + "id" : 0, + "email" : "email", + "username" : "username" +} + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user', + method='POST', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_create_users_with_array_input(self): + """Test case for create_users_with_array_input + + Creates list of users with given input array + """ + user = [] + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user/createWithArray', + method='POST', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_create_users_with_list_input(self): + """Test case for create_users_with_list_input + + Creates list of users with given input array + """ + user = [] + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user/createWithList', + method='POST', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_delete_user(self): + """Test case for delete_user + + Delete user + """ + headers = { + } + response = self.client.open( + '/v2/user/{username}'.format(username='username_example'), + method='DELETE', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_get_user_by_name(self): + """Test case for get_user_by_name + + Get user by user name + """ + headers = { + 'Accept': 'application/json', + } + response = self.client.open( + '/v2/user/{username}'.format(username='username_example'), + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_login_user(self): + """Test case for login_user + + Logs user into the system + """ + query_string = [('username', 'username_example'), + ('password', 'password_example')] + headers = { + 'Accept': 'application/json', + } + response = self.client.open( + '/v2/user/login', + method='GET', + headers=headers, + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_logout_user(self): + """Test case for logout_user + + Logs out current logged in user session + """ + headers = { + } + response = self.client.open( + '/v2/user/logout', + method='GET', + headers=headers) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + def test_update_user(self): + """Test case for update_user + + Updated user + """ + user = { + "firstName" : "firstName", + "lastName" : "lastName", + "password" : "password", + "userStatus" : 6, + "phone" : "phone", + "id" : 0, + "email" : "email", + "username" : "username" +} + headers = { + 'Content-Type': 'application/json', + } + response = self.client.open( + '/v2/user/{username}'.format(username='username_example'), + method='PUT', + headers=headers, + data=json.dumps(user), + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/server/openapi3/petstore/python-flask/openapi_server/util.py b/samples/server/openapi3/petstore/python-flask/openapi_server/util.py new file mode 100644 index 0000000000000000000000000000000000000000..c7340cd000598f16e12d04e0f1824040d91f7459 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/openapi_server/util.py @@ -0,0 +1,141 @@ +import datetime + +import six +import typing + + +def _deserialize(data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if klass in six.integer_types or klass in (float, str, bool): + return _deserialize_primitive(data, klass) + elif klass == object: + return _deserialize_object(data) + elif klass == datetime.date: + return deserialize_date(data) + elif klass == datetime.datetime: + return deserialize_datetime(data) + elif type(klass) == typing.GenericMeta: + if klass.__extra__ == list: + return _deserialize_list(data, klass.__args__[0]) + if klass.__extra__ == dict: + return _deserialize_dict(data, klass.__args__[1]) + else: + return deserialize_model(data, klass) + + +def _deserialize_primitive(data, klass): + """Deserializes to primitive type. + + :param data: data to deserialize. + :param klass: class literal. + + :return: int, long, float, str, bool. + :rtype: int | long | float | str | bool + """ + try: + value = klass(data) + except UnicodeEncodeError: + value = six.u(data) + except TypeError: + value = data + return value + + +def _deserialize_object(value): + """Return an original value. + + :return: object. + """ + return value + + +def deserialize_date(string): + """Deserializes string to date. + + :param string: str. + :type string: str + :return: date. + :rtype: date + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + + +def deserialize_datetime(string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :type string: str + :return: datetime. + :rtype: datetime + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + + +def deserialize_model(data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :type data: dict | list + :param klass: class literal. + :return: model object. + """ + instance = klass() + + if not instance.openapi_types: + return data + + for attr, attr_type in six.iteritems(instance.openapi_types): + if data is not None \ + and instance.attribute_map[attr] in data \ + and isinstance(data, (list, dict)): + value = data[instance.attribute_map[attr]] + setattr(instance, attr, _deserialize(value, attr_type)) + + return instance + + +def _deserialize_list(data, boxed_type): + """Deserializes a list and its elements. + + :param data: list to deserialize. + :type data: list + :param boxed_type: class literal. + + :return: deserialized list. + :rtype: list + """ + return [_deserialize(sub_data, boxed_type) + for sub_data in data] + + +def _deserialize_dict(data, boxed_type): + """Deserializes a dict and its elements. + + :param data: dict to deserialize. + :type data: dict + :param boxed_type: class literal. + + :return: deserialized dict. + :rtype: dict + """ + return {k: _deserialize(v, boxed_type) + for k, v in six.iteritems(data)} diff --git a/samples/server/openapi3/petstore/python-flask/requirements.txt b/samples/server/openapi3/petstore/python-flask/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..66ecf7c26851492f49dd01ff18805a55f81c63e7 --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/requirements.txt @@ -0,0 +1,4 @@ +connexion == 2.0.2 +swagger-ui-bundle == 0.0.2 +python_dateutil == 2.6.0 +setuptools >= 21.0.0 diff --git a/samples/server/openapi3/petstore/python-flask/setup.py b/samples/server/openapi3/petstore/python-flask/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..9d7b02fbd90beb00390d15d0af5d4b44623b4dad --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/setup.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +import sys +from setuptools import setup, find_packages + +NAME = "openapi_server" +VERSION = "1.0.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = [ + "connexion==2.0.0", + "swagger-ui-bundle==0.0.2", + "python_dateutil==2.6.0" +] + +setup( + name=NAME, + version=VERSION, + description="OpenAPI Petstore", + author_email="", + url="", + keywords=["OpenAPI", "OpenAPI Petstore"], + install_requires=REQUIRES, + packages=find_packages(), + package_data={'': ['openapi/openapi.yaml']}, + include_package_data=True, + entry_points={ + 'console_scripts': ['openapi_server=openapi_server.__main__:main']}, + long_description="""\ + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + """ +) + diff --git a/samples/server/openapi3/petstore/python-flask/test-requirements.txt b/samples/server/openapi3/petstore/python-flask/test-requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8d96e6b40e853d658f88fa745ddcf37ff7644c --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/test-requirements.txt @@ -0,0 +1,6 @@ +flask_testing==0.6.1 +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13 diff --git a/samples/server/openapi3/petstore/python-flask/tox.ini b/samples/server/openapi3/petstore/python-flask/tox.ini new file mode 100644 index 0000000000000000000000000000000000000000..ab4dfbb81b8be688239e2d6b667b0c5c08659c6c --- /dev/null +++ b/samples/server/openapi3/petstore/python-flask/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + nosetests \ + [] \ No newline at end of file diff --git a/samples/server/petstore/go-api-server/.openapi-generator/VERSION b/samples/server/petstore/go-api-server/.openapi-generator/VERSION index 6d94c9c2e12a1bd077604be440ff7eb83354cd54..afa6365606414bf56f925745712166af5b4a2be0 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 c0b60f85ddebb4508409207ffd2394c47abbcd0f..ac82672eb8878d05def833aeb5450d5a02d1bff8 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 d2cbaed56b4ae36a1d001e725c3a6ce9732a5152..2379e169080d7ee02f4fa6e79345fc838e347d88 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 4f7ca371b4254bf56c5554d0dffed4f9db11b8c8..5e6f9d247fa439d21ee4fbd119fdb115260af1e7 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 45c20b64543ef9d1939b5762b814c65aa7ea74b1..a9d8dbb795795b5d7703bb6993c1973f0fd65ecc 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 a085e97ab58091e0160a7100e2b8c52827fafd67..fb206487ab0824ac4a524c181804b4d73632ba3f 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 1fd6437e34b92b8f217d05b447ad620e840e24ae..2fb07fb32c4617a1535c5066cbc2ac3f15c2b248 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 304d910ec64af31c6d82eee08cd164bab6159d3d..8f40d0ac04cb4eb6410dddc866076a131768c1a6 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 ff09e500be5721d9b941d48dc6cc0420c3d16ada..fb206487ab0824ac4a524c181804b4d73632ba3f 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"` diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java index a7907d4a0a99144fe031a03da5d6fbbcea3d05d0..6cad533f5aae00c142a9e507d938a3e13c44a01f 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java @@ -12,6 +12,7 @@ import org.openapitools.model.Client; import java.util.Date; import java.io.File; import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; @@ -63,6 +64,17 @@ public class FakeApi { this.delegate = delegate; } + @GET + @Path("/health") + + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Health check endpoint", notes = "", response = HealthCheckResult.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "The instance started successfully", response = HealthCheckResult.class) }) + public Response fakeHealthGet(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeHealthGet(securityContext); + } @POST @Path("/outer/boolean") @Consumes({ "application/json" }) diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java index ba32f715d78d57aa64d07a3b9dea9453dda40d54..f42f7694ef6347a11e9678de38a1d6731cca9e0a 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java @@ -10,6 +10,7 @@ import org.openapitools.model.Client; import java.util.Date; import java.io.File; import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; @@ -25,6 +26,7 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; public abstract class FakeApiService { + public abstract Response fakeHealthGet(SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterBooleanSerialize(Boolean body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterCompositeSerialize(OuterComposite outerComposite,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/HealthCheckResult.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/HealthCheckResult.java new file mode 100644 index 0000000000000000000000000000000000000000..ffc2bcfb4ec5c4cb56a64fb932bd7b4e98e8e0e0 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/HealthCheckResult.java @@ -0,0 +1,93 @@ +/* + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@ApiModel(description = "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") + +public class HealthCheckResult { + @JsonProperty("NullableMessage") + private String nullableMessage; + + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + **/ + @JsonProperty("NullableMessage") + @ApiModelProperty(value = "") + + public String getNullableMessage() { + return nullableMessage; + } + + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java index a8a381657a7f10d254350528de07d711e53dc72c..fe6f25e1aaac0c7543538a35a7d76d4d7ef253fa 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -8,6 +8,7 @@ import org.openapitools.model.Client; import java.util.Date; import java.io.File; import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; @@ -25,6 +26,11 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response fakeHealthGet(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } @Override public Response fakeOuterBooleanSerialize(Boolean body, SecurityContext securityContext) throws NotFoundException { // do some magic!