diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 9a55f9e0c08f..eb9920ef67ab 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -55,6 +55,7 @@ declare -a scripts=( "./bin/csharp-netcore-petstore-all.sh" "./bin/elixir-petstore.sh" "./bin/openapi3/go-petstore.sh" +"./bin/go-experimental-petstore.sh" "./bin/go-petstore.sh" "./bin/go-petstore-withxml.sh" "./bin/go-gin-petstore-server.sh" diff --git a/samples/client/petstore/go-experimental/auth_test.go b/samples/client/petstore/go-experimental/auth_test.go index 7da448adced2..1bb5d8175635 100644 --- a/samples/client/petstore/go-experimental/auth_test.go +++ b/samples/client/petstore/go-experimental/auth_test.go @@ -130,7 +130,7 @@ func TestAccessToken(t *testing.T) { } func TestAPIKeyNoPrefix(t *testing.T) { - auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{Key: "TEST123"}) + auth := context.WithValue(context.Background(), sw.ContextAPIKeys, map[string]sw.APIKey{"api_key": sw.APIKey{Key: "TEST123"}}) newPet := (sw.Pet{Id: sw.PtrInt64(12992), Name: sw.PtrString("gopher"), PhotoUrls: &[]string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), @@ -165,7 +165,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { } func TestAPIKeyWithPrefix(t *testing.T) { - auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{Key: "TEST123", Prefix: "Bearer"}) + auth := context.WithValue(context.Background(), sw.ContextAPIKeys, map[string]sw.APIKey{"api_key": sw.APIKey{Key: "TEST123", Prefix: "Bearer"}}) newPet := (sw.Pet{Id: sw.PtrInt64(12992), Name: sw.PtrString("gopher"), PhotoUrls: &[]string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), diff --git a/samples/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION b/samples/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION index d1a8f58b3884..0e97bd19efbf 100644 --- a/samples/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION +++ b/samples/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION @@ -1 +1 @@ -4.1.2-SNAPSHOT \ No newline at end of file +4.1.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/go-experimental/go-petstore/README.md b/samples/client/petstore/go-experimental/go-petstore/README.md index b42cb2731cd7..b976d6549d50 100644 --- a/samples/client/petstore/go-experimental/go-petstore/README.md +++ b/samples/client/petstore/go-experimental/go-petstore/README.md @@ -23,7 +23,7 @@ go get github.com/antihax/optional Put the package under your project folder and add the following in import: ```golang -import "./petstore" +import sw "./petstore" ``` ## Documentation for API Endpoints @@ -125,37 +125,25 @@ Class | Method | HTTP request | Description -## api_key +### api_key - **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header -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) -``` +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key and passed in as the auth context for each request. -## api_key_query +### api_key_query - **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string -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) -``` +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key_query and passed in as the auth context for each request. -## http_basic_test +### http_basic_test - **Type**: HTTP basic authentication @@ -170,7 +158,7 @@ r, err := client.Service.Operation(auth, args) ``` -## petstore_auth +### petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml index 0a1559e1c4b7..37a46abf4feb 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml @@ -1869,6 +1869,10 @@ components: number_item: example: 1.234 type: number + float_item: + example: 1.234 + format: float + type: number integer_item: example: -2 type: integer @@ -1887,6 +1891,7 @@ components: required: - array_item - bool_item + - float_item - integer_item - number_item - string_item diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go index 392ab5c46efb..731d5c00f421 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go @@ -834,11 +834,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) } if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() { - paramJson, err := parameterToJson(localVarOptionals.DateTime.Value()) - if err != nil { - return nil, err - } - localVarFormParams.Add("dateTime", paramJson) + localVarFormParams.Add("dateTime", parameterToString(localVarOptionals.DateTime.Value(), "")) } if localVarOptionals != nil && localVarOptionals.Password.IsSet() { localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), "")) diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go index be67cb585ed1..fcae0074e6c3 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go @@ -69,14 +69,16 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod localVarPostBody = &body 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 + if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := auth["api_key_query"]; ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarQueryParams.Add("api_key_query", key) } - localVarQueryParams.Add("api_key_query", key) } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) diff --git a/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go index 77dccc27684f..b3fd6a6e669f 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go @@ -391,14 +391,16 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne } 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 + if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := auth["api_key"]; ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["api_key"] = key } - localVarHeaderParams["api_key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) diff --git a/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go index e17fc1816ee4..27fa46576c28 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api_store.go +++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go @@ -135,14 +135,16 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, } 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 + if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := auth["api_key"]; ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["api_key"] = key } - localVarHeaderParams["api_key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) diff --git a/samples/client/petstore/go-experimental/go-petstore/configuration.go b/samples/client/petstore/go-experimental/go-petstore/configuration.go index b3b81ad08246..22f01da0a5cd 100644 --- a/samples/client/petstore/go-experimental/go-petstore/configuration.go +++ b/samples/client/petstore/go-experimental/go-petstore/configuration.go @@ -33,8 +33,8 @@ var ( // 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") + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderExample.md b/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderExample.md index f9a276c529f1..3f9349a9b9a5 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderExample.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderExample.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **StringItem** | Pointer to **string** | | **NumberItem** | Pointer to **float32** | | +**FloatItem** | Pointer to **float32** | | **IntegerItem** | Pointer to **int32** | | **BoolItem** | Pointer to **bool** | | **ArrayItem** | Pointer to **[]int32** | | @@ -62,6 +63,31 @@ HasNumberItem returns a boolean if a field has been set. SetNumberItem gets a reference to the given float32 and assigns it to the NumberItem field. +### GetFloatItem + +`func (o *TypeHolderExample) GetFloatItem() float32` + +GetFloatItem returns the FloatItem field if non-nil, zero value otherwise. + +### GetFloatItemOk + +`func (o *TypeHolderExample) GetFloatItemOk() (float32, bool)` + +GetFloatItemOk returns a tuple with the FloatItem field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### HasFloatItem + +`func (o *TypeHolderExample) HasFloatItem() bool` + +HasFloatItem returns a boolean if a field has been set. + +### SetFloatItem + +`func (o *TypeHolderExample) SetFloatItem(v float32)` + +SetFloatItem gets a reference to the given float32 and assigns it to the FloatItem field. + ### GetIntegerItem `func (o *TypeHolderExample) GetIntegerItem() int32` diff --git a/samples/client/petstore/go-experimental/go-petstore/git_push.sh b/samples/client/petstore/go-experimental/go-petstore/git_push.sh index 8442b80bb445..ced3be2b0c7b 100644 --- a/samples/client/petstore/go-experimental/go-petstore/git_push.sh +++ b/samples/client/petstore/go-experimental/go-petstore/git_push.sh @@ -1,11 +1,17 @@ #!/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" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi if [ "$git_user_id" = "" ]; then git_user_id="GIT_USER_ID" @@ -28,7 +34,7 @@ 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. +# Commits the tracked changes and prepares them to be pushed to a remote repository. git commit -m "$release_note" # Sets the new remote @@ -37,9 +43,9 @@ 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 + git remote add origin https://${git_host}/${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 + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -47,6 +53,6 @@ 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" +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go index 8a422eca9f96..e51025fcb74b 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go @@ -18,6 +18,8 @@ type TypeHolderExample struct { NumberItem *float32 `json:"number_item,omitempty"` + FloatItem *float32 `json:"float_item,omitempty"` + IntegerItem *int32 `json:"integer_item,omitempty"` BoolItem *bool `json:"bool_item,omitempty"` @@ -92,6 +94,39 @@ func (o *TypeHolderExample) SetNumberItem(v float32) { o.NumberItem = &v } +// GetFloatItem returns the FloatItem field if non-nil, zero value otherwise. +func (o *TypeHolderExample) GetFloatItem() float32 { + if o == nil || o.FloatItem == nil { + var ret float32 + return ret + } + return *o.FloatItem +} + +// GetFloatItemOk returns a tuple with the FloatItem field if it's non-nil, zero value otherwise +// and a boolean to check if the value has been set. +func (o *TypeHolderExample) GetFloatItemOk() (float32, bool) { + if o == nil || o.FloatItem == nil { + var ret float32 + return ret, false + } + return *o.FloatItem, true +} + +// HasFloatItem returns a boolean if a field has been set. +func (o *TypeHolderExample) HasFloatItem() bool { + if o != nil && o.FloatItem != nil { + return true + } + + return false +} + +// SetFloatItem gets a reference to the given float32 and assigns it to the FloatItem field. +func (o *TypeHolderExample) SetFloatItem(v float32) { + o.FloatItem = &v +} + // GetIntegerItem returns the IntegerItem field if non-nil, zero value otherwise. func (o *TypeHolderExample) GetIntegerItem() int32 { if o == nil || o.IntegerItem == nil { @@ -207,6 +242,12 @@ func (o TypeHolderExample) MarshalJSON() ([]byte, error) { if o.NumberItem != nil { toSerialize["number_item"] = o.NumberItem } + if o.FloatItem == nil { + return nil, errors.New("FloatItem is required and not nullable, but was not set on TypeHolderExample") + } + if o.FloatItem != nil { + toSerialize["float_item"] = o.FloatItem + } if o.IntegerItem == nil { return nil, errors.New("IntegerItem is required and not nullable, but was not set on TypeHolderExample") } diff --git a/samples/server/petstore/go-api-server/.openapi-generator/VERSION b/samples/server/petstore/go-api-server/.openapi-generator/VERSION index afa636560641..0e97bd19efbf 100644 --- a/samples/server/petstore/go-api-server/.openapi-generator/VERSION +++ b/samples/server/petstore/go-api-server/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.1.3-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/go-api-server/Dockerfile b/samples/server/petstore/go-api-server/Dockerfile index 0f512c75104b..cfdfbaed0804 100644 --- a/samples/server/petstore/go-api-server/Dockerfile +++ b/samples/server/petstore/go-api-server/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.10 AS build WORKDIR /go/src -COPY ./ +COPY go ./go COPY main.go . ENV CGO_ENABLED=0 diff --git a/samples/server/petstore/go-api-server/README.md b/samples/server/petstore/go-api-server/README.md new file mode 100644 index 000000000000..fbcf4ae661b0 --- /dev/null +++ b/samples/server/petstore/go-api-server/README.md @@ -0,0 +1,35 @@ +# Go API Server for petstoreserver + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## 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/server/petstore/go-api-server/api/openapi.yaml b/samples/server/petstore/go-api-server/api/openapi.yaml index b25b5c3fe61c..a088e6e6c48b 100644 --- a/samples/server/petstore/go-api-server/api/openapi.yaml +++ b/samples/server/petstore/go-api-server/api/openapi.yaml @@ -1,14 +1,12 @@ -openapi: 3.0.0 +openapi: 3.0.1 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. + 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: @@ -23,9 +21,18 @@ paths: post: operationId: addPet requestBody: - $ref: '#/components/requestBodies/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 responses: 405: + content: {} description: Invalid input security: - petstore_auth: @@ -38,13 +45,24 @@ paths: put: operationId: updatePet requestBody: - $ref: '#/components/requestBodies/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 responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Pet not found 405: + content: {} description: Validation exception security: - petstore_auth: @@ -89,6 +107,7 @@ paths: type: array description: successful operation 400: + content: {} description: Invalid status value security: - petstore_auth: @@ -100,7 +119,8 @@ paths: /pet/findByTags: get: deprecated: true - description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - description: Tags to filter by @@ -128,6 +148,7 @@ paths: type: array description: successful operation 400: + content: {} description: Invalid tag value security: - petstore_auth: @@ -140,24 +161,20 @@ paths: delete: operationId: deletePet parameters: - - explode: false - in: header + - in: header name: api_key - required: false schema: type: string - style: simple - description: Pet id to delete - explode: false in: path name: petId required: true schema: format: int64 type: integer - style: simple responses: 400: + content: {} description: Invalid pet value security: - petstore_auth: @@ -171,14 +188,12 @@ paths: 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: @@ -190,8 +205,10 @@ paths: $ref: '#/components/schemas/Pet' description: successful operation 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Pet not found security: - api_key: [] @@ -202,16 +219,13 @@ paths: 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: @@ -222,9 +236,9 @@ paths: status: description: Updated status of the pet type: string - type: object responses: 405: + content: {} description: Invalid input security: - petstore_auth: @@ -238,16 +252,13 @@ paths: 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: @@ -259,7 +270,6 @@ paths: description: file to upload format: binary type: string - type: object responses: 200: content: @@ -298,7 +308,7 @@ paths: operationId: placeOrder requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/Order' description: order placed for purchasing the pet @@ -314,6 +324,7 @@ paths: $ref: '#/components/schemas/Order' description: successful operation 400: + content: {} description: Invalid Order summary: Place an order for a pet tags: @@ -321,31 +332,32 @@ paths: 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 + 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: orderId required: true schema: type: string - style: simple responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Order not found summary: Delete purchase order by ID tags: - store get: - description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + 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: orderId required: true @@ -354,7 +366,6 @@ paths: maximum: 5 minimum: 1 type: integer - style: simple responses: 200: content: @@ -366,8 +377,10 @@ paths: $ref: '#/components/schemas/Order' description: successful operation 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Order not found summary: Find purchase order by ID tags: @@ -378,13 +391,14 @@ paths: operationId: createUser requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/User' description: Created user object required: true responses: default: + content: {} description: successful operation summary: Create user tags: @@ -394,9 +408,17 @@ paths: post: operationId: createUsersWithArrayInput requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation summary: Creates list of users with given input array tags: @@ -406,9 +428,17 @@ paths: post: operationId: createUsersWithListInput requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation summary: Creates list of users with given input array tags: @@ -419,21 +449,17 @@ paths: 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: @@ -447,19 +473,16 @@ paths: 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: + content: {} description: Invalid username/password supplied summary: Logs user into the system tags: @@ -469,6 +492,7 @@ paths: operationId: logoutUser responses: default: + content: {} description: successful operation summary: Logs out current logged in user session tags: @@ -479,17 +503,17 @@ paths: operationId: deleteUser parameters: - description: The name that needs to be deleted - explode: false in: path name: username required: true schema: type: string - style: simple responses: 400: + content: {} description: Invalid username supplied 404: + content: {} description: User not found summary: Delete user tags: @@ -498,13 +522,11 @@ paths: 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: @@ -516,8 +538,10 @@ paths: $ref: '#/components/schemas/User' description: successful operation 400: + content: {} description: Invalid username supplied 404: + content: {} description: User not found summary: Get user by user name tags: @@ -527,60 +551,30 @@ paths: 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: + content: {} description: Invalid user supplied 404: + content: {} description: User not found summary: Updated user tags: - user x-codegen-request-body-name: body 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 @@ -753,25 +747,6 @@ components: 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: diff --git a/samples/server/petstore/go-api-server/main.go b/samples/server/petstore/go-api-server/main.go index 2e6999c2f480..0c8750779476 100644 --- a/samples/server/petstore/go-api-server/main.go +++ b/samples/server/petstore/go-api-server/main.go @@ -18,9 +18,9 @@ import ( // once you place this file into your project. // For example, // - // sw "github.com/myname/myrepo/" + // sw "github.com/myname/myrepo/go" // - sw "./" + sw "./go" ) func main() {