[golang] Regenerate all go samples (#3988)

* Regenerate all go samples

* Update API Key usage

* Add go-experimental script
This commit is contained in:
sunn
2019-09-30 18:38:51 +02:00
committed by GitHub
parent 7dbda049f0
commit 600a81f76e
18 changed files with 240 additions and 161 deletions

View File

@@ -55,6 +55,7 @@ declare -a scripts=(
"./bin/csharp-netcore-petstore-all.sh" "./bin/csharp-netcore-petstore-all.sh"
"./bin/elixir-petstore.sh" "./bin/elixir-petstore.sh"
"./bin/openapi3/go-petstore.sh" "./bin/openapi3/go-petstore.sh"
"./bin/go-experimental-petstore.sh"
"./bin/go-petstore.sh" "./bin/go-petstore.sh"
"./bin/go-petstore-withxml.sh" "./bin/go-petstore-withxml.sh"
"./bin/go-gin-petstore-server.sh" "./bin/go-gin-petstore-server.sh"

View File

@@ -130,7 +130,7 @@ func TestAccessToken(t *testing.T) {
} }
func TestAPIKeyNoPrefix(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"), newPet := (sw.Pet{Id: sw.PtrInt64(12992), Name: sw.PtrString("gopher"),
PhotoUrls: &[]string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), 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) { 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"), newPet := (sw.Pet{Id: sw.PtrInt64(12992), Name: sw.PtrString("gopher"),
PhotoUrls: &[]string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"), PhotoUrls: &[]string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),

View File

@@ -1 +1 @@
4.1.2-SNAPSHOT 4.1.3-SNAPSHOT

View File

@@ -23,7 +23,7 @@ go get github.com/antihax/optional
Put the package under your project folder and add the following in import: Put the package under your project folder and add the following in import:
```golang ```golang
import "./petstore" import sw "./petstore"
``` ```
## Documentation for API Endpoints ## Documentation for API Endpoints
@@ -125,37 +125,25 @@ Class | Method | HTTP request | Description
## api_key ### api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
Example 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.
```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 ### api_key_query
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key_query
- **Location**: URL query string
Example 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.
```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 ### http_basic_test
- **Type**: HTTP basic authentication - **Type**: HTTP basic authentication
@@ -170,7 +158,7 @@ r, err := client.Service.Operation(auth, args)
``` ```
## petstore_auth ### petstore_auth
- **Type**: OAuth - **Type**: OAuth

View File

@@ -1869,6 +1869,10 @@ components:
number_item: number_item:
example: 1.234 example: 1.234
type: number type: number
float_item:
example: 1.234
format: float
type: number
integer_item: integer_item:
example: -2 example: -2
type: integer type: integer
@@ -1887,6 +1891,7 @@ components:
required: required:
- array_item - array_item
- bool_item - bool_item
- float_item
- integer_item - integer_item
- number_item - number_item
- string_item - string_item

View File

@@ -834,11 +834,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx _context.Context, number flo
localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), "")) localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
} }
if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() { if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() {
paramJson, err := parameterToJson(localVarOptionals.DateTime.Value()) localVarFormParams.Add("dateTime", parameterToString(localVarOptionals.DateTime.Value(), ""))
if err != nil {
return nil, err
}
localVarFormParams.Add("dateTime", paramJson)
} }
if localVarOptionals != nil && localVarOptionals.Password.IsSet() { if localVarOptionals != nil && localVarOptionals.Password.IsSet() {
localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), "")) localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), ""))

View File

@@ -69,14 +69,16 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod
localVarPostBody = &body localVarPostBody = &body
if ctx != nil { if ctx != nil {
// API Key Authentication // API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
var key string if auth, ok := auth["api_key_query"]; ok {
if auth.Prefix != "" { var key string
key = auth.Prefix + " " + auth.Key if auth.Prefix != "" {
} else { key = auth.Prefix + " " + auth.Key
key = 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) r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)

View File

@@ -391,14 +391,16 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
} }
if ctx != nil { if ctx != nil {
// API Key Authentication // API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
var key string if auth, ok := auth["api_key"]; ok {
if auth.Prefix != "" { var key string
key = auth.Prefix + " " + auth.Key if auth.Prefix != "" {
} else { key = auth.Prefix + " " + auth.Key
key = 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) r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)

View File

@@ -135,14 +135,16 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
} }
if ctx != nil { if ctx != nil {
// API Key Authentication // API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
var key string if auth, ok := auth["api_key"]; ok {
if auth.Prefix != "" { var key string
key = auth.Prefix + " " + auth.Key if auth.Prefix != "" {
} else { key = auth.Prefix + " " + auth.Key
key = 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) r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)

View File

@@ -33,8 +33,8 @@ var (
// ContextAccessToken takes a string oauth2 access token as authentication for the request. // ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAccessToken = contextKey("accesstoken") ContextAccessToken = contextKey("accesstoken")
// ContextAPIKey takes an APIKey as authentication for the request // ContextAPIKeys takes a string apikey as authentication for the request
ContextAPIKey = contextKey("apikey") ContextAPIKeys = contextKey("apiKeys")
) )
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

View File

@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**StringItem** | Pointer to **string** | | **StringItem** | Pointer to **string** | |
**NumberItem** | Pointer to **float32** | | **NumberItem** | Pointer to **float32** | |
**FloatItem** | Pointer to **float32** | |
**IntegerItem** | Pointer to **int32** | | **IntegerItem** | Pointer to **int32** | |
**BoolItem** | Pointer to **bool** | | **BoolItem** | Pointer to **bool** | |
**ArrayItem** | Pointer to **[]int32** | | **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. 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 ### GetIntegerItem
`func (o *TypeHolderExample) GetIntegerItem() int32` `func (o *TypeHolderExample) GetIntegerItem() int32`

View File

@@ -1,11 +1,17 @@
#!/bin/sh #!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # 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_user_id=$1
git_repo_id=$2 git_repo_id=$2
release_note=$3 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 if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID" git_user_id="GIT_USER_ID"
@@ -28,7 +34,7 @@ git init
# Adds the files in the local repository and stages them for commit. # Adds the files in the local repository and stages them for commit.
git add . 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" git commit -m "$release_note"
# Sets the new remote # Sets the new remote
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." 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 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
fi fi
@@ -47,6 +53,6 @@ fi
git pull origin master git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository # 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' git push origin master 2>&1 | grep -v 'To https'

View File

@@ -18,6 +18,8 @@ type TypeHolderExample struct {
NumberItem *float32 `json:"number_item,omitempty"` NumberItem *float32 `json:"number_item,omitempty"`
FloatItem *float32 `json:"float_item,omitempty"`
IntegerItem *int32 `json:"integer_item,omitempty"` IntegerItem *int32 `json:"integer_item,omitempty"`
BoolItem *bool `json:"bool_item,omitempty"` BoolItem *bool `json:"bool_item,omitempty"`
@@ -92,6 +94,39 @@ func (o *TypeHolderExample) SetNumberItem(v float32) {
o.NumberItem = &v 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. // GetIntegerItem returns the IntegerItem field if non-nil, zero value otherwise.
func (o *TypeHolderExample) GetIntegerItem() int32 { func (o *TypeHolderExample) GetIntegerItem() int32 {
if o == nil || o.IntegerItem == nil { if o == nil || o.IntegerItem == nil {
@@ -207,6 +242,12 @@ func (o TypeHolderExample) MarshalJSON() ([]byte, error) {
if o.NumberItem != nil { if o.NumberItem != nil {
toSerialize["number_item"] = o.NumberItem 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 { if o.IntegerItem == nil {
return nil, errors.New("IntegerItem is required and not nullable, but was not set on TypeHolderExample") return nil, errors.New("IntegerItem is required and not nullable, but was not set on TypeHolderExample")
} }

View File

@@ -1 +1 @@
4.0.0-SNAPSHOT 4.1.3-SNAPSHOT

View File

@@ -1,6 +1,6 @@
FROM golang:1.10 AS build FROM golang:1.10 AS build
WORKDIR /go/src WORKDIR /go/src
COPY ./ COPY go ./go
COPY main.go . COPY main.go .
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0

View File

@@ -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
```

View File

@@ -1,14 +1,12 @@
openapi: 3.0.0 openapi: 3.0.1
info: 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: license:
name: Apache-2.0 name: Apache-2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html url: http://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Petstore title: OpenAPI Petstore
version: 1.0.0 version: 1.0.0
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers: servers:
- url: http://petstore.swagger.io/v2 - url: http://petstore.swagger.io/v2
tags: tags:
@@ -23,9 +21,18 @@ paths:
post: post:
operationId: addPet operationId: addPet
requestBody: 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: responses:
405: 405:
content: {}
description: Invalid input description: Invalid input
security: security:
- petstore_auth: - petstore_auth:
@@ -38,13 +45,24 @@ paths:
put: put:
operationId: updatePet operationId: updatePet
requestBody: 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: responses:
400: 400:
content: {}
description: Invalid ID supplied description: Invalid ID supplied
404: 404:
content: {}
description: Pet not found description: Pet not found
405: 405:
content: {}
description: Validation exception description: Validation exception
security: security:
- petstore_auth: - petstore_auth:
@@ -89,6 +107,7 @@ paths:
type: array type: array
description: successful operation description: successful operation
400: 400:
content: {}
description: Invalid status value description: Invalid status value
security: security:
- petstore_auth: - petstore_auth:
@@ -100,7 +119,8 @@ paths:
/pet/findByTags: /pet/findByTags:
get: get:
deprecated: true 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 operationId: findPetsByTags
parameters: parameters:
- description: Tags to filter by - description: Tags to filter by
@@ -128,6 +148,7 @@ paths:
type: array type: array
description: successful operation description: successful operation
400: 400:
content: {}
description: Invalid tag value description: Invalid tag value
security: security:
- petstore_auth: - petstore_auth:
@@ -140,24 +161,20 @@ paths:
delete: delete:
operationId: deletePet operationId: deletePet
parameters: parameters:
- explode: false - in: header
in: header
name: api_key name: api_key
required: false
schema: schema:
type: string type: string
style: simple
- description: Pet id to delete - description: Pet id to delete
explode: false
in: path in: path
name: petId name: petId
required: true required: true
schema: schema:
format: int64 format: int64
type: integer type: integer
style: simple
responses: responses:
400: 400:
content: {}
description: Invalid pet value description: Invalid pet value
security: security:
- petstore_auth: - petstore_auth:
@@ -171,14 +188,12 @@ paths:
operationId: getPetById operationId: getPetById
parameters: parameters:
- description: ID of pet to return - description: ID of pet to return
explode: false
in: path in: path
name: petId name: petId
required: true required: true
schema: schema:
format: int64 format: int64
type: integer type: integer
style: simple
responses: responses:
200: 200:
content: content:
@@ -190,8 +205,10 @@ paths:
$ref: '#/components/schemas/Pet' $ref: '#/components/schemas/Pet'
description: successful operation description: successful operation
400: 400:
content: {}
description: Invalid ID supplied description: Invalid ID supplied
404: 404:
content: {}
description: Pet not found description: Pet not found
security: security:
- api_key: [] - api_key: []
@@ -202,16 +219,13 @@ paths:
operationId: updatePetWithForm operationId: updatePetWithForm
parameters: parameters:
- description: ID of pet that needs to be updated - description: ID of pet that needs to be updated
explode: false
in: path in: path
name: petId name: petId
required: true required: true
schema: schema:
format: int64 format: int64
type: integer type: integer
style: simple
requestBody: requestBody:
$ref: '#/components/requestBodies/inline_object'
content: content:
application/x-www-form-urlencoded: application/x-www-form-urlencoded:
schema: schema:
@@ -222,9 +236,9 @@ paths:
status: status:
description: Updated status of the pet description: Updated status of the pet
type: string type: string
type: object
responses: responses:
405: 405:
content: {}
description: Invalid input description: Invalid input
security: security:
- petstore_auth: - petstore_auth:
@@ -238,16 +252,13 @@ paths:
operationId: uploadFile operationId: uploadFile
parameters: parameters:
- description: ID of pet to update - description: ID of pet to update
explode: false
in: path in: path
name: petId name: petId
required: true required: true
schema: schema:
format: int64 format: int64
type: integer type: integer
style: simple
requestBody: requestBody:
$ref: '#/components/requestBodies/inline_object_1'
content: content:
multipart/form-data: multipart/form-data:
schema: schema:
@@ -259,7 +270,6 @@ paths:
description: file to upload description: file to upload
format: binary format: binary
type: string type: string
type: object
responses: responses:
200: 200:
content: content:
@@ -298,7 +308,7 @@ paths:
operationId: placeOrder operationId: placeOrder
requestBody: requestBody:
content: content:
application/json: '*/*':
schema: schema:
$ref: '#/components/schemas/Order' $ref: '#/components/schemas/Order'
description: order placed for purchasing the pet description: order placed for purchasing the pet
@@ -314,6 +324,7 @@ paths:
$ref: '#/components/schemas/Order' $ref: '#/components/schemas/Order'
description: successful operation description: successful operation
400: 400:
content: {}
description: Invalid Order description: Invalid Order
summary: Place an order for a pet summary: Place an order for a pet
tags: tags:
@@ -321,31 +332,32 @@ paths:
x-codegen-request-body-name: body x-codegen-request-body-name: body
/store/order/{orderId}: /store/order/{orderId}:
delete: 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 operationId: deleteOrder
parameters: parameters:
- description: ID of the order that needs to be deleted - description: ID of the order that needs to be deleted
explode: false
in: path in: path
name: orderId name: orderId
required: true required: true
schema: schema:
type: string type: string
style: simple
responses: responses:
400: 400:
content: {}
description: Invalid ID supplied description: Invalid ID supplied
404: 404:
content: {}
description: Order not found description: Order not found
summary: Delete purchase order by ID summary: Delete purchase order by ID
tags: tags:
- store - store
get: 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 operationId: getOrderById
parameters: parameters:
- description: ID of pet that needs to be fetched - description: ID of pet that needs to be fetched
explode: false
in: path in: path
name: orderId name: orderId
required: true required: true
@@ -354,7 +366,6 @@ paths:
maximum: 5 maximum: 5
minimum: 1 minimum: 1
type: integer type: integer
style: simple
responses: responses:
200: 200:
content: content:
@@ -366,8 +377,10 @@ paths:
$ref: '#/components/schemas/Order' $ref: '#/components/schemas/Order'
description: successful operation description: successful operation
400: 400:
content: {}
description: Invalid ID supplied description: Invalid ID supplied
404: 404:
content: {}
description: Order not found description: Order not found
summary: Find purchase order by ID summary: Find purchase order by ID
tags: tags:
@@ -378,13 +391,14 @@ paths:
operationId: createUser operationId: createUser
requestBody: requestBody:
content: content:
application/json: '*/*':
schema: schema:
$ref: '#/components/schemas/User' $ref: '#/components/schemas/User'
description: Created user object description: Created user object
required: true required: true
responses: responses:
default: default:
content: {}
description: successful operation description: successful operation
summary: Create user summary: Create user
tags: tags:
@@ -394,9 +408,17 @@ paths:
post: post:
operationId: createUsersWithArrayInput operationId: createUsersWithArrayInput
requestBody: requestBody:
$ref: '#/components/requestBodies/UserArray' content:
'*/*':
schema:
items:
$ref: '#/components/schemas/User'
type: array
description: List of user object
required: true
responses: responses:
default: default:
content: {}
description: successful operation description: successful operation
summary: Creates list of users with given input array summary: Creates list of users with given input array
tags: tags:
@@ -406,9 +428,17 @@ paths:
post: post:
operationId: createUsersWithListInput operationId: createUsersWithListInput
requestBody: requestBody:
$ref: '#/components/requestBodies/UserArray' content:
'*/*':
schema:
items:
$ref: '#/components/schemas/User'
type: array
description: List of user object
required: true
responses: responses:
default: default:
content: {}
description: successful operation description: successful operation
summary: Creates list of users with given input array summary: Creates list of users with given input array
tags: tags:
@@ -419,21 +449,17 @@ paths:
operationId: loginUser operationId: loginUser
parameters: parameters:
- description: The user name for login - description: The user name for login
explode: true
in: query in: query
name: username name: username
required: true required: true
schema: schema:
type: string type: string
style: form
- description: The password for login in clear text - description: The password for login in clear text
explode: true
in: query in: query
name: password name: password
required: true required: true
schema: schema:
type: string type: string
style: form
responses: responses:
200: 200:
content: content:
@@ -447,19 +473,16 @@ paths:
headers: headers:
X-Rate-Limit: X-Rate-Limit:
description: calls per hour allowed by the user description: calls per hour allowed by the user
explode: false
schema: schema:
format: int32 format: int32
type: integer type: integer
style: simple
X-Expires-After: X-Expires-After:
description: date in UTC when toekn expires description: date in UTC when toekn expires
explode: false
schema: schema:
format: date-time format: date-time
type: string type: string
style: simple
400: 400:
content: {}
description: Invalid username/password supplied description: Invalid username/password supplied
summary: Logs user into the system summary: Logs user into the system
tags: tags:
@@ -469,6 +492,7 @@ paths:
operationId: logoutUser operationId: logoutUser
responses: responses:
default: default:
content: {}
description: successful operation description: successful operation
summary: Logs out current logged in user session summary: Logs out current logged in user session
tags: tags:
@@ -479,17 +503,17 @@ paths:
operationId: deleteUser operationId: deleteUser
parameters: parameters:
- description: The name that needs to be deleted - description: The name that needs to be deleted
explode: false
in: path in: path
name: username name: username
required: true required: true
schema: schema:
type: string type: string
style: simple
responses: responses:
400: 400:
content: {}
description: Invalid username supplied description: Invalid username supplied
404: 404:
content: {}
description: User not found description: User not found
summary: Delete user summary: Delete user
tags: tags:
@@ -498,13 +522,11 @@ paths:
operationId: getUserByName operationId: getUserByName
parameters: parameters:
- description: The name that needs to be fetched. Use user1 for testing. - description: The name that needs to be fetched. Use user1 for testing.
explode: false
in: path in: path
name: username name: username
required: true required: true
schema: schema:
type: string type: string
style: simple
responses: responses:
200: 200:
content: content:
@@ -516,8 +538,10 @@ paths:
$ref: '#/components/schemas/User' $ref: '#/components/schemas/User'
description: successful operation description: successful operation
400: 400:
content: {}
description: Invalid username supplied description: Invalid username supplied
404: 404:
content: {}
description: User not found description: User not found
summary: Get user by user name summary: Get user by user name
tags: tags:
@@ -527,60 +551,30 @@ paths:
operationId: updateUser operationId: updateUser
parameters: parameters:
- description: name that need to be deleted - description: name that need to be deleted
explode: false
in: path in: path
name: username name: username
required: true required: true
schema: schema:
type: string type: string
style: simple
requestBody: requestBody:
content: content:
application/json: '*/*':
schema: schema:
$ref: '#/components/schemas/User' $ref: '#/components/schemas/User'
description: Updated user object description: Updated user object
required: true required: true
responses: responses:
400: 400:
content: {}
description: Invalid user supplied description: Invalid user supplied
404: 404:
content: {}
description: User not found description: User not found
summary: Updated user summary: Updated user
tags: tags:
- user - user
x-codegen-request-body-name: body x-codegen-request-body-name: body
components: 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: schemas:
Order: Order:
description: An order for a pets from the pet store description: An order for a pets from the pet store
@@ -753,25 +747,6 @@ components:
type: string type: string
title: An uploaded response title: An uploaded response
type: object 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: securitySchemes:
petstore_auth: petstore_auth:
flows: flows:

View File

@@ -18,9 +18,9 @@ import (
// once you place this file into your project. // once you place this file into your project.
// For example, // For example,
// //
// sw "github.com/myname/myrepo/" // sw "github.com/myname/myrepo/go"
// //
sw "./" sw "./go"
) )
func main() { func main() {