forked from loafle/openapi-generator-original
[go][model] Use pointers to avoid circular references (#5478)
* [go][model] Use pointers to avoid circular references Signed-off-by: weiyang <weiyang.ones@gmail.com> * [samples][go][model] Use pointers to avoid circular references Signed-off-by: weiyang <weiyang.ones@gmail.com>
This commit is contained in:
@@ -9,7 +9,7 @@ import ({{/imports}}{{#imports}}
|
||||
type {{classname}} struct {
|
||||
{{#vars}}{{#description}}
|
||||
// {{{description}}}{{/description}}
|
||||
{{name}} {{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"`
|
||||
{{name}} {{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"`
|
||||
{{/vars}}
|
||||
}
|
||||
{{/model}}{{/models}}
|
||||
@@ -3,7 +3,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
|
||||
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{datatype}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{{datatype}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
|
||||
{{/vars}}
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
|
||||
**EnumString** | **string** | | [optional] [default to null]
|
||||
**EnumInteger** | **int32** | | [optional] [default to null]
|
||||
**EnumNumber** | **float64** | | [optional] [default to null]
|
||||
**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] [default to null]
|
||||
**OuterEnum** | [***OuterEnum**](OuterEnum.md) | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# \Fake_classname_tags123Api
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Id** | **int64** | | [optional] [default to null]
|
||||
**Category** | [**Category**](Category.md) | | [optional] [default to null]
|
||||
**Category** | [***Category**](Category.md) | | [optional] [default to null]
|
||||
**Name** | **string** | | [default to null]
|
||||
**PhotoUrls** | **[]string** | | [default to null]
|
||||
**Tags** | [**[]Tag**](Tag.md) | | [optional] [default to null]
|
||||
|
||||
@@ -18,5 +18,5 @@ type EnumTest struct {
|
||||
|
||||
EnumNumber float64 `json:"enum_number,omitempty"`
|
||||
|
||||
OuterEnum OuterEnum `json:"outerEnum,omitempty"`
|
||||
OuterEnum *OuterEnum `json:"outerEnum,omitempty"`
|
||||
}
|
||||
|
||||
@@ -126,17 +126,17 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if number < 32.10000000000000142108547152020037174224853515625 {
|
||||
return nil, reportError("number must be greater than 32.10000000000000142108547152020037174224853515625")
|
||||
if number < 32.1 {
|
||||
return nil, reportError("number must be greater than 32.1")
|
||||
}
|
||||
if number > 543.200000000000045474735088646411895751953125 {
|
||||
return nil, reportError("number must be less than 543.200000000000045474735088646411895751953125")
|
||||
if number > 543.2 {
|
||||
return nil, reportError("number must be less than 543.2")
|
||||
}
|
||||
if double < 67.7999999999999971578290569595992565155029296875 {
|
||||
return nil, reportError("double must be greater than 67.7999999999999971578290569595992565155029296875")
|
||||
if double < 67.8 {
|
||||
return nil, reportError("double must be greater than 67.8")
|
||||
}
|
||||
if double > 123.400000000000005684341886080801486968994140625 {
|
||||
return nil, reportError("double must be less than 123.400000000000005684341886080801486968994140625")
|
||||
if double > 123.4 {
|
||||
return nil, reportError("double must be less than 123.4")
|
||||
}
|
||||
if err := typeCheckParameter(localVarOptionals["integer"], "int32", "integer"); err != nil {
|
||||
return nil, err
|
||||
@@ -276,7 +276,7 @@ func (a *FakeApiService) TestEnumParameters(localVarOptionals map[string]interfa
|
||||
}
|
||||
if err := typeCheckParameter(localVarOptionals["enumQueryString"], "string", "enumQueryString"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if err := typeCheckParameter(localVarOptionals["enumQueryInteger"], "int32", "enumQueryInteger"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ type FormatTest struct {
|
||||
|
||||
Binary string `json:"binary,omitempty"`
|
||||
|
||||
Date string `json:"date,omitempty"`
|
||||
Date string `json:"date"`
|
||||
|
||||
DateTime time.Time `json:"dateTime,omitempty"`
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ type Pet struct {
|
||||
|
||||
Id int64 `json:"id,omitempty"`
|
||||
|
||||
Category Category `json:"category,omitempty"`
|
||||
Category *Category `json:"category,omitempty"`
|
||||
|
||||
Name string `json:"name"`
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
localVarQueryParams.Add("status", parameterToString(status, "csv"))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
@@ -241,6 +242,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
|
||||
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
|
||||
@@ -41,17 +41,13 @@ func (a *StoreApiService) DeleteOrder(orderId string) ( *http.Response, error) {
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/store/order/{orderId}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
orderIdTxt, err := atoi(orderId)
|
||||
if orderIdTxt < 1 {
|
||||
return nil, reportError("orderId must be greater than 1")
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{ }
|
||||
@@ -179,8 +175,8 @@ func (a *StoreApiService) GetOrderById(orderId int64) (Order, *http.Response, e
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/store/order/{orderId}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
Reference in New Issue
Block a user