Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public AbstractGoCodegen() {
"complex64",
"complex128",
"rune",
"byte")
"byte",
"interface{}"
)
);

instantiationTypes.clear();
Expand All @@ -107,7 +109,7 @@ public AbstractGoCodegen() {
typeMapping.put("file", "*os.File");
typeMapping.put("binary", "*os.File");
typeMapping.put("ByteArray", "string");
typeMapping.put("object", "map[string]interface{}");
typeMapping.put("object", "interface{}");

importMapping = new HashMap<String, String>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public void simpleModelTest() {
.addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT))
.addProperties("name", new StringSchema())
.addProperties("createdAt", new DateTimeSchema())
.addProperties("anyValue", new Schema())
.addRequiredItem("id")
.addRequiredItem("name");
.addRequiredItem("name")
.addRequiredItem("anyValue");
final DefaultCodegen codegen = new GoClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI);
Expand All @@ -50,7 +52,7 @@ public void simpleModelTest() {
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 3);
Assert.assertEquals(cm.vars.size(), 4);
Assert.assertEquals(cm.imports.size(), 1);

final CodegenProperty property1 = cm.vars.get(0);
Expand Down Expand Up @@ -80,10 +82,21 @@ public void simpleModelTest() {
Assert.assertEquals(property3.name, "CreatedAt");
Assert.assertNull(property3.defaultValue);
Assert.assertEquals(property3.baseType, "time.Time");
Assert.assertFalse(property3.hasMore);
Assert.assertTrue(property3.hasMore);
Assert.assertFalse(property3.required);

final CodegenProperty property4 = cm.vars.get(3);
Assert.assertEquals(property4.baseName, "anyValue");
Assert.assertEquals(property4.baseType, "interface{}");
Assert.assertEquals(property4.dataType, "interface{}");
Assert.assertTrue(property1.isPrimitiveType);
Assert.assertEquals(property4.name, "AnyValue");
Assert.assertNull(property4.defaultValue);
Assert.assertFalse(property4.hasMore);
Assert.assertTrue(property4.required);
}


@Test(description = "convert a model with list property")
public void listPropertyTest() {
final Schema model = new Schema()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,10 @@ components:
number_item:
example: 1.234
type: number
float_item:
example: 1.234
format: float
type: number
integer_item:
example: -2
type: integer
Expand All @@ -1887,6 +1891,7 @@ components:
required:
- array_item
- bool_item
- float_item
- integer_item
- number_item
- string_item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Name | Type | Description | Notes
**MapInteger** | Pointer to **map[string]int32** | | [optional]
**MapBoolean** | Pointer to **map[string]bool** | | [optional]
**MapArrayInteger** | Pointer to [**map[string][]int32**](array.md) | | [optional]
**MapArrayAnytype** | Pointer to [**map[string][]map[string]interface{}**](array.md) | | [optional]
**MapArrayAnytype** | Pointer to [**map[string][]interface{}**](array.md) | | [optional]
**MapMapString** | Pointer to [**map[string]map[string]string**](map.md) | | [optional]
**MapMapAnytype** | Pointer to [**map[string]map[string]map[string]interface{}**](map.md) | | [optional]
**Anytype1** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**Anytype2** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**Anytype3** | Pointer to [**map[string]interface{}**](.md) | | [optional]
**MapMapAnytype** | Pointer to [**map[string]map[string]interface{}**](map.md) | | [optional]
**Anytype1** | Pointer to [**interface{}**](.md) | | [optional]
**Anytype2** | Pointer to [**interface{}**](.md) | | [optional]
**Anytype3** | Pointer to [**interface{}**](.md) | | [optional]

## Methods

Expand Down Expand Up @@ -145,13 +145,13 @@ SetMapArrayInteger gets a reference to the given map[string][]int32 and assigns

### GetMapArrayAnytype

`func (o *AdditionalPropertiesClass) GetMapArrayAnytype() map[string][]map[string]interface{}`
`func (o *AdditionalPropertiesClass) GetMapArrayAnytype() map[string][]interface{}`

GetMapArrayAnytype returns the MapArrayAnytype field if non-nil, zero value otherwise.

### GetMapArrayAnytypeOk

`func (o *AdditionalPropertiesClass) GetMapArrayAnytypeOk() (map[string][]map[string]interface{}, bool)`
`func (o *AdditionalPropertiesClass) GetMapArrayAnytypeOk() (map[string][]interface{}, bool)`

GetMapArrayAnytypeOk returns a tuple with the MapArrayAnytype field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
Expand All @@ -164,9 +164,9 @@ HasMapArrayAnytype returns a boolean if a field has been set.

### SetMapArrayAnytype

`func (o *AdditionalPropertiesClass) SetMapArrayAnytype(v map[string][]map[string]interface{})`
`func (o *AdditionalPropertiesClass) SetMapArrayAnytype(v map[string][]interface{})`

SetMapArrayAnytype gets a reference to the given map[string][]map[string]interface{} and assigns it to the MapArrayAnytype field.
SetMapArrayAnytype gets a reference to the given map[string][]interface{} and assigns it to the MapArrayAnytype field.

### GetMapMapString

Expand Down Expand Up @@ -195,13 +195,13 @@ SetMapMapString gets a reference to the given map[string]map[string]string and a

### GetMapMapAnytype

`func (o *AdditionalPropertiesClass) GetMapMapAnytype() map[string]map[string]map[string]interface{}`
`func (o *AdditionalPropertiesClass) GetMapMapAnytype() map[string]map[string]interface{}`

GetMapMapAnytype returns the MapMapAnytype field if non-nil, zero value otherwise.

### GetMapMapAnytypeOk

`func (o *AdditionalPropertiesClass) GetMapMapAnytypeOk() (map[string]map[string]map[string]interface{}, bool)`
`func (o *AdditionalPropertiesClass) GetMapMapAnytypeOk() (map[string]map[string]interface{}, bool)`

GetMapMapAnytypeOk returns a tuple with the MapMapAnytype field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
Expand All @@ -214,19 +214,19 @@ HasMapMapAnytype returns a boolean if a field has been set.

### SetMapMapAnytype

`func (o *AdditionalPropertiesClass) SetMapMapAnytype(v map[string]map[string]map[string]interface{})`
`func (o *AdditionalPropertiesClass) SetMapMapAnytype(v map[string]map[string]interface{})`

SetMapMapAnytype gets a reference to the given map[string]map[string]map[string]interface{} and assigns it to the MapMapAnytype field.
SetMapMapAnytype gets a reference to the given map[string]map[string]interface{} and assigns it to the MapMapAnytype field.

### GetAnytype1

`func (o *AdditionalPropertiesClass) GetAnytype1() map[string]interface{}`
`func (o *AdditionalPropertiesClass) GetAnytype1() interface{}`

GetAnytype1 returns the Anytype1 field if non-nil, zero value otherwise.

### GetAnytype1Ok

`func (o *AdditionalPropertiesClass) GetAnytype1Ok() (map[string]interface{}, bool)`
`func (o *AdditionalPropertiesClass) GetAnytype1Ok() (interface{}, bool)`

GetAnytype1Ok returns a tuple with the Anytype1 field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
Expand All @@ -239,19 +239,19 @@ HasAnytype1 returns a boolean if a field has been set.

### SetAnytype1

`func (o *AdditionalPropertiesClass) SetAnytype1(v map[string]interface{})`
`func (o *AdditionalPropertiesClass) SetAnytype1(v interface{})`

SetAnytype1 gets a reference to the given map[string]interface{} and assigns it to the Anytype1 field.
SetAnytype1 gets a reference to the given interface{} and assigns it to the Anytype1 field.

### GetAnytype2

`func (o *AdditionalPropertiesClass) GetAnytype2() map[string]interface{}`
`func (o *AdditionalPropertiesClass) GetAnytype2() interface{}`

GetAnytype2 returns the Anytype2 field if non-nil, zero value otherwise.

### GetAnytype2Ok

`func (o *AdditionalPropertiesClass) GetAnytype2Ok() (map[string]interface{}, bool)`
`func (o *AdditionalPropertiesClass) GetAnytype2Ok() (interface{}, bool)`

GetAnytype2Ok returns a tuple with the Anytype2 field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
Expand All @@ -264,19 +264,19 @@ HasAnytype2 returns a boolean if a field has been set.

### SetAnytype2

`func (o *AdditionalPropertiesClass) SetAnytype2(v map[string]interface{})`
`func (o *AdditionalPropertiesClass) SetAnytype2(v interface{})`

SetAnytype2 gets a reference to the given map[string]interface{} and assigns it to the Anytype2 field.
SetAnytype2 gets a reference to the given interface{} and assigns it to the Anytype2 field.

### GetAnytype3

`func (o *AdditionalPropertiesClass) GetAnytype3() map[string]interface{}`
`func (o *AdditionalPropertiesClass) GetAnytype3() interface{}`

GetAnytype3 returns the Anytype3 field if non-nil, zero value otherwise.

### GetAnytype3Ok

`func (o *AdditionalPropertiesClass) GetAnytype3Ok() (map[string]interface{}, bool)`
`func (o *AdditionalPropertiesClass) GetAnytype3Ok() (interface{}, bool)`

GetAnytype3Ok returns a tuple with the Anytype3 field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
Expand All @@ -289,9 +289,9 @@ HasAnytype3 returns a boolean if a field has been set.

### SetAnytype3

`func (o *AdditionalPropertiesClass) SetAnytype3(v map[string]interface{})`
`func (o *AdditionalPropertiesClass) SetAnytype3(v interface{})`

SetAnytype3 gets a reference to the given map[string]interface{} and assigns it to the Anytype3 field.
SetAnytype3 gets a reference to the given interface{} and assigns it to the Anytype3 field.


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**StringItem** | Pointer to **string** | |
**NumberItem** | Pointer to **float32** | |
**FloatItem** | Pointer to **float32** | |
**IntegerItem** | Pointer to **int32** | |
**BoolItem** | Pointer to **bool** | |
**ArrayItem** | Pointer to **[]int32** | |
Expand Down Expand Up @@ -62,6 +63,31 @@ HasNumberItem returns a boolean if a field has been set.

SetNumberItem gets a reference to the given float32 and assigns it to the NumberItem field.

### GetFloatItem

`func (o *TypeHolderExample) GetFloatItem() float32`

GetFloatItem returns the FloatItem field if non-nil, zero value otherwise.

### GetFloatItemOk

`func (o *TypeHolderExample) GetFloatItemOk() (float32, bool)`

GetFloatItemOk returns a tuple with the FloatItem field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### HasFloatItem

`func (o *TypeHolderExample) HasFloatItem() bool`

HasFloatItem returns a boolean if a field has been set.

### SetFloatItem

`func (o *TypeHolderExample) SetFloatItem(v float32)`

SetFloatItem gets a reference to the given float32 and assigns it to the FloatItem field.

### GetIntegerItem

`func (o *TypeHolderExample) GetIntegerItem() int32`
Expand Down
16 changes: 11 additions & 5 deletions samples/client/petstore/go-experimental/go-petstore/git_push.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"

git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4

if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi

if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
Expand All @@ -28,7 +34,7 @@ git init
# Adds the files in the local repository and stages them for commit.
git add .

# Commits the tracked changes and prepares them to be pushed to a remote repository.
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"

# Sets the new remote
Expand All @@ -37,16 +43,16 @@ if [ "$git_remote" = "" ]; then # git remote not defined

if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi

fi

git pull origin master

# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

Loading