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
16 changes: 13 additions & 3 deletions modules/openapi-generator/src/main/resources/dart/class.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,24 @@ class {{classname}} {
return {
{{#vars}}
{{#isDateTime}}
'{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}
'{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}
{{/isDateTime}}
{{#isDate}}
'{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}
'{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}
{{/isDate}}
{{^isDateTime}}
{{^isDate}}
'{{baseName}}': {{name}}{{^-last}},{{/-last}}
{{#complexType}}
{{#isListContainer}}
'{{baseName}}': {{name}} == null ? null : {{name}}.map((item) => item.toJson()).toList(){{^-last}},{{/-last}}
{{/isListContainer}}
{{^isListContainer}}
'{{baseName}}': {{name}} == null ? null : {{name}}.toJson(){{^-last}},{{/-last}}
{{/isListContainer}}
{{/complexType}}
{{^complexType}}
'{{baseName}}': {{name}}{{^-last}},{{/-last}}
{{/complexType}}
{{/isDate}}
{{/isDateTime}}
{{/vars}}
Expand Down
13 changes: 11 additions & 2 deletions samples/client/petstore/dart/flutter_petstore/openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ import 'package:openapi/api.dart';
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';

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

try {
api_instance.addPet(body);
var result = api_instance.addPet(pet);
print(result);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
Expand Down Expand Up @@ -89,6 +90,8 @@ Class | Method | HTTP request | Description

- [ApiResponse](doc//ApiResponse.md)
- [Category](doc//Category.md)
- [InlineObject](doc//InlineObject.md)
- [InlineObject1](doc//InlineObject1.md)
- [Order](doc//Order.md)
- [Pet](doc//Pet.md)
- [Tag](doc//Tag.md)
Expand All @@ -104,6 +107,12 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key
- **Location**: HTTP header

## auth_cookie

- **Type**: API key
- **API key parameter name**: AUTH_KEY
- **Location**:

## petstore_auth

- **Type**: OAuth
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# openapi.model.InlineObject

## Load the model package
```dart
import 'package:openapi/api.dart';
```

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | Updated name of the pet | [optional] [default to null]
**status** | **String** | Updated status of the pet | [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)


Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# openapi.model.InlineObject1

## Load the model package
```dart
import 'package:openapi/api.dart';
```

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**additionalMetadata** | **String** | Additional data to pass to server | [optional] [default to null]
**file** | [**MultipartFile**](File.md) | file to upload | [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)


26 changes: 14 additions & 12 deletions samples/client/petstore/dart/flutter_petstore/openapi/doc/PetApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Method | HTTP request | Description


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

Add a new pet to the store

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

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

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

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

### Return type

void (empty response body)
[**Pet**](Pet.md)

### Authorization

Expand All @@ -57,7 +58,7 @@ void (empty response body)
### HTTP request headers

- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
- **Accept**: application/xml, application/json

[[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)

Expand Down Expand Up @@ -243,7 +244,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(body)
> Pet updatePet(pet)

Update an existing pet

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

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

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

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

### Return type

void (empty response body)
[**Pet**](Pet.md)

### Authorization

Expand All @@ -280,7 +282,7 @@ void (empty response body)
### HTTP request headers

- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
- **Accept**: application/xml, application/json

[[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)

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(body)
> Order placeOrder(order)

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 body = new Order(); // Order | order placed for purchasing the pet
var order = new Order(); // Order | order placed for purchasing the pet

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

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

### Return type

Expand All @@ -179,7 +179,7 @@ No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/xml, application/json

[[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)
Expand Down
Loading