petstoreserver

package
v4.1.3+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

README

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 from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • 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 for more information.

A workaround is to manually update the path and handler. Please refer to gin-gonic/gin/issues/205#issuecomment-296155497 for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPet

func AddPet(c *gin.Context)

AddPet - Add a new pet to the store

func Call123TestSpecialTags

func Call123TestSpecialTags(c *gin.Context)

Call123TestSpecialTags - To test special tags

func CreateUser

func CreateUser(c *gin.Context)

CreateUser - Create user

func CreateUsersWithArrayInput

func CreateUsersWithArrayInput(c *gin.Context)

CreateUsersWithArrayInput - Creates list of users with given input array

func CreateUsersWithListInput

func CreateUsersWithListInput(c *gin.Context)

CreateUsersWithListInput - Creates list of users with given input array

func DeleteOrder

func DeleteOrder(c *gin.Context)

DeleteOrder - Delete purchase order by ID

func DeletePet

func DeletePet(c *gin.Context)

DeletePet - Deletes a pet

func DeleteUser

func DeleteUser(c *gin.Context)

DeleteUser - Delete user

func FakeHealthGet

func FakeHealthGet(c *gin.Context)

FakeHealthGet - Health check endpoint

func FakeOuterBooleanSerialize

func FakeOuterBooleanSerialize(c *gin.Context)

FakeOuterBooleanSerialize -

func FakeOuterCompositeSerialize

func FakeOuterCompositeSerialize(c *gin.Context)

FakeOuterCompositeSerialize -

func FakeOuterNumberSerialize

func FakeOuterNumberSerialize(c *gin.Context)

FakeOuterNumberSerialize -

func FakeOuterStringSerialize

func FakeOuterStringSerialize(c *gin.Context)

FakeOuterStringSerialize -

func FindPetsByStatus

func FindPetsByStatus(c *gin.Context)

FindPetsByStatus - Finds Pets by status

func FindPetsByTags

func FindPetsByTags(c *gin.Context)

FindPetsByTags - Finds Pets by tags

func FooGet

func FooGet(c *gin.Context)

FooGet -

func GetInventory

func GetInventory(c *gin.Context)

GetInventory - Returns pet inventories by status

func GetOrderById

func GetOrderById(c *gin.Context)

GetOrderById - Find purchase order by ID

func GetPetById

func GetPetById(c *gin.Context)

GetPetById - Find pet by ID

func GetUserByName

func GetUserByName(c *gin.Context)

GetUserByName - Get user by user name

func Index

func Index(c *gin.Context)

Index is the index handler.

func LoginUser

func LoginUser(c *gin.Context)

LoginUser - Logs user into the system

func LogoutUser

func LogoutUser(c *gin.Context)

LogoutUser - Logs out current logged in user session

func NewRouter

func NewRouter() *gin.Engine

NewRouter returns a new router.

func PlaceOrder

func PlaceOrder(c *gin.Context)

PlaceOrder - Place an order for a pet

func TestBodyWithFileSchema

func TestBodyWithFileSchema(c *gin.Context)

TestBodyWithFileSchema -

func TestBodyWithQueryParams

func TestBodyWithQueryParams(c *gin.Context)

TestBodyWithQueryParams -

func TestClassname

func TestClassname(c *gin.Context)

TestClassname - To test class name in snake case

func TestClientModel

func TestClientModel(c *gin.Context)

TestClientModel - To test \"client\" model

func TestEndpointParameters

func TestEndpointParameters(c *gin.Context)

TestEndpointParameters - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트

func TestEnumParameters

func TestEnumParameters(c *gin.Context)

TestEnumParameters - To test enum parameters

func TestGroupParameters

func TestGroupParameters(c *gin.Context)

TestGroupParameters - Fake endpoint to test group parameters (optional)

func TestInlineAdditionalProperties

func TestInlineAdditionalProperties(c *gin.Context)

TestInlineAdditionalProperties - test inline additionalProperties

func TestJsonFormData

func TestJsonFormData(c *gin.Context)

TestJsonFormData - test json serialization of form data

func UpdatePet

func UpdatePet(c *gin.Context)

UpdatePet - Update an existing pet

func UpdatePetWithForm

func UpdatePetWithForm(c *gin.Context)

UpdatePetWithForm - Updates a pet in the store with form data

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser - Updated user

func UploadFile

func UploadFile(c *gin.Context)

UploadFile - uploads an image

func UploadFileWithRequiredFile

func UploadFileWithRequiredFile(c *gin.Context)

UploadFileWithRequiredFile - uploads an image (required)

Types

type AdditionalPropertiesClass

type AdditionalPropertiesClass struct {
	MapProperty map[string]string `json:"map_property,omitempty"`

	MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"`
}

type Animal

type Animal struct {
	ClassName string `json:"className"`

	Color string `json:"color,omitempty"`
}

type ApiResponse

type ApiResponse struct {
	Code int32 `json:"code,omitempty"`

	Type string `json:"type,omitempty"`

	Message string `json:"message,omitempty"`
}

type ArrayOfArrayOfNumberOnly

type ArrayOfArrayOfNumberOnly struct {
	ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
}

type ArrayOfNumberOnly

type ArrayOfNumberOnly struct {
	ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
}

type ArrayTest

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"`
}

type Capitalization

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"`
}

type Cat

type Cat struct {
	ClassName string `json:"className"`

	Color string `json:"color,omitempty"`

	Declawed bool `json:"declawed,omitempty"`
}

type Category

type Category struct {
	Id int64 `json:"id,omitempty"`

	Name string `json:"name"`
}

type ClassModel

type ClassModel struct {
	Class string `json:"_class,omitempty"`
}

ClassModel - Model for testing model with \"_class\" property

type Client

type Client struct {
	Client string `json:"client,omitempty"`
}

type Dog

type Dog struct {
	ClassName string `json:"className"`

	Color string `json:"color,omitempty"`

	Breed string `json:"breed,omitempty"`
}

type EnumArrays

type EnumArrays struct {
	JustSymbol string `json:"just_symbol,omitempty"`

	ArrayEnum []string `json:"array_enum,omitempty"`
}

type EnumClass

type EnumClass string
const (
	ABC EnumClass = "_abc"
	EFG EnumClass = "-efg"
	XYZ EnumClass = "(xyz)"
)

List of EnumClass

type EnumTest

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

	OuterEnumInteger OuterEnumInteger `json:"outerEnumInteger,omitempty"`

	OuterEnumDefaultValue OuterEnumDefaultValue `json:"outerEnumDefaultValue,omitempty"`

	OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue `json:"outerEnumIntegerDefaultValue,omitempty"`
}

type File

type File struct {

	// Test capitalization
	SourceURI string `json:"sourceURI,omitempty"`
}

File - Must be named `File` for test.

type FileSchemaTestClass

type FileSchemaTestClass struct {
	File File `json:"file,omitempty"`

	Files []File `json:"files,omitempty"`
}

type Foo

type Foo struct {
	Bar string `json:"bar,omitempty"`
}

type FormatTest

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"`
}

type HasOnlyReadOnly

type HasOnlyReadOnly struct {
	Bar string `json:"bar,omitempty"`

	Foo string `json:"foo,omitempty"`
}

type HealthCheckResult

type HealthCheckResult struct {
	NullableMessage *string `json:"NullableMessage,omitempty"`
}

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 InlineObject

type InlineObject struct {

	// Updated name of the pet
	Name string `json:"name,omitempty"`

	// Updated status of the pet
	Status string `json:"status,omitempty"`
}

type InlineObject1

type InlineObject1 struct {

	// Additional data to pass to server
	AdditionalMetadata string `json:"additionalMetadata,omitempty"`

	// file to upload
	File *os.File `json:"file,omitempty"`
}

type InlineObject2

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"`
}

type InlineObject3

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"`
}

type InlineObject4

type InlineObject4 struct {

	// field1
	Param string `json:"param"`

	// field2
	Param2 string `json:"param2"`
}

type InlineObject5

type InlineObject5 struct {

	// Additional data to pass to server
	AdditionalMetadata string `json:"additionalMetadata,omitempty"`

	// file to upload
	RequiredFile *os.File `json:"requiredFile"`
}

type InlineResponseDefault

type InlineResponseDefault struct {
	String Foo `json:"string,omitempty"`
}

type List

type List struct {
	Var123List string `json:"123-list,omitempty"`
}

type MapTest

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"`
}

type MixedPropertiesAndAdditionalPropertiesClass

type MixedPropertiesAndAdditionalPropertiesClass struct {
	Uuid string `json:"uuid,omitempty"`

	DateTime time.Time `json:"dateTime,omitempty"`

	Map map[string]Animal `json:"map,omitempty"`
}

type Model200Response

type Model200Response struct {
	Name int32 `json:"name,omitempty"`

	Class string `json:"class,omitempty"`
}

Model200Response - Model for testing model name starting with number

type Name

type Name struct {
	Name int32 `json:"name"`

	SnakeCase int32 `json:"snake_case,omitempty"`

	Property string `json:"property,omitempty"`

	Var123Number int32 `json:"123Number,omitempty"`
}

Name - Model for testing model name same as property name

type NumberOnly

type NumberOnly struct {
	JustNumber float32 `json:"JustNumber,omitempty"`
}

type Order

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"`
}

type OuterComposite

type OuterComposite struct {
	MyNumber float32 `json:"my_number,omitempty"`

	MyString string `json:"my_string,omitempty"`

	MyBoolean bool `json:"my_boolean,omitempty"`
}

type OuterEnum

type OuterEnum string
const (
	PLACED    OuterEnum = "placed"
	APPROVED  OuterEnum = "approved"
	DELIVERED OuterEnum = "delivered"
)

List of OuterEnum

type OuterEnumDefaultValue

type OuterEnumDefaultValue string
const (
	PLACED    OuterEnumDefaultValue = "placed"
	APPROVED  OuterEnumDefaultValue = "approved"
	DELIVERED OuterEnumDefaultValue = "delivered"
)

List of OuterEnumDefaultValue

type OuterEnumInteger

type OuterEnumInteger int32

type OuterEnumIntegerDefaultValue

type OuterEnumIntegerDefaultValue int32

type Pet

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"`
}

type ReadOnlyFirst

type ReadOnlyFirst struct {
	Bar string `json:"bar,omitempty"`

	Baz string `json:"baz,omitempty"`
}

type Return

type Return struct {
	Return int32 `json:"return,omitempty"`
}

Return - Model for testing reserved words

type Route

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
}

Route is the information for every URI.

type Routes

type Routes []Route

Routes is the list of the generated Route.

type SpecialModelName

type SpecialModelName struct {
	SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
}

type Tag

type Tag struct {
	Id int64 `json:"id,omitempty"`

	Name string `json:"name,omitempty"`
}

type User

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL