Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DART2]: fix Map<String, nativeType> fromJson #1936

Merged
merged 1 commit into from
Jan 25, 2019
Merged
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 @@ -42,10 +42,15 @@ class {{classname}} {
{{/complexType}}
{{^complexType}}
{{#isListContainer}}
{{name}} = (json['{{baseName}}'] as List).map((item) => item as {{items.datatype}}).toList();
{{name}} = (json['{{baseName}}'] as List).cast<{{items.datatype}}>();
{{/isListContainer}}
{{^isListContainer}}
{{name}} = json['{{baseName}}'];
{{#isMapContainer}}
{{name}} = (json['{{baseName}}'] as Map).cast<String, {{items.datatype}}>();
{{/isMapContainer}}
{{^isMapContainer}}
{{name}} = json['{{baseName}}'];
{{/isMapContainer}}
{{/isListContainer}}
{{/complexType}}
{{/isDate}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1-SNAPSHOT
4.0.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is a sample server Petstore server. For this sample, you can use the api ke
This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project:

- API version: 1.0.0
- Build date: 2018-12-02T16:16:44.701611+01:00[Europe/Paris]
- Build date: 2019-01-17T18:23:25.026381+01:00[Europe/Vienna]
- Build package: org.openapitools.codegen.languages.DartJaguarClientCodegen

## Requirements
Expand Down Expand Up @@ -57,10 +57,10 @@ import 'package:openapi/api.dart';

final jaguarApiGen = JaguarApiGen();
var api_instance = jaguarApiGen.getPetApi();
var pet = new Pet(); // Pet | Pet object that needs to be added to the store
var body = new Pet(); // Pet | Pet object that needs to be added to the store

try {
api_instance.addPet(pet);
api_instance.addPet(body);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Method | HTTP request | Description


# **addPet**
> addPet(pet)
> addPet(body)

Add a new pet to the store

Expand All @@ -31,10 +31,10 @@ import 'package:openapi/api.dart';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';

var api_instance = new PetApi();
var pet = new Pet(); // Pet | Pet object that needs to be added to the store
var body = new Pet(); // Pet | Pet object that needs to be added to the store

try {
api_instance.addPet(pet);
api_instance.addPet(body);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
Expand All @@ -44,7 +44,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |

### Return type

Expand Down Expand Up @@ -243,7 +243,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **updatePet**
> updatePet(pet)
> updatePet(body)

Update an existing pet

Expand All @@ -254,10 +254,10 @@ import 'package:openapi/api.dart';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';

var api_instance = new PetApi();
var pet = new Pet(); // Pet | Pet object that needs to be added to the store
var body = new Pet(); // Pet | Pet object that needs to be added to the store

try {
api_instance.updatePet(pet);
api_instance.updatePet(body);
} catch (e) {
print("Exception when calling PetApi->updatePet: $e\n");
}
Expand All @@ -267,7 +267,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **placeOrder**
> Order placeOrder(order)
> Order placeOrder(body)

Place an order for a pet

Expand All @@ -153,10 +153,10 @@ Place an order for a pet
import 'package:openapi/api.dart';

var api_instance = new StoreApi();
var order = new Order(); // Order | order placed for purchasing the pet
var body = new Order(); // Order | order placed for purchasing the pet

try {
var result = api_instance.placeOrder(order);
var result = api_instance.placeOrder(body);
print(result);
} catch (e) {
print("Exception when calling StoreApi->placeOrder: $e\n");
Expand All @@ -167,7 +167,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
**body** | [**Order**](Order.md)| order placed for purchasing the pet |

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Method | HTTP request | Description


# **createUser**
> createUser(user)
> createUser(body)

Create user

Expand All @@ -31,10 +31,10 @@ This can only be done by the logged in user.
import 'package:openapi/api.dart';

var api_instance = new UserApi();
var user = new User(); // User | Created user object
var body = new User(); // User | Created user object

try {
api_instance.createUser(user);
api_instance.createUser(body);
} catch (e) {
print("Exception when calling UserApi->createUser: $e\n");
}
Expand All @@ -44,7 +44,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**User**](User.md)| Created user object |
**body** | [**User**](User.md)| Created user object |

### Return type

Expand All @@ -62,7 +62,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **createUsersWithArrayInput**
> createUsersWithArrayInput(user)
> createUsersWithArrayInput(body)

Creates list of users with given input array

Expand All @@ -71,10 +71,10 @@ Creates list of users with given input array
import 'package:openapi/api.dart';

var api_instance = new UserApi();
var user = [new List&lt;User&gt;()]; // List<User> | List of user object
var body = [new List&lt;User&gt;()]; // List<User> | List of user object

try {
api_instance.createUsersWithArrayInput(user);
api_instance.createUsersWithArrayInput(body);
} catch (e) {
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
}
Expand All @@ -84,7 +84,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](List.md)| List of user object |

### Return type

Expand All @@ -102,7 +102,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **createUsersWithListInput**
> createUsersWithListInput(user)
> createUsersWithListInput(body)

Creates list of users with given input array

Expand All @@ -111,10 +111,10 @@ Creates list of users with given input array
import 'package:openapi/api.dart';

var api_instance = new UserApi();
var user = [new List&lt;User&gt;()]; // List<User> | List of user object
var body = [new List&lt;User&gt;()]; // List<User> | List of user object

try {
api_instance.createUsersWithListInput(user);
api_instance.createUsersWithListInput(body);
} catch (e) {
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
}
Expand All @@ -124,7 +124,7 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](List.md)| List of user object |

### Return type

Expand Down Expand Up @@ -304,7 +304,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **updateUser**
> updateUser(username, user)
> updateUser(username, body)

Updated user

Expand All @@ -316,10 +316,10 @@ import 'package:openapi/api.dart';

var api_instance = new UserApi();
var username = username_example; // String | name that need to be deleted
var user = new User(); // User | Updated user object
var body = new User(); // User | Updated user object

try {
api_instance.updateUser(username, user);
api_instance.updateUser(username, body);
} catch (e) {
print("Exception when calling UserApi->updateUser: $e\n");
}
Expand All @@ -330,7 +330,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted | [default to null]
**user** | [**User**](User.md)| Updated user object |
**body** | [**User**](User.md)| Updated user object |

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class PetApi extends _$PetApiClient implements ApiClient {
@PostReq(path: "/pet", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]})
Future<void> addPet(

@AsJson() Pet pet
@AsJson() Pet body
) {
return super.addPet(


pet
body
).timeout(timeout);
}

Expand Down Expand Up @@ -99,12 +99,12 @@ class PetApi extends _$PetApiClient implements ApiClient {
@PutReq(path: "/pet", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]})
Future<void> updatePet(

@AsJson() Pet pet
@AsJson() Pet body
) {
return super.updatePet(


pet
body
).timeout(timeout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class StoreApi extends _$StoreApiClient implements ApiClient {
@PostReq(path: "/store/order")
Future<Order> placeOrder(

@AsJson() Order order
@AsJson() Order body
) {
return super.placeOrder(


order
body
).timeout(timeout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class UserApi extends _$UserApiClient implements ApiClient {
@PostReq(path: "/user")
Future<void> createUser(

@AsJson() User user
@AsJson() User body
) {
return super.createUser(


user
body
).timeout(timeout);
}

Expand All @@ -38,12 +38,12 @@ class UserApi extends _$UserApiClient implements ApiClient {
@PostReq(path: "/user/createWithArray")
Future<void> createUsersWithArrayInput(

@AsJson() List<User> user
@AsJson() List<User> body
) {
return super.createUsersWithArrayInput(


user
body
).timeout(timeout);
}

Expand All @@ -53,12 +53,12 @@ class UserApi extends _$UserApiClient implements ApiClient {
@PostReq(path: "/user/createWithList")
Future<void> createUsersWithListInput(

@AsJson() List<User> user
@AsJson() List<User> body
) {
return super.createUsersWithListInput(


user
body
).timeout(timeout);
}

Expand Down Expand Up @@ -125,13 +125,13 @@ class UserApi extends _$UserApiClient implements ApiClient {
Future<void> updateUser(
@PathParam("username") String username
,
@AsJson() User user
@AsJson() User body
) {
return super.updateUser(
username

,
user
body
).timeout(timeout);
}

Expand Down
Loading