Migrate Go server samples to OAS 3 only (#6471)

* migrate go server samples to oas3

* add back pom.xml
This commit is contained in:
William Cheng
2020-05-29 11:42:07 +08:00
committed by GitHub
parent bde0d77c8f
commit 52fcdd5974
141 changed files with 308 additions and 8403 deletions

View File

@@ -25,7 +25,7 @@ then
mvn -B clean package
fi
SPEC="modules/openapi-generator/src/test/resources/2_0/petstore.yaml"
SPEC="modules/openapi-generator/src/test/resources/3_0/petstore.yaml"
GENERATOR="go-gin-server"
STUB_DIR="samples/server/petstore/go-gin-api-server"

View File

@@ -25,7 +25,7 @@ then
mvn -B clean package
fi
SPEC="modules/openapi-generator/src/test/resources/2_0/petstore.yaml"
SPEC="modules/openapi-generator/src/test/resources/3_0/petstore.yaml"
GENERATOR="go-server"
STUB_DIR="samples/server/petstore/go-api-server"

View File

@@ -6,7 +6,7 @@ If Not Exist %executable% (
mvn clean package
)
set SPEC=modules\openapi-generator\src\test\resources\2_0\petstore.yaml
set SPEC=modules\openapi-generator\src\test\resources\3_0\petstore.yaml
set GENERATOR=go-gin-server
set STUB_DIR=samples\server\petstore\go-gin-api-server

View File

@@ -6,7 +6,7 @@ If Not Exist %executable% (
mvn clean package
)
set SPEC=modules\openapi-generator\src\test\resources\2_0\petstore.yaml
set SPEC=modules\openapi-generator\src\test\resources\3_0\petstore.yaml
set GENERATOR=go-server
set STUB_DIR=samples\server\petstore\go-api-server

View File

@@ -1,23 +0,0 @@
# 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

View File

@@ -1,14 +0,0 @@
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"]

View File

@@ -1,35 +0,0 @@
# 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
```

File diff suppressed because it is too large Load Diff

View File

@@ -1,57 +0,0 @@
/*
* 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 (
"encoding/json"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// A AnotherFakeApiController binds http requests to an api service and writes the service results to the http response
type AnotherFakeApiController struct {
service AnotherFakeApiServicer
}
// NewAnotherFakeApiController creates a default api controller
func NewAnotherFakeApiController(s AnotherFakeApiServicer) Router {
return &AnotherFakeApiController{ service: s }
}
// Routes returns all of the api route for the AnotherFakeApiController
func (c *AnotherFakeApiController) Routes() Routes {
return Routes{
{
"Call123TestSpecialTags",
strings.ToUpper("Patch"),
"/v2/another-fake/dummy",
c.Call123TestSpecialTags,
},
}
}
// Call123TestSpecialTags - To test special tags
func (c *AnotherFakeApiController) Call123TestSpecialTags(w http.ResponseWriter, r *http.Request) {
client := &Client{}
if err := json.NewDecoder(r.Body).Decode(&client); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.Call123TestSpecialTags(*client)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}

View File

@@ -1,51 +0,0 @@
/*
* 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 (
"encoding/json"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// A DefaultApiController binds http requests to an api service and writes the service results to the http response
type DefaultApiController struct {
service DefaultApiServicer
}
// NewDefaultApiController creates a default api controller
func NewDefaultApiController(s DefaultApiServicer) Router {
return &DefaultApiController{ service: s }
}
// Routes returns all of the api route for the DefaultApiController
func (c *DefaultApiController) Routes() Routes {
return Routes{
{
"FooGet",
strings.ToUpper("Get"),
"/v2/foo",
c.FooGet,
},
}
}
// FooGet -
func (c *DefaultApiController) FooGet(w http.ResponseWriter, r *http.Request) {
result, err := c.service.FooGet()
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}

View File

@@ -1,398 +0,0 @@
/*
* 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 (
"encoding/json"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// A FakeApiController binds http requests to an api service and writes the service results to the http response
type FakeApiController struct {
service FakeApiServicer
}
// NewFakeApiController creates a default api controller
func NewFakeApiController(s FakeApiServicer) Router {
return &FakeApiController{ service: s }
}
// Routes returns all of the api route for the FakeApiController
func (c *FakeApiController) Routes() Routes {
return Routes{
{
"FakeHealthGet",
strings.ToUpper("Get"),
"/v2/fake/health",
c.FakeHealthGet,
},
{
"FakeOuterBooleanSerialize",
strings.ToUpper("Post"),
"/v2/fake/outer/boolean",
c.FakeOuterBooleanSerialize,
},
{
"FakeOuterCompositeSerialize",
strings.ToUpper("Post"),
"/v2/fake/outer/composite",
c.FakeOuterCompositeSerialize,
},
{
"FakeOuterNumberSerialize",
strings.ToUpper("Post"),
"/v2/fake/outer/number",
c.FakeOuterNumberSerialize,
},
{
"FakeOuterStringSerialize",
strings.ToUpper("Post"),
"/v2/fake/outer/string",
c.FakeOuterStringSerialize,
},
{
"TestBodyWithFileSchema",
strings.ToUpper("Put"),
"/v2/fake/body-with-file-schema",
c.TestBodyWithFileSchema,
},
{
"TestBodyWithQueryParams",
strings.ToUpper("Put"),
"/v2/fake/body-with-query-params",
c.TestBodyWithQueryParams,
},
{
"TestClientModel",
strings.ToUpper("Patch"),
"/v2/fake",
c.TestClientModel,
},
{
"TestEndpointParameters",
strings.ToUpper("Post"),
"/v2/fake",
c.TestEndpointParameters,
},
{
"TestEnumParameters",
strings.ToUpper("Get"),
"/v2/fake",
c.TestEnumParameters,
},
{
"TestGroupParameters",
strings.ToUpper("Delete"),
"/v2/fake",
c.TestGroupParameters,
},
{
"TestInlineAdditionalProperties",
strings.ToUpper("Post"),
"/v2/fake/inline-additionalProperties",
c.TestInlineAdditionalProperties,
},
{
"TestJsonFormData",
strings.ToUpper("Get"),
"/v2/fake/jsonFormData",
c.TestJsonFormData,
},
{
"TestQueryParameterCollectionFormat",
strings.ToUpper("Put"),
"/v2/fake/test-query-paramters",
c.TestQueryParameterCollectionFormat,
},
}
}
// FakeHealthGet - Health check endpoint
func (c *FakeApiController) FakeHealthGet(w http.ResponseWriter, r *http.Request) {
result, err := c.service.FakeHealthGet()
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// FakeOuterBooleanSerialize -
func (c *FakeApiController) FakeOuterBooleanSerialize(w http.ResponseWriter, r *http.Request) {
body := &bool{}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.FakeOuterBooleanSerialize(*body)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// FakeOuterCompositeSerialize -
func (c *FakeApiController) FakeOuterCompositeSerialize(w http.ResponseWriter, r *http.Request) {
outerComposite := &OuterComposite{}
if err := json.NewDecoder(r.Body).Decode(&outerComposite); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.FakeOuterCompositeSerialize(*outerComposite)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// FakeOuterNumberSerialize -
func (c *FakeApiController) FakeOuterNumberSerialize(w http.ResponseWriter, r *http.Request) {
body := &float32{}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.FakeOuterNumberSerialize(*body)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// FakeOuterStringSerialize -
func (c *FakeApiController) FakeOuterStringSerialize(w http.ResponseWriter, r *http.Request) {
body := &string{}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.FakeOuterStringSerialize(*body)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestBodyWithFileSchema -
func (c *FakeApiController) TestBodyWithFileSchema(w http.ResponseWriter, r *http.Request) {
fileSchemaTestClass := &FileSchemaTestClass{}
if err := json.NewDecoder(r.Body).Decode(&fileSchemaTestClass); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.TestBodyWithFileSchema(*fileSchemaTestClass)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestBodyWithQueryParams -
func (c *FakeApiController) TestBodyWithQueryParams(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
query := query.Get("query")
user := &User{}
if err := json.NewDecoder(r.Body).Decode(&user); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.TestBodyWithQueryParams(query, *user)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestClientModel - To test \"client\" model
func (c *FakeApiController) TestClientModel(w http.ResponseWriter, r *http.Request) {
client := &Client{}
if err := json.NewDecoder(r.Body).Decode(&client); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.TestClientModel(*client)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestEndpointParameters - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
func (c *FakeApiController) TestEndpointParameters(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
w.WriteHeader(500)
return
}
number := r.FormValue("number")
double := r.FormValue("double")
patternWithoutDelimiter := r.FormValue("patternWithoutDelimiter")
byte_ := r.FormValue("byte_")
integer := r.FormValue("integer")
int32_ := r.FormValue("int32_")
int64_, err := parseIntParameter( r.FormValue("int64_"))
if err != nil {
w.WriteHeader(500)
return
}
float := r.FormValue("float")
string_ := r.FormValue("string_")
binary, err := ReadFormFileToTempFile(r, "binary")
if err != nil {
w.WriteHeader(500)
return
}
date := r.FormValue("date")
dateTime := r.FormValue("dateTime")
password := r.FormValue("password")
callback := r.FormValue("callback")
result, err := c.service.TestEndpointParameters(number, double, patternWithoutDelimiter, byte_, integer, int32_, int64_, float, string_, binary, date, dateTime, password, callback)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestEnumParameters - To test enum parameters
func (c *FakeApiController) TestEnumParameters(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
w.WriteHeader(500)
return
}
query := r.URL.Query()
enumHeaderStringArray := r.Header.Get("enumHeaderStringArray")
enumHeaderString := r.Header.Get("enumHeaderString")
enumQueryStringArray := strings.Split(query.Get("enumQueryStringArray"), ",")
enumQueryString := query.Get("enumQueryString")
enumQueryInteger := query.Get("enumQueryInteger")
enumQueryDouble := query.Get("enumQueryDouble")
enumFormStringArray := r.FormValue("enumFormStringArray")
enumFormString := r.FormValue("enumFormString")
result, err := c.service.TestEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestGroupParameters - Fake endpoint to test group parameters (optional)
func (c *FakeApiController) TestGroupParameters(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
requiredStringGroup := query.Get("requiredStringGroup")
requiredBooleanGroup := r.Header.Get("requiredBooleanGroup")
requiredInt64Group, err := parseIntParameter(query.Get("requiredInt64Group"))
if err != nil {
w.WriteHeader(500)
return
}
stringGroup := query.Get("stringGroup")
booleanGroup := r.Header.Get("booleanGroup")
int64Group, err := parseIntParameter(query.Get("int64Group"))
if err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.TestGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestInlineAdditionalProperties - test inline additionalProperties
func (c *FakeApiController) TestInlineAdditionalProperties(w http.ResponseWriter, r *http.Request) {
requestBody := &map[string]string{}
if err := json.NewDecoder(r.Body).Decode(&requestBody); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.TestInlineAdditionalProperties(*requestBody)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestJsonFormData - test json serialization of form data
func (c *FakeApiController) TestJsonFormData(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
w.WriteHeader(500)
return
}
param := r.FormValue("param")
param2 := r.FormValue("param2")
result, err := c.service.TestJsonFormData(param, param2)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// TestQueryParameterCollectionFormat -
func (c *FakeApiController) TestQueryParameterCollectionFormat(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
pipe := strings.Split(query.Get("pipe"), ",")
ioutil := strings.Split(query.Get("ioutil"), ",")
http := strings.Split(query.Get("http"), ",")
url := strings.Split(query.Get("url"), ",")
context := strings.Split(query.Get("context"), ",")
result, err := c.service.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}

View File

@@ -1,57 +0,0 @@
/*
* 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 (
"encoding/json"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// A FakeClassnameTags123ApiController binds http requests to an api service and writes the service results to the http response
type FakeClassnameTags123ApiController struct {
service FakeClassnameTags123ApiServicer
}
// NewFakeClassnameTags123ApiController creates a default api controller
func NewFakeClassnameTags123ApiController(s FakeClassnameTags123ApiServicer) Router {
return &FakeClassnameTags123ApiController{ service: s }
}
// Routes returns all of the api route for the FakeClassnameTags123ApiController
func (c *FakeClassnameTags123ApiController) Routes() Routes {
return Routes{
{
"TestClassname",
strings.ToUpper("Patch"),
"/v2/fake_classname_test",
c.TestClassname,
},
}
}
// TestClassname - To test class name in snake case
func (c *FakeClassnameTags123ApiController) TestClassname(w http.ResponseWriter, r *http.Request) {
client := &Client{}
if err := json.NewDecoder(r.Body).Decode(&client); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.TestClassname(*client)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}

View File

@@ -1,273 +0,0 @@
/*
* 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 (
"encoding/json"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// A PetApiController binds http requests to an api service and writes the service results to the http response
type PetApiController struct {
service PetApiServicer
}
// NewPetApiController creates a default api controller
func NewPetApiController(s PetApiServicer) Router {
return &PetApiController{ service: s }
}
// Routes returns all of the api route for the PetApiController
func (c *PetApiController) Routes() Routes {
return Routes{
{
"AddPet",
strings.ToUpper("Post"),
"/v2/pet",
c.AddPet,
},
{
"DeletePet",
strings.ToUpper("Delete"),
"/v2/pet/{petId}",
c.DeletePet,
},
{
"FindPetsByStatus",
strings.ToUpper("Get"),
"/v2/pet/findByStatus",
c.FindPetsByStatus,
},
{
"FindPetsByTags",
strings.ToUpper("Get"),
"/v2/pet/findByTags",
c.FindPetsByTags,
},
{
"GetPetById",
strings.ToUpper("Get"),
"/v2/pet/{petId}",
c.GetPetById,
},
{
"UpdatePet",
strings.ToUpper("Put"),
"/v2/pet",
c.UpdatePet,
},
{
"UpdatePetWithForm",
strings.ToUpper("Post"),
"/v2/pet/{petId}",
c.UpdatePetWithForm,
},
{
"UploadFile",
strings.ToUpper("Post"),
"/v2/pet/{petId}/uploadImage",
c.UploadFile,
},
{
"UploadFileWithRequiredFile",
strings.ToUpper("Post"),
"/v2/fake/{petId}/uploadImageWithRequiredFile",
c.UploadFileWithRequiredFile,
},
}
}
// AddPet - Add a new pet to the store
func (c *PetApiController) AddPet(w http.ResponseWriter, r *http.Request) {
pet := &Pet{}
if err := json.NewDecoder(r.Body).Decode(&pet); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.AddPet(*pet)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// DeletePet - Deletes a pet
func (c *PetApiController) DeletePet(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
petId, err := parseIntParameter(params["petId"])
if err != nil {
w.WriteHeader(500)
return
}
apiKey := r.Header.Get("apiKey")
result, err := c.service.DeletePet(petId, apiKey)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// FindPetsByStatus - Finds Pets by status
func (c *PetApiController) FindPetsByStatus(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
status := strings.Split(query.Get("status"), ",")
result, err := c.service.FindPetsByStatus(status)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// FindPetsByTags - Finds Pets by tags
func (c *PetApiController) FindPetsByTags(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
tags := strings.Split(query.Get("tags"), ",")
result, err := c.service.FindPetsByTags(tags)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// GetPetById - Find pet by ID
func (c *PetApiController) GetPetById(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
petId, err := parseIntParameter(params["petId"])
if err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.GetPetById(petId)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// UpdatePet - Update an existing pet
func (c *PetApiController) UpdatePet(w http.ResponseWriter, r *http.Request) {
pet := &Pet{}
if err := json.NewDecoder(r.Body).Decode(&pet); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.UpdatePet(*pet)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// UpdatePetWithForm - Updates a pet in the store with form data
func (c *PetApiController) UpdatePetWithForm(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
w.WriteHeader(500)
return
}
params := mux.Vars(r)
petId, err := parseIntParameter(params["petId"])
if err != nil {
w.WriteHeader(500)
return
}
name := r.FormValue("name")
status := r.FormValue("status")
result, err := c.service.UpdatePetWithForm(petId, name, status)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// UploadFile - uploads an image
func (c *PetApiController) UploadFile(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
w.WriteHeader(500)
return
}
params := mux.Vars(r)
petId, err := parseIntParameter(params["petId"])
if err != nil {
w.WriteHeader(500)
return
}
additionalMetadata := r.FormValue("additionalMetadata")
file, err := ReadFormFileToTempFile(r, "file")
if err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.UploadFile(petId, additionalMetadata, file)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// UploadFileWithRequiredFile - uploads an image (required)
func (c *PetApiController) UploadFileWithRequiredFile(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
w.WriteHeader(500)
return
}
params := mux.Vars(r)
petId, err := parseIntParameter(params["petId"])
if err != nil {
w.WriteHeader(500)
return
}
requiredFile, err := ReadFormFileToTempFile(r, "requiredFile")
if err != nil {
w.WriteHeader(500)
return
}
additionalMetadata := r.FormValue("additionalMetadata")
result, err := c.service.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}

View File

@@ -1,117 +0,0 @@
/*
* 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 (
"encoding/json"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// A StoreApiController binds http requests to an api service and writes the service results to the http response
type StoreApiController struct {
service StoreApiServicer
}
// NewStoreApiController creates a default api controller
func NewStoreApiController(s StoreApiServicer) Router {
return &StoreApiController{ service: s }
}
// Routes returns all of the api route for the StoreApiController
func (c *StoreApiController) Routes() Routes {
return Routes{
{
"DeleteOrder",
strings.ToUpper("Delete"),
"/v2/store/order/{order_id}",
c.DeleteOrder,
},
{
"GetInventory",
strings.ToUpper("Get"),
"/v2/store/inventory",
c.GetInventory,
},
{
"GetOrderById",
strings.ToUpper("Get"),
"/v2/store/order/{order_id}",
c.GetOrderById,
},
{
"PlaceOrder",
strings.ToUpper("Post"),
"/v2/store/order",
c.PlaceOrder,
},
}
}
// DeleteOrder - Delete purchase order by ID
func (c *StoreApiController) DeleteOrder(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
orderId := params["orderId"]
result, err := c.service.DeleteOrder(orderId)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// GetInventory - Returns pet inventories by status
func (c *StoreApiController) GetInventory(w http.ResponseWriter, r *http.Request) {
result, err := c.service.GetInventory()
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// GetOrderById - Find purchase order by ID
func (c *StoreApiController) GetOrderById(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
orderId, err := parseIntParameter(params["orderId"])
if err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.GetOrderById(orderId)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// PlaceOrder - Place an order for a pet
func (c *StoreApiController) PlaceOrder(w http.ResponseWriter, r *http.Request) {
order := &Order{}
if err := json.NewDecoder(r.Body).Decode(&order); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.PlaceOrder(*order)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}

View File

@@ -1,203 +0,0 @@
/*
* 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 (
"encoding/json"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// A UserApiController binds http requests to an api service and writes the service results to the http response
type UserApiController struct {
service UserApiServicer
}
// NewUserApiController creates a default api controller
func NewUserApiController(s UserApiServicer) Router {
return &UserApiController{ service: s }
}
// Routes returns all of the api route for the UserApiController
func (c *UserApiController) Routes() Routes {
return Routes{
{
"CreateUser",
strings.ToUpper("Post"),
"/v2/user",
c.CreateUser,
},
{
"CreateUsersWithArrayInput",
strings.ToUpper("Post"),
"/v2/user/createWithArray",
c.CreateUsersWithArrayInput,
},
{
"CreateUsersWithListInput",
strings.ToUpper("Post"),
"/v2/user/createWithList",
c.CreateUsersWithListInput,
},
{
"DeleteUser",
strings.ToUpper("Delete"),
"/v2/user/{username}",
c.DeleteUser,
},
{
"GetUserByName",
strings.ToUpper("Get"),
"/v2/user/{username}",
c.GetUserByName,
},
{
"LoginUser",
strings.ToUpper("Get"),
"/v2/user/login",
c.LoginUser,
},
{
"LogoutUser",
strings.ToUpper("Get"),
"/v2/user/logout",
c.LogoutUser,
},
{
"UpdateUser",
strings.ToUpper("Put"),
"/v2/user/{username}",
c.UpdateUser,
},
}
}
// CreateUser - Create user
func (c *UserApiController) CreateUser(w http.ResponseWriter, r *http.Request) {
user := &User{}
if err := json.NewDecoder(r.Body).Decode(&user); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.CreateUser(*user)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// CreateUsersWithArrayInput - Creates list of users with given input array
func (c *UserApiController) CreateUsersWithArrayInput(w http.ResponseWriter, r *http.Request) {
user := &[]User{}
if err := json.NewDecoder(r.Body).Decode(&user); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.CreateUsersWithArrayInput(*user)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// CreateUsersWithListInput - Creates list of users with given input array
func (c *UserApiController) CreateUsersWithListInput(w http.ResponseWriter, r *http.Request) {
user := &[]User{}
if err := json.NewDecoder(r.Body).Decode(&user); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.CreateUsersWithListInput(*user)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// DeleteUser - Delete user
func (c *UserApiController) DeleteUser(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
username := params["username"]
result, err := c.service.DeleteUser(username)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// GetUserByName - Get user by user name
func (c *UserApiController) GetUserByName(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
username := params["username"]
result, err := c.service.GetUserByName(username)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// LoginUser - Logs user into the system
func (c *UserApiController) LoginUser(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
username := query.Get("username")
password := query.Get("password")
result, err := c.service.LoginUser(username, password)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// LogoutUser - Logs out current logged in user session
func (c *UserApiController) LogoutUser(w http.ResponseWriter, r *http.Request) {
result, err := c.service.LogoutUser()
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
// UpdateUser - Updated user
func (c *UserApiController) UpdateUser(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
username := params["username"]
user := &User{}
if err := json.NewDecoder(r.Body).Decode(&user); err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.UpdateUser(username, *user)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}

View File

@@ -1,32 +0,0 @@
/*
* 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),
)
})
}

View File

@@ -1,18 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,26 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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 CatAllOf struct {
Declawed bool `json:"declawed,omitempty"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,16 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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 DogAllOf struct {
Breed string `json:"breed,omitempty"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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)"
)

View File

@@ -1,29 +0,0 @@
/*
* 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"`
OuterEnumInteger OuterEnumInteger `json:"outerEnumInteger,omitempty"`
OuterEnumDefaultValue OuterEnumDefaultValue `json:"outerEnumDefaultValue,omitempty"`
OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue `json:"outerEnumIntegerDefaultValue,omitempty"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,50 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,16 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,60 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,23 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,21 +0,0 @@
/*
* 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"`
}

View File

@@ -1,23 +0,0 @@
/*
* 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"`
}

View File

@@ -1,22 +0,0 @@
/*
* 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"`
}

View File

@@ -1,41 +0,0 @@
/*
* 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 NullableClass struct {
IntegerProp *int32 `json:"integer_prop,omitempty"`
NumberProp *float32 `json:"number_prop,omitempty"`
BooleanProp *bool `json:"boolean_prop,omitempty"`
StringProp *string `json:"string_prop,omitempty"`
DateProp *string `json:"date_prop,omitempty"`
DatetimeProp *time.Time `json:"datetime_prop,omitempty"`
ArrayNullableProp *[]map[string]interface{} `json:"array_nullable_prop,omitempty"`
ArrayAndItemsNullableProp *[]map[string]interface{} `json:"array_and_items_nullable_prop,omitempty"`
ArrayItemsNullable []map[string]interface{} `json:"array_items_nullable,omitempty"`
ObjectNullableProp *map[string]map[string]interface{} `json:"object_nullable_prop,omitempty"`
ObjectAndItemsNullableProp *map[string]map[string]interface{} `json:"object_and_items_nullable_prop,omitempty"`
ObjectItemsNullable map[string]map[string]interface{} `json:"object_items_nullable,omitempty"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,30 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"
)

View File

@@ -1,19 +0,0 @@
/*
* 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 OuterEnumDefaultValue string
// List of OuterEnumDefaultValue
const (
PLACED OuterEnumDefaultValue = "placed"
APPROVED OuterEnumDefaultValue = "approved"
DELIVERED OuterEnumDefaultValue = "delivered"
)

View File

@@ -1,19 +0,0 @@
/*
* 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 OuterEnumInteger int32
// List of OuterEnumInteger
const (
_0 OuterEnumInteger = 0
_1 OuterEnumInteger = 1
_2 OuterEnumInteger = 2
)

View File

@@ -1,19 +0,0 @@
/*
* 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 OuterEnumIntegerDefaultValue int32
// List of OuterEnumIntegerDefaultValue
const (
_0 OuterEnumIntegerDefaultValue = 0
_1 OuterEnumIntegerDefaultValue = 1
_2 OuterEnumIntegerDefaultValue = 2
)

View File

@@ -1,26 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,16 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,30 +0,0 @@
/*
* 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"`
}

View File

@@ -1,96 +0,0 @@
/*
* 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 (
"encoding/json"
"io/ioutil"
"net/http"
"os"
"strconv"
"github.com/gorilla/mux"
)
// A Route defines the parameters for an api endpoint
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
// Routes are a collection of defined api endpoints
type Routes []Route
// Router defines the required methods for retrieving api routes
type Router interface {
Routes() Routes
}
// NewRouter creates a new router for any number of api routers
func NewRouter(routers ...Router) *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, api := range routers {
for _, route := range api.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
}
// EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
if status != nil {
w.WriteHeader(*status)
} else {
w.WriteHeader(http.StatusOK)
}
return json.NewEncoder(w).Encode(i)
}
// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error) {
r.ParseForm()
formFile, _, err := r.FormFile(key)
if err != nil {
return nil, err
}
defer formFile.Close()
file, err := ioutil.TempFile("tmp", key)
if err != nil {
return nil, err
}
defer file.Close()
fileBytes, err := ioutil.ReadAll(formFile)
if err != nil {
return nil, err
}
file.Write(fileBytes)
return file, nil
}
// parseIntParameter parses a sting parameter to an int64
func parseIntParameter(param string) (int64, error) {
return strconv.ParseInt(param, 10, 64)
}

View File

@@ -1,46 +0,0 @@
/*
* 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"
petstoreserver "github.com/GIT_USER_ID/GIT_REPO_ID/go"
)
func main() {
log.Printf("Server started")
AnotherFakeApiService := petstoreserver.NewAnotherFakeApiService()
AnotherFakeApiController := petstoreserver.NewAnotherFakeApiController(AnotherFakeApiService)
DefaultApiService := petstoreserver.NewDefaultApiService()
DefaultApiController := petstoreserver.NewDefaultApiController(DefaultApiService)
FakeApiService := petstoreserver.NewFakeApiService()
FakeApiController := petstoreserver.NewFakeApiController(FakeApiService)
FakeClassnameTags123ApiService := petstoreserver.NewFakeClassnameTags123ApiService()
FakeClassnameTags123ApiController := petstoreserver.NewFakeClassnameTags123ApiController(FakeClassnameTags123ApiService)
PetApiService := petstoreserver.NewPetApiService()
PetApiController := petstoreserver.NewPetApiController(PetApiService)
StoreApiService := petstoreserver.NewStoreApiService()
StoreApiController := petstoreserver.NewStoreApiController(StoreApiService)
UserApiService := petstoreserver.NewUserApiService()
UserApiController := petstoreserver.NewUserApiController(UserApiService)
router := petstoreserver.NewRouter(AnotherFakeApiController, DefaultApiController, FakeApiController, FakeClassnameTags123ApiController, PetApiController, StoreApiController, UserApiController)
log.Fatal(http.ListenAndServe(":8080", router))
}

View File

@@ -1,23 +0,0 @@
# 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

View File

@@ -1,15 +0,0 @@
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
ENV GIN_MODE=release
COPY --from=build /go/src/petstoreserver ./
EXPOSE 8080/tcp
ENTRYPOINT ["./petstoreserver"]

View File

@@ -1,40 +0,0 @@
# 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.

View File

@@ -1,21 +0,0 @@
/*
* 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{})
}

View File

@@ -1,21 +0,0 @@
/*
* 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{})
}

View File

@@ -1,86 +0,0 @@
/*
* 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{})
}
// TestQueryParameterCollectionFormat -
func TestQueryParameterCollectionFormat(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{})
}

View File

@@ -1,21 +0,0 @@
/*
* 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{})
}

View File

@@ -1,61 +0,0 @@
/*
* 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{})
}

View File

@@ -1,36 +0,0 @@
/*
* 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{})
}

View File

@@ -1,56 +0,0 @@
/*
* 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{})
}

View File

@@ -1,18 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,26 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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 CatAllOf struct {
Declawed bool `json:"declawed,omitempty"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,16 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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 DogAllOf struct {
Breed string `json:"breed,omitempty"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,19 +0,0 @@
/*
* 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)"
)

View File

@@ -1,29 +0,0 @@
/*
* 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"`
OuterEnumInteger OuterEnumInteger `json:"outerEnumInteger,omitempty"`
OuterEnumDefaultValue OuterEnumDefaultValue `json:"outerEnumDefaultValue,omitempty"`
OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue `json:"outerEnumIntegerDefaultValue,omitempty"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,17 +0,0 @@
/*
* 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"`
}

View File

@@ -1,15 +0,0 @@
/*
* 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"`
}

Some files were not shown because too many files have changed in this diff Show More