mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 22:22:52 +00:00
fix enum which is not string of Go (#4077)
This commit is contained in:
committed by
William Cheng
parent
7a369d3b02
commit
08613691e8
@@ -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
|
||||
```
|
||||
|
||||
|
||||
@@ -90,3 +90,9 @@ func TestJsonFormData(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
// TestQueryParameterCollectionFormat -
|
||||
func TestQueryParameterCollectionFormat(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* API version: 1.0.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package petstoreserver
|
||||
|
||||
type CatAllOf struct {
|
||||
|
||||
Declawed bool `json:"declawed,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* API version: 1.0.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package petstoreserver
|
||||
|
||||
type DogAllOf struct {
|
||||
|
||||
Breed string `json:"breed,omitempty"`
|
||||
}
|
||||
@@ -19,7 +19,7 @@ type EnumTest struct {
|
||||
|
||||
EnumNumber float64 `json:"enum_number,omitempty"`
|
||||
|
||||
OuterEnum OuterEnum `json:"outerEnum,omitempty"`
|
||||
OuterEnum *OuterEnum `json:"outerEnum,omitempty"`
|
||||
|
||||
OuterEnumInteger OuterEnumInteger `json:"outerEnumInteger,omitempty"`
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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"`
|
||||
}
|
||||
@@ -13,7 +13,7 @@ type OuterEnumInteger int32
|
||||
|
||||
// List of OuterEnumInteger
|
||||
const (
|
||||
_0 OuterEnumInteger = "0"
|
||||
_1 OuterEnumInteger = "1"
|
||||
_2 OuterEnumInteger = "2"
|
||||
_0 OuterEnumInteger = 0
|
||||
_1 OuterEnumInteger = 1
|
||||
_2 OuterEnumInteger = 2
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ type OuterEnumIntegerDefaultValue int32
|
||||
|
||||
// List of OuterEnumIntegerDefaultValue
|
||||
const (
|
||||
_0 OuterEnumIntegerDefaultValue = "0"
|
||||
_1 OuterEnumIntegerDefaultValue = "1"
|
||||
_2 OuterEnumIntegerDefaultValue = "2"
|
||||
_0 OuterEnumIntegerDefaultValue = 0
|
||||
_1 OuterEnumIntegerDefaultValue = 1
|
||||
_2 OuterEnumIntegerDefaultValue = 2
|
||||
)
|
||||
|
||||
@@ -160,6 +160,13 @@ var routes = Routes{
|
||||
TestJsonFormData,
|
||||
},
|
||||
|
||||
{
|
||||
"TestQueryParameterCollectionFormat",
|
||||
strings.ToUpper("Put"),
|
||||
"/v2/fake/test-query-paramters",
|
||||
TestQueryParameterCollectionFormat,
|
||||
},
|
||||
|
||||
{
|
||||
"TestClassname",
|
||||
strings.ToUpper("Patch"),
|
||||
|
||||
Reference in New Issue
Block a user