Skip to content

Commit

Permalink
fix toDefaultValueWithParam in JS (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Apr 26, 2018
1 parent f5f7546 commit fe15f46
Show file tree
Hide file tree
Showing 53 changed files with 449 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ public String toDefaultValue(Schema p) {
public String toDefaultValueWithParam(String name, Schema p) {
String type = normalizeType(getTypeDeclaration(p));
if (!StringUtils.isEmpty(p.get$ref())) {
return " = " + type + ".constructFromObject(data['" + p.getName() + "']);";
return " = " + type + ".constructFromObject(data['" + getSchemaType(p) + "']);";
} else {
return " = ApiClient.convertToType(data['" + name + "'], " + type + ");";
}
Expand Down
12 changes: 7 additions & 5 deletions samples/client/petstore/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/

- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen

## Installation

Expand Down Expand Up @@ -96,7 +96,9 @@ Please follow the [installation](#installation) instruction and execute the foll
var SwaggerPetstore = require('swagger_petstore');

var api = new SwaggerPetstore.AnotherFakeApi()
var client = new SwaggerPetstore.Client(); // {Client} client model

var body = new SwaggerPetstore.Client(); // {Client} client model


var callback = function(error, data, response) {
if (error) {
Expand All @@ -105,7 +107,7 @@ var callback = function(error, data, response) {
console.log('API called successfully. Returned data: ' + data);
}
};
api.testSpecialTags(client, callback);
api.testSpecialTags(body, callback);

```

Expand Down Expand Up @@ -159,11 +161,9 @@ Class | Method | HTTP request | Description
- [SwaggerPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [SwaggerPetstore.ArrayTest](docs/ArrayTest.md)
- [SwaggerPetstore.Capitalization](docs/Capitalization.md)
- [SwaggerPetstore.Cat](docs/Cat.md)
- [SwaggerPetstore.Category](docs/Category.md)
- [SwaggerPetstore.ClassModel](docs/ClassModel.md)
- [SwaggerPetstore.Client](docs/Client.md)
- [SwaggerPetstore.Dog](docs/Dog.md)
- [SwaggerPetstore.EnumArrays](docs/EnumArrays.md)
- [SwaggerPetstore.EnumClass](docs/EnumClass.md)
- [SwaggerPetstore.EnumTest](docs/EnumTest.md)
Expand All @@ -187,6 +187,8 @@ Class | Method | HTTP request | Description
- [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md)
- [SwaggerPetstore.Tag](docs/Tag.md)
- [SwaggerPetstore.User](docs/User.md)
- [SwaggerPetstore.Cat](docs/Cat.md)
- [SwaggerPetstore.Dog](docs/Dog.md)


## Documentation for Authorization
Expand Down
11 changes: 7 additions & 4 deletions samples/client/petstore/javascript/docs/AnotherFakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Method | HTTP request | Description

<a name="testSpecialTags"></a>
# **testSpecialTags**
> Client testSpecialTags(client)
> Client testSpecialTags(body)
To test special tags

Expand All @@ -20,22 +20,25 @@ To test special tags
var SwaggerPetstore = require('swagger_petstore');

var apiInstance = new SwaggerPetstore.AnotherFakeApi();
var client = new SwaggerPetstore.Client(); // Client | client model

var body = new SwaggerPetstore.Client(); // Client | client model


var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.testSpecialTags(client, callback);
apiInstance.testSpecialTags(body, callback);
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model |
**body** | [**Client**](Client.md)| client model |

### Return type

Expand Down
Loading

0 comments on commit fe15f46

Please sign in to comment.