diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index ef49c8bc8f4..a062e7d6df1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -448,13 +448,21 @@ public class GoClientCodegen extends AbstractGoCodegen { for (CodegenParameter p : op.allParams) { p.vendorExtensions.put("x-go-example", constructExampleCode(p, modelMaps, processedModelMaps)); } + processedModelMaps.clear(); } - processedModelMaps.clear(); for (CodegenOperation operation : operationList) { + boolean needTimeImport = false; for (CodegenParameter cp : operation.allParams) { cp.vendorExtensions.put("x-go-example", constructExampleCode(cp, modelMaps, processedModelMaps)); + if (cp.isDateTime || cp.isDate) { // datetime or date + needTimeImport = true; + } } + if (needTimeImport) { + operation.vendorExtensions.put("x-go-import", " \"time\""); + } + processedModelMaps.clear(); } return objs; @@ -462,12 +470,22 @@ public class GoClientCodegen extends AbstractGoCodegen { private String constructExampleCode(CodegenParameter codegenParameter, HashMap modelMaps, HashMap processedModelMap) { if (codegenParameter.isArray) { // array - return codegenParameter.dataType + "{" + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}"; + String prefix = codegenParameter.dataType; + String dataType = StringUtils.removeStart(codegenParameter.dataType, "[]"); + if (modelMaps.containsKey(dataType)) { + prefix = "[]" + goImportAlias + "." + dataType; + } + return prefix + "{" + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}"; } else if (codegenParameter.isMap) { - return codegenParameter.dataType + "{ \"key\": " + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}"; + String prefix = codegenParameter.dataType; + String dataType = StringUtils.removeStart(codegenParameter.dataType, "map[string][]"); + if (modelMaps.containsKey(dataType)) { + prefix = "map[string][]" + goImportAlias + "." + dataType; + } + return prefix + "{\"key\": " + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}"; } else if (codegenParameter.isPrimitiveType) { // primitive type if (codegenParameter.isString) { - if (StringUtils.isEmpty(codegenParameter.example)) { + if (!StringUtils.isEmpty(codegenParameter.example) && codegenParameter.example != "null") { return "\"" + codegenParameter.example + "\""; } else { return "\"" + codegenParameter.paramName + "_example\""; @@ -482,11 +500,13 @@ public class GoClientCodegen extends AbstractGoCodegen { return "\"https://example.com\""; } else if (codegenParameter.isDateTime || codegenParameter.isDate) { // datetime or date return "time.Now()"; + } else if (codegenParameter.isFile) { + return "os.NewFile(1234, \"some_file\")"; } else { // numeric - if (StringUtils.isEmpty(codegenParameter.example)) { - return codegenParameter.example; + if (!StringUtils.isEmpty(codegenParameter.example) && codegenParameter.example != "null") { + return codegenParameter.dataType + "(" + codegenParameter.example + ")"; } else { - return "987"; + return codegenParameter.dataType + "(987)"; } } } else { // model @@ -502,12 +522,22 @@ public class GoClientCodegen extends AbstractGoCodegen { private String constructExampleCode(CodegenProperty codegenProperty, HashMap modelMaps, HashMap processedModelMap) { if (codegenProperty.isArray) { // array - return codegenProperty.dataType + "{" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + ")"; + String prefix = codegenProperty.dataType; + String dataType = StringUtils.removeStart(codegenProperty.dataType, "[]"); + if (modelMaps.containsKey(dataType)) { + prefix = "[]" + goImportAlias + "." + dataType; + } + return prefix + "{" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}"; } else if (codegenProperty.isMap) { // map - return codegenProperty.dataType + "{ \"key\": " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}"; + String prefix = codegenProperty.dataType; + String dataType = StringUtils.removeStart(codegenProperty.dataType, "map[string][]"); + if (modelMaps.containsKey(dataType)) { + prefix = "map[string][]" + goImportAlias + "." + dataType; + } + return prefix + "{\"key\": " + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + "}"; } else if (codegenProperty.isPrimitiveType) { // primitive type if (codegenProperty.isString) { - if (StringUtils.isEmpty(codegenProperty.example)) { + if (!StringUtils.isEmpty(codegenProperty.example) && codegenProperty.example != "null") { return "\"" + codegenProperty.example + "\""; } else { return "\"" + codegenProperty.name + "_example\""; @@ -524,17 +554,13 @@ public class GoClientCodegen extends AbstractGoCodegen { return "time.Now()"; } else { // numeric String example; - if (StringUtils.isEmpty(codegenProperty.example)) { + if (!StringUtils.isEmpty(codegenProperty.example) && codegenProperty.example != "null") { example = codegenProperty.example; } else { example = "123"; } - if (codegenProperty.isLong) { - return "int64(" + example + ")"; - } else { - return example; - } + return codegenProperty.dataType + "(" + example + ")"; } } else { // look up the model @@ -548,8 +574,6 @@ public class GoClientCodegen extends AbstractGoCodegen { } private String constructExampleCode(CodegenModel codegenModel, HashMap modelMaps, HashMap processedModelMap) { - String example; - // break infinite recursion. Return, in case a model is already processed in the current context. String model = codegenModel.name; if (processedModelMap.containsKey(model)) { @@ -561,6 +585,14 @@ public class GoClientCodegen extends AbstractGoCodegen { } else { throw new RuntimeException("Invalid count when constructing example: " + count); } + } else if (codegenModel.isEnum) { + Map allowableValues = codegenModel.allowableValues; + List values = (List) allowableValues.get("values"); + return goImportAlias + "." + model + "(\"" + String.valueOf(values.get(0)) + "\")"; + } else if (codegenModel.oneOf != null && !codegenModel.oneOf.isEmpty()) { + String subModel = (String) codegenModel.oneOf.toArray()[0]; + String oneOf = constructExampleCode(modelMaps.get(subModel), modelMaps, processedModelMap).substring(1); + return goImportAlias + "." + model + "{" + subModel + ": " + oneOf + "}"; } else { processedModelMap.put(model, 1); } @@ -569,6 +601,6 @@ public class GoClientCodegen extends AbstractGoCodegen { for (CodegenProperty codegenProperty : codegenModel.requiredVars) { propertyExamples.add(constructExampleCode(codegenProperty, modelMaps, processedModelMap)); } - return "*" + goImportAlias + ".New" + codegenModel.name + "(" + StringUtils.join(propertyExamples, ", ") + ")"; + return "*" + goImportAlias + ".New" + model + "(" + StringUtils.join(propertyExamples, ", ") + ")"; } } diff --git a/modules/openapi-generator/src/main/resources/go/api_doc.mustache b/modules/openapi-generator/src/main/resources/go/api_doc.mustache index 377fe764c15..3b9e1438aa4 100644 --- a/modules/openapi-generator/src/main/resources/go/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go/api_doc.mustache @@ -29,6 +29,9 @@ import ( "context" "fmt" "os" +{{#vendorExtensions.x-go-import}} +{{{vendorExtensions.x-go-import}}} +{{/vendorExtensions.x-go-import}} {{goImportAlias}} "./openapi" ) @@ -66,7 +69,7 @@ Other parameters are passed through a pointer to a api{{{nickname}}}Request stru Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} -{{^isPathParam}} **{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}} +{{^isPathParam}} **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**[]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{#baseType}}{{baseType}}{{/baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**map[string]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{#baseType}}{{baseType}}{{/baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{#baseType}}{{baseType}}{{/baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/isContainer}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/go/model_doc.mustache b/modules/openapi-generator/src/main/resources/go/model_doc.mustache index 9045d9fe088..d9e29359f57 100644 --- a/modules/openapi-generator/src/main/resources/go/model_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go/model_doc.mustache @@ -1,5 +1,6 @@ {{#models}}{{#model}}# {{classname}} +{{^isEnum}} ## Properties Name | Type | Description | Notes @@ -12,7 +13,6 @@ Name | Type | Description | Notes {{/vars}} {{/vendorExtensions.x-is-one-of-interface}} -{{^isEnum}} ## Methods {{^vendorExtensions.x-is-one-of-interface}} @@ -84,6 +84,13 @@ Convenience method to wrap this instance of {{classname}} in {{{.}}} {{/vendorExtensions.x-implements}} {{/vendorExtensions.x-is-one-of-interface}} {{/isEnum}} +{{#isEnum}} +## Enum + +{{#allowableValues}}{{#enumVars}} +* `{{name}}` (value: `{{{value}}}`) +{{/enumVars}}{{/allowableValues}} +{{/isEnum}} [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore/docs/EnumClass.md b/samples/client/petstore/go/go-petstore/docs/EnumClass.md index e231f94bd73..98fc18f12ac 100644 --- a/samples/client/petstore/go/go-petstore/docs/EnumClass.md +++ b/samples/client/petstore/go/go-petstore/docs/EnumClass.md @@ -1,9 +1,13 @@ # EnumClass -## Properties +## Enum -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + +* `ABC` (value: `"_abc"`) + +* `EFG` (value: `"-efg"`) + +* `XYZ` (value: `"(xyz)"`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/client/petstore/go/go-petstore/docs/FakeApi.md index 0b26ad9d210..382058dc4db 100644 --- a/samples/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore/docs/FakeApi.md @@ -238,7 +238,7 @@ import ( ) func main() { - body := 987 // float32 | Input number as post body (optional) + body := float32(8.14) // float32 | Input number as post body (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -560,20 +560,21 @@ import ( "context" "fmt" "os" + "time" openapiclient "./openapi" ) func main() { - number := 987 // float32 | None - double := 987 // float64 | None + number := float32(8.14) // float32 | None + double := float64(1.2) // float64 | None patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None - byte_ := 987 // string | None - integer := 987 // int32 | None (optional) - int32_ := 987 // int32 | None (optional) - int64_ := 987 // int64 | None (optional) - float := 987 // float32 | None (optional) + byte_ := string(BYTE_ARRAY_DATA_HERE) // string | None + integer := int32(56) // int32 | None (optional) + int32_ := int32(56) // int32 | None (optional) + int64_ := int64(789) // int64 | None (optional) + float := float32(3.4) // float32 | None (optional) string_ := "string__example" // string | None (optional) - binary := 987 // *os.File | None (optional) + binary := os.NewFile(1234, "some_file") // *os.File | None (optional) date := time.Now() // string | None (optional) dateTime := time.Now() // time.Time | None (optional) password := "password_example" // string | None (optional) @@ -658,8 +659,8 @@ func main() { enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg") enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional) enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg") - enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional) - enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional) + enumQueryInteger := int32(56) // int32 | Query parameter enum test (double) (optional) + enumQueryDouble := float64(1.2) // float64 | Query parameter enum test (double) (optional) enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$") enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg") @@ -684,13 +685,13 @@ Other parameters are passed through a pointer to a apiTestEnumParametersRequest Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) | + **enumHeaderStringArray** | **[]string** | Header parameter enum test (string array) | **enumHeaderString** | **string** | Header parameter enum test (string) | [default to "-efg"] - **enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) | + **enumQueryStringArray** | **[]string** | Query parameter enum test (string array) | **enumQueryString** | **string** | Query parameter enum test (string) | [default to "-efg"] **enumQueryInteger** | **int32** | Query parameter enum test (double) | **enumQueryDouble** | **float64** | Query parameter enum test (double) | - **enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to "$"] + **enumFormStringArray** | **[]string** | Form parameter enum test (string array) | [default to "$"] **enumFormString** | **string** | Form parameter enum test (string) | [default to "-efg"] ### Return type @@ -732,12 +733,12 @@ import ( ) func main() { - requiredStringGroup := 987 // int32 | Required String in group parameters + requiredStringGroup := int32(56) // int32 | Required String in group parameters requiredBooleanGroup := true // bool | Required Boolean in group parameters - requiredInt64Group := 987 // int64 | Required Integer in group parameters - stringGroup := 987 // int32 | String in group parameters (optional) + requiredInt64Group := int64(789) // int64 | Required Integer in group parameters + stringGroup := int32(56) // int32 | String in group parameters (optional) booleanGroup := true // bool | Boolean in group parameters (optional) - int64Group := 987 // int64 | Integer in group parameters (optional) + int64Group := int64(789) // int64 | Integer in group parameters (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -804,7 +805,7 @@ import ( ) func main() { - param := map[string]string{ "key": "Inner_example"} // map[string]string | request body + param := map[string]string{"key": "Inner_example"} // map[string]string | request body configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -827,7 +828,7 @@ Other parameters are passed through a pointer to a apiTestInlineAdditionalProper Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | [**map[string]string**](string.md) | request body | + **param** | **map[string]string** | request body | ### Return type @@ -959,11 +960,11 @@ Other parameters are passed through a pointer to a apiTestQueryParameterCollecti Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pipe** | [**[]string**](string.md) | | - **ioutil** | [**[]string**](string.md) | | - **http** | [**[]string**](string.md) | | - **url** | [**[]string**](string.md) | | - **context** | [**[]string**](string.md) | | + **pipe** | **[]string** | | + **ioutil** | **[]string** | | + **http** | **[]string** | | + **url** | **[]string** | | + **context** | **[]string** | | ### Return type diff --git a/samples/client/petstore/go/go-petstore/docs/OuterEnum.md b/samples/client/petstore/go/go-petstore/docs/OuterEnum.md index 13bed2d17fd..4b7e1971772 100644 --- a/samples/client/petstore/go/go-petstore/docs/OuterEnum.md +++ b/samples/client/petstore/go/go-petstore/docs/OuterEnum.md @@ -1,9 +1,13 @@ # OuterEnum -## Properties +## Enum -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore/docs/PetApi.md b/samples/client/petstore/go/go-petstore/docs/PetApi.md index c04b65b69ee..d93265c16ed 100644 --- a/samples/client/petstore/go/go-petstore/docs/PetApi.md +++ b/samples/client/petstore/go/go-petstore/docs/PetApi.md @@ -35,7 +35,7 @@ import ( ) func main() { - body := *openapiclient.NewPet("Name_example", []string{"PhotoUrls_example")) // Pet | Pet object that needs to be added to the store + body := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -97,7 +97,7 @@ import ( ) func main() { - petId := 987 // int64 | Pet id to delete + petId := int64(789) // int64 | Pet id to delete apiKey := "apiKey_example" // string | (optional) configuration := openapiclient.NewConfiguration() @@ -192,7 +192,7 @@ Other parameters are passed through a pointer to a apiFindPetsByStatusRequest st Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**[]string**](string.md) | Status values that need to be considered for filter | + **status** | **[]string** | Status values that need to be considered for filter | ### Return type @@ -258,7 +258,7 @@ Other parameters are passed through a pointer to a apiFindPetsByTagsRequest stru Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**[]string**](string.md) | Tags to filter by | + **tags** | **[]string** | Tags to filter by | ### Return type @@ -299,7 +299,7 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet to return + petId := int64(789) // int64 | ID of pet to return configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -367,7 +367,7 @@ import ( ) func main() { - body := *openapiclient.NewPet("Name_example", []string{"PhotoUrls_example")) // Pet | Pet object that needs to be added to the store + body := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -429,7 +429,7 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet that needs to be updated + petId := int64(789) // int64 | ID of pet that needs to be updated name := "name_example" // string | Updated name of the pet (optional) status := "status_example" // string | Updated status of the pet (optional) @@ -499,9 +499,9 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet to update + petId := int64(789) // int64 | ID of pet to update additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) - file := 987 // *os.File | file to upload (optional) + file := os.NewFile(1234, "some_file") // *os.File | file to upload (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -571,8 +571,8 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet to update - requiredFile := 987 // *os.File | file to upload + petId := int64(789) // int64 | ID of pet to update + requiredFile := os.NewFile(1234, "some_file") // *os.File | file to upload additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) configuration := openapiclient.NewConfiguration() diff --git a/samples/client/petstore/go/go-petstore/docs/StoreApi.md b/samples/client/petstore/go/go-petstore/docs/StoreApi.md index 0e9c4a8ec55..1e5c0ae5ba8 100644 --- a/samples/client/petstore/go/go-petstore/docs/StoreApi.md +++ b/samples/client/petstore/go/go-petstore/docs/StoreApi.md @@ -161,7 +161,7 @@ import ( ) func main() { - orderId := 987 // int64 | ID of pet that needs to be fetched + orderId := int64(789) // int64 | ID of pet that needs to be fetched configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) diff --git a/samples/client/petstore/go/go-petstore/docs/UserApi.md b/samples/client/petstore/go/go-petstore/docs/UserApi.md index 9eccb9144d0..e1623fabec4 100644 --- a/samples/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore/docs/UserApi.md @@ -98,7 +98,7 @@ import ( ) func main() { - body := []User{*openapiclient.NewUser()} // []User | List of user object + body := []openapiclient.User{*openapiclient.NewUser()} // []User | List of user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -160,7 +160,7 @@ import ( ) func main() { - body := []User{} // []User | List of user object + body := []openapiclient.User{*openapiclient.NewUser()} // []User | List of user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -484,7 +484,7 @@ import ( func main() { username := "username_example" // string | name that need to be deleted - body := // User | Updated user object + body := *openapiclient.NewUser() // User | Updated user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md index e231f94bd73..98fc18f12ac 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md @@ -1,9 +1,13 @@ # EnumClass -## Properties +## Enum -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + +* `ABC` (value: `"_abc"`) + +* `EFG` (value: `"-efg"`) + +* `XYZ` (value: `"(xyz)"`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md index 2380fafb0dd..9021892276c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md @@ -233,7 +233,7 @@ import ( ) func main() { - body := 987 // float32 | Input number as post body (optional) + body := float32(8.14) // float32 | Input number as post body (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -555,20 +555,21 @@ import ( "context" "fmt" "os" + "time" openapiclient "./openapi" ) func main() { - number := 987 // float32 | None - double := 987 // float64 | None + number := float32(8.14) // float32 | None + double := float64(1.2) // float64 | None patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None - byte_ := 987 // string | None - integer := 987 // int32 | None (optional) - int32_ := 987 // int32 | None (optional) - int64_ := 987 // int64 | None (optional) - float := 987 // float32 | None (optional) + byte_ := string(BYTE_ARRAY_DATA_HERE) // string | None + integer := int32(56) // int32 | None (optional) + int32_ := int32(56) // int32 | None (optional) + int64_ := int64(789) // int64 | None (optional) + float := float32(3.4) // float32 | None (optional) string_ := "string__example" // string | None (optional) - binary := 987 // *os.File | None (optional) + binary := os.NewFile(1234, "some_file") // *os.File | None (optional) date := time.Now() // string | None (optional) dateTime := time.Now() // time.Time | None (optional) password := "password_example" // string | None (optional) @@ -653,8 +654,8 @@ func main() { enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg") enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional) enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg") - enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional) - enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional) + enumQueryInteger := int32(56) // int32 | Query parameter enum test (double) (optional) + enumQueryDouble := float64(1.2) // float64 | Query parameter enum test (double) (optional) enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$") enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg") @@ -679,13 +680,13 @@ Other parameters are passed through a pointer to a apiTestEnumParametersRequest Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) | + **enumHeaderStringArray** | **[]string** | Header parameter enum test (string array) | **enumHeaderString** | **string** | Header parameter enum test (string) | [default to "-efg"] - **enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) | + **enumQueryStringArray** | **[]string** | Query parameter enum test (string array) | **enumQueryString** | **string** | Query parameter enum test (string) | [default to "-efg"] **enumQueryInteger** | **int32** | Query parameter enum test (double) | **enumQueryDouble** | **float64** | Query parameter enum test (double) | - **enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to "$"] + **enumFormStringArray** | **[]string** | Form parameter enum test (string array) | [default to "$"] **enumFormString** | **string** | Form parameter enum test (string) | [default to "-efg"] ### Return type @@ -727,12 +728,12 @@ import ( ) func main() { - requiredStringGroup := 987 // int32 | Required String in group parameters + requiredStringGroup := int32(56) // int32 | Required String in group parameters requiredBooleanGroup := true // bool | Required Boolean in group parameters - requiredInt64Group := 987 // int64 | Required Integer in group parameters - stringGroup := 987 // int32 | String in group parameters (optional) + requiredInt64Group := int64(789) // int64 | Required Integer in group parameters + stringGroup := int32(56) // int32 | String in group parameters (optional) booleanGroup := true // bool | Boolean in group parameters (optional) - int64Group := 987 // int64 | Integer in group parameters (optional) + int64Group := int64(789) // int64 | Integer in group parameters (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -799,7 +800,7 @@ import ( ) func main() { - requestBody := map[string]string{ "key": "Inner_example"} // map[string]string | request body + requestBody := map[string]string{"key": "Inner_example"} // map[string]string | request body configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -822,7 +823,7 @@ Other parameters are passed through a pointer to a apiTestInlineAdditionalProper Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **requestBody** | [**map[string]string**](string.md) | request body | + **requestBody** | **map[string]string** | request body | ### Return type @@ -954,11 +955,11 @@ Other parameters are passed through a pointer to a apiTestQueryParameterCollecti Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pipe** | [**[]string**](string.md) | | - **ioutil** | [**[]string**](string.md) | | - **http** | [**[]string**](string.md) | | - **url** | [**[]string**](string.md) | | - **context** | [**[]string**](string.md) | | + **pipe** | **[]string** | | + **ioutil** | **[]string** | | + **http** | **[]string** | | + **url** | **[]string** | | + **context** | **[]string** | | ### Return type diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md index 13bed2d17fd..4b7e1971772 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md @@ -1,9 +1,13 @@ # OuterEnum -## Properties +## Enum -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md index 50f8ab0096c..af1747f3e09 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md @@ -1,9 +1,13 @@ # OuterEnumDefaultValue -## Properties +## Enum -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md index eb033db7cc5..1bb73a90ee7 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md @@ -1,9 +1,13 @@ # OuterEnumInteger -## Properties +## Enum -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + +* `_0` (value: `0`) + +* `_1` (value: `1`) + +* `_2` (value: `2`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md index 7a163432954..495d8f91379 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md @@ -1,9 +1,13 @@ # OuterEnumIntegerDefaultValue -## Properties +## Enum -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + +* `_0` (value: `0`) + +* `_1` (value: `1`) + +* `_2` (value: `2`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md index 7f9d4fb826e..c99794e706d 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md @@ -35,7 +35,7 @@ import ( ) func main() { - pet := *openapiclient.NewPet("Name_example", []string{"PhotoUrls_example")) // Pet | Pet object that needs to be added to the store + pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -97,7 +97,7 @@ import ( ) func main() { - petId := 987 // int64 | Pet id to delete + petId := int64(789) // int64 | Pet id to delete apiKey := "apiKey_example" // string | (optional) configuration := openapiclient.NewConfiguration() @@ -192,7 +192,7 @@ Other parameters are passed through a pointer to a apiFindPetsByStatusRequest st Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**[]string**](string.md) | Status values that need to be considered for filter | + **status** | **[]string** | Status values that need to be considered for filter | ### Return type @@ -258,7 +258,7 @@ Other parameters are passed through a pointer to a apiFindPetsByTagsRequest stru Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**[]string**](string.md) | Tags to filter by | + **tags** | **[]string** | Tags to filter by | ### Return type @@ -299,7 +299,7 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet to return + petId := int64(789) // int64 | ID of pet to return configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -367,7 +367,7 @@ import ( ) func main() { - pet := *openapiclient.NewPet("Name_example", []string{"PhotoUrls_example")) // Pet | Pet object that needs to be added to the store + pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -429,7 +429,7 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet that needs to be updated + petId := int64(789) // int64 | ID of pet that needs to be updated name := "name_example" // string | Updated name of the pet (optional) status := "status_example" // string | Updated status of the pet (optional) @@ -499,9 +499,9 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet to update + petId := int64(789) // int64 | ID of pet to update additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) - file := 987 // *os.File | file to upload (optional) + file := os.NewFile(1234, "some_file") // *os.File | file to upload (optional) configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -571,8 +571,8 @@ import ( ) func main() { - petId := 987 // int64 | ID of pet to update - requiredFile := 987 // *os.File | file to upload + petId := int64(789) // int64 | ID of pet to update + requiredFile := os.NewFile(1234, "some_file") // *os.File | file to upload additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) configuration := openapiclient.NewConfiguration() diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md index 097fac90ec9..067ea382576 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md @@ -161,7 +161,7 @@ import ( ) func main() { - orderId := 987 // int64 | ID of pet that needs to be fetched + orderId := int64(789) // int64 | ID of pet that needs to be fetched configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md index 4c89c0be927..dbbbe3fa792 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md @@ -98,7 +98,7 @@ import ( ) func main() { - user := []User{*openapiclient.NewUser()} // []User | List of user object + user := []openapiclient.User{*openapiclient.NewUser()} // []User | List of user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -160,7 +160,7 @@ import ( ) func main() { - user := []User{} // []User | List of user object + user := []openapiclient.User{*openapiclient.NewUser()} // []User | List of user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -484,7 +484,7 @@ import ( func main() { username := "username_example" // string | name that need to be deleted - user := // User | Updated user object + user := *openapiclient.NewUser() // User | Updated user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration)