mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-14 16:33:56 +00:00
* #21582 [BUG][dart-dio] Bug generating inline enums with common names * #21582 [BUG][dart-dio] Bug generating inline enums with common names added petstore test * #21582 [BUG][dart-dio] Bug generating inline enums with common names added generated samples to commit. * #21582 [BUG][dart-dio] Bug generating inline enums with common names removed bug test files that were duplicates * #21582 [BUG][dart-dio] Bug generating inline enums with common names. Added generated files that were missed. * #21582 [BUG][dart-dio] Bug generating inline enums with common names. Added generated files that were missed. * #21582 [BUG][dart-dio] Bug generating inline enums with common names. Added generated files that where updated as a result of changes in master.
This commit is contained in:
parent
aacbdf88c0
commit
9cb04c1b9d
@ -576,6 +576,12 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
// inner items e.g. enums in collections, only works for one level
|
// inner items e.g. enums in collections, only works for one level
|
||||||
// but same is the case for DefaultCodegen
|
// but same is the case for DefaultCodegen
|
||||||
property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.items.datatypeWithEnum, enumName));
|
property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.items.datatypeWithEnum, enumName));
|
||||||
|
// Because properties are cached in org.openapitools.codegen.DefaultCodegen.fromProperty(java.lang.String, io.swagger.v3.oas.models.media.Schema, boolean, boolean)
|
||||||
|
// then the same object could be for multiple properties where the name of the inline enum is the same
|
||||||
|
// in 2 different classes and the following renaming will impact properties in other classes we
|
||||||
|
// therefore clone them before editing
|
||||||
|
property.items = property.items.clone();
|
||||||
|
property.mostInnerItems = property.items;
|
||||||
property.items.setDatatypeWithEnum(enumName);
|
property.items.setDatatypeWithEnum(enumName);
|
||||||
property.items.setEnumName(enumName);
|
property.items.setEnumName(enumName);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1303,6 +1303,19 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: The instance started successfully
|
description: The instance started successfully
|
||||||
|
/fake/duplicate-inline-enums:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- fake
|
||||||
|
summary: test objects with duplicate inline enums see issue# 21582
|
||||||
|
operationId: fake-duplicate-inline-enum
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ObjectThatReferencesObjectsWithDuplicateInlineEnums'
|
||||||
servers:
|
servers:
|
||||||
- url: 'http://{server}.swagger.io:{port}/v2'
|
- url: 'http://{server}.swagger.io:{port}/v2'
|
||||||
description: petstore server
|
description: petstore server
|
||||||
@ -2081,3 +2094,36 @@ components:
|
|||||||
$ref: '#/components/schemas/TestEnum'
|
$ref: '#/components/schemas/TestEnum'
|
||||||
default: ""
|
default: ""
|
||||||
title: TestItem
|
title: TestItem
|
||||||
|
ObjectWithInlineEnum:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
attribute:
|
||||||
|
description: 'Object one attribute enum'
|
||||||
|
type: 'array'
|
||||||
|
uniqueItems: true
|
||||||
|
items:
|
||||||
|
type: 'string'
|
||||||
|
enum: [
|
||||||
|
'value_one',
|
||||||
|
'value_two'
|
||||||
|
]
|
||||||
|
ObjectWithDuplicateInlineEnum:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
attribute:
|
||||||
|
description: 'Object two attribute enum'
|
||||||
|
type: 'array'
|
||||||
|
uniqueItems: true
|
||||||
|
items:
|
||||||
|
type: 'string'
|
||||||
|
enum: [
|
||||||
|
'value_one',
|
||||||
|
'value_two'
|
||||||
|
]
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
object_one:
|
||||||
|
$ref: '#/components/schemas/ObjectWithInlineEnum'
|
||||||
|
object_two:
|
||||||
|
$ref: '#/components/schemas/ObjectWithDuplicateInlineEnum'
|
||||||
|
@ -40,7 +40,10 @@ doc/ModelReturn.md
|
|||||||
doc/Name.md
|
doc/Name.md
|
||||||
doc/NullableClass.md
|
doc/NullableClass.md
|
||||||
doc/NumberOnly.md
|
doc/NumberOnly.md
|
||||||
|
doc/ObjectThatReferencesObjectsWithDuplicateInlineEnums.md
|
||||||
doc/ObjectWithDeprecatedFields.md
|
doc/ObjectWithDeprecatedFields.md
|
||||||
|
doc/ObjectWithDuplicateInlineEnum.md
|
||||||
|
doc/ObjectWithInlineEnum.md
|
||||||
doc/Order.md
|
doc/Order.md
|
||||||
doc/OuterComposite.md
|
doc/OuterComposite.md
|
||||||
doc/OuterEnum.md
|
doc/OuterEnum.md
|
||||||
@ -110,7 +113,10 @@ lib/src/model/model_return.dart
|
|||||||
lib/src/model/name.dart
|
lib/src/model/name.dart
|
||||||
lib/src/model/nullable_class.dart
|
lib/src/model/nullable_class.dart
|
||||||
lib/src/model/number_only.dart
|
lib/src/model/number_only.dart
|
||||||
|
lib/src/model/object_that_references_objects_with_duplicate_inline_enums.dart
|
||||||
lib/src/model/object_with_deprecated_fields.dart
|
lib/src/model/object_with_deprecated_fields.dart
|
||||||
|
lib/src/model/object_with_duplicate_inline_enum.dart
|
||||||
|
lib/src/model/object_with_inline_enum.dart
|
||||||
lib/src/model/order.dart
|
lib/src/model/order.dart
|
||||||
lib/src/model/outer_composite.dart
|
lib/src/model/outer_composite.dart
|
||||||
lib/src/model/outer_enum.dart
|
lib/src/model/outer_enum.dart
|
||||||
|
@ -69,6 +69,7 @@ Class | Method | HTTP request | Description
|
|||||||
[*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
|
[*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
[*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo |
|
[*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo |
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
||||||
|
[*FakeApi*](doc/FakeApi.md) | [**fakeDuplicateInlineEnum**](doc/FakeApi.md#fakeduplicateinlineenum) | **GET** /fake/duplicate-inline-enums | test objects with duplicate inline enums see issue# 21582
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
||||||
@ -150,7 +151,10 @@ Class | Method | HTTP request | Description
|
|||||||
- [Name](doc/Name.md)
|
- [Name](doc/Name.md)
|
||||||
- [NullableClass](doc/NullableClass.md)
|
- [NullableClass](doc/NullableClass.md)
|
||||||
- [NumberOnly](doc/NumberOnly.md)
|
- [NumberOnly](doc/NumberOnly.md)
|
||||||
|
- [ObjectThatReferencesObjectsWithDuplicateInlineEnums](doc/ObjectThatReferencesObjectsWithDuplicateInlineEnums.md)
|
||||||
- [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.md)
|
- [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.md)
|
||||||
|
- [ObjectWithDuplicateInlineEnum](doc/ObjectWithDuplicateInlineEnum.md)
|
||||||
|
- [ObjectWithInlineEnum](doc/ObjectWithInlineEnum.md)
|
||||||
- [Order](doc/Order.md)
|
- [Order](doc/Order.md)
|
||||||
- [OuterComposite](doc/OuterComposite.md)
|
- [OuterComposite](doc/OuterComposite.md)
|
||||||
- [OuterEnum](doc/OuterEnum.md)
|
- [OuterEnum](doc/OuterEnum.md)
|
||||||
|
@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
|||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
||||||
|
[**fakeDuplicateInlineEnum**](FakeApi.md#fakeduplicateinlineenum) | **GET** /fake/duplicate-inline-enums | test objects with duplicate inline enums see issue# 21582
|
||||||
[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
||||||
[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
||||||
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
||||||
@ -72,6 +73,43 @@ 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)
|
[[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)
|
||||||
|
|
||||||
|
# **fakeDuplicateInlineEnum**
|
||||||
|
> ObjectThatReferencesObjectsWithDuplicateInlineEnums fakeDuplicateInlineEnum()
|
||||||
|
|
||||||
|
test objects with duplicate inline enums see issue# 21582
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
|
final api = Openapi().getFakeApi();
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = api.fakeDuplicateInlineEnum();
|
||||||
|
print(response);
|
||||||
|
} catch on DioException (e) {
|
||||||
|
print('Exception when calling FakeApi->fakeDuplicateInlineEnum: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ObjectThatReferencesObjectsWithDuplicateInlineEnums**](ObjectThatReferencesObjectsWithDuplicateInlineEnums.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: 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)
|
||||||
|
|
||||||
# **fakeHealthGet**
|
# **fakeHealthGet**
|
||||||
> HealthCheckResult fakeHealthGet()
|
> HealthCheckResult fakeHealthGet()
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
# openapi.model.ObjectThatReferencesObjectsWithDuplicateInlineEnums
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**objectOne** | [**ObjectWithInlineEnum**](ObjectWithInlineEnum.md) | | [optional]
|
||||||
|
**objectTwo** | [**ObjectWithDuplicateInlineEnum**](ObjectWithDuplicateInlineEnum.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# openapi.model.ObjectWithDuplicateInlineEnum
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**attribute** | **Set<String>** | Object two attribute enum | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# openapi.model.ObjectWithInlineEnum
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**attribute** | **Set<String>** | Object one attribute enum | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -51,7 +51,10 @@ export 'package:openapi/src/model/model_return.dart';
|
|||||||
export 'package:openapi/src/model/name.dart';
|
export 'package:openapi/src/model/name.dart';
|
||||||
export 'package:openapi/src/model/nullable_class.dart';
|
export 'package:openapi/src/model/nullable_class.dart';
|
||||||
export 'package:openapi/src/model/number_only.dart';
|
export 'package:openapi/src/model/number_only.dart';
|
||||||
|
export 'package:openapi/src/model/object_that_references_objects_with_duplicate_inline_enums.dart';
|
||||||
export 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
export 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
||||||
|
export 'package:openapi/src/model/object_with_duplicate_inline_enum.dart';
|
||||||
|
export 'package:openapi/src/model/object_with_inline_enum.dart';
|
||||||
export 'package:openapi/src/model/order.dart';
|
export 'package:openapi/src/model/order.dart';
|
||||||
export 'package:openapi/src/model/outer_composite.dart';
|
export 'package:openapi/src/model/outer_composite.dart';
|
||||||
export 'package:openapi/src/model/outer_enum.dart';
|
export 'package:openapi/src/model/outer_enum.dart';
|
||||||
|
@ -15,6 +15,7 @@ import 'package:openapi/src/model/file_schema_test_class.dart';
|
|||||||
import 'package:openapi/src/model/health_check_result.dart';
|
import 'package:openapi/src/model/health_check_result.dart';
|
||||||
import 'package:openapi/src/model/model_client.dart';
|
import 'package:openapi/src/model/model_client.dart';
|
||||||
import 'package:openapi/src/model/model_enum_class.dart';
|
import 'package:openapi/src/model/model_enum_class.dart';
|
||||||
|
import 'package:openapi/src/model/object_that_references_objects_with_duplicate_inline_enums.dart';
|
||||||
import 'package:openapi/src/model/outer_composite.dart';
|
import 'package:openapi/src/model/outer_composite.dart';
|
||||||
import 'package:openapi/src/model/outer_object_with_enum_property.dart';
|
import 'package:openapi/src/model/outer_object_with_enum_property.dart';
|
||||||
import 'package:openapi/src/model/pet.dart';
|
import 'package:openapi/src/model/pet.dart';
|
||||||
@ -97,6 +98,76 @@ _responseData = rawData == null ? null : deserialize<FakeBigDecimalMap200Respons
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// test objects with duplicate inline enums see issue# 21582
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// Parameters:
|
||||||
|
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||||
|
/// * [headers] - Can be used to add additional headers to the request
|
||||||
|
/// * [extras] - Can be used to add flags to the request
|
||||||
|
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||||
|
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||||
|
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||||
|
///
|
||||||
|
/// Returns a [Future] containing a [Response] with a [ObjectThatReferencesObjectsWithDuplicateInlineEnums] as data
|
||||||
|
/// Throws [DioException] if API call or serialization fails
|
||||||
|
Future<Response<ObjectThatReferencesObjectsWithDuplicateInlineEnums>> fakeDuplicateInlineEnum({
|
||||||
|
CancelToken? cancelToken,
|
||||||
|
Map<String, dynamic>? headers,
|
||||||
|
Map<String, dynamic>? extra,
|
||||||
|
ValidateStatus? validateStatus,
|
||||||
|
ProgressCallback? onSendProgress,
|
||||||
|
ProgressCallback? onReceiveProgress,
|
||||||
|
}) async {
|
||||||
|
final _path = r'/fake/duplicate-inline-enums';
|
||||||
|
final _options = Options(
|
||||||
|
method: r'GET',
|
||||||
|
headers: <String, dynamic>{
|
||||||
|
...?headers,
|
||||||
|
},
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
'secure': <Map<String, String>>[],
|
||||||
|
...?extra,
|
||||||
|
},
|
||||||
|
validateStatus: validateStatus,
|
||||||
|
);
|
||||||
|
|
||||||
|
final _response = await _dio.request<Object>(
|
||||||
|
_path,
|
||||||
|
options: _options,
|
||||||
|
cancelToken: cancelToken,
|
||||||
|
onSendProgress: onSendProgress,
|
||||||
|
onReceiveProgress: onReceiveProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums? _responseData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
final rawData = _response.data;
|
||||||
|
_responseData = rawData == null ? null : deserialize<ObjectThatReferencesObjectsWithDuplicateInlineEnums, ObjectThatReferencesObjectsWithDuplicateInlineEnums>(rawData, 'ObjectThatReferencesObjectsWithDuplicateInlineEnums', growable: true);
|
||||||
|
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
throw DioException(
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
response: _response,
|
||||||
|
type: DioExceptionType.unknown,
|
||||||
|
error: error,
|
||||||
|
stackTrace: stackTrace,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response<ObjectThatReferencesObjectsWithDuplicateInlineEnums>(
|
||||||
|
data: _responseData,
|
||||||
|
headers: _response.headers,
|
||||||
|
isRedirect: _response.isRedirect,
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
redirects: _response.redirects,
|
||||||
|
statusCode: _response.statusCode,
|
||||||
|
statusMessage: _response.statusMessage,
|
||||||
|
extra: _response.extra,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Health check endpoint
|
/// Health check endpoint
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
@ -31,7 +31,10 @@ import 'package:openapi/src/model/model_return.dart';
|
|||||||
import 'package:openapi/src/model/name.dart';
|
import 'package:openapi/src/model/name.dart';
|
||||||
import 'package:openapi/src/model/nullable_class.dart';
|
import 'package:openapi/src/model/nullable_class.dart';
|
||||||
import 'package:openapi/src/model/number_only.dart';
|
import 'package:openapi/src/model/number_only.dart';
|
||||||
|
import 'package:openapi/src/model/object_that_references_objects_with_duplicate_inline_enums.dart';
|
||||||
import 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
import 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
||||||
|
import 'package:openapi/src/model/object_with_duplicate_inline_enum.dart';
|
||||||
|
import 'package:openapi/src/model/object_with_inline_enum.dart';
|
||||||
import 'package:openapi/src/model/order.dart';
|
import 'package:openapi/src/model/order.dart';
|
||||||
import 'package:openapi/src/model/outer_composite.dart';
|
import 'package:openapi/src/model/outer_composite.dart';
|
||||||
import 'package:openapi/src/model/outer_object_with_enum_property.dart';
|
import 'package:openapi/src/model/outer_object_with_enum_property.dart';
|
||||||
@ -131,8 +134,14 @@ final _regMap = RegExp(r'^Map<String,(.*)>$');
|
|||||||
return NullableClass.fromJson(value as Map<String, dynamic>) as ReturnType;
|
return NullableClass.fromJson(value as Map<String, dynamic>) as ReturnType;
|
||||||
case 'NumberOnly':
|
case 'NumberOnly':
|
||||||
return NumberOnly.fromJson(value as Map<String, dynamic>) as ReturnType;
|
return NumberOnly.fromJson(value as Map<String, dynamic>) as ReturnType;
|
||||||
|
case 'ObjectThatReferencesObjectsWithDuplicateInlineEnums':
|
||||||
|
return ObjectThatReferencesObjectsWithDuplicateInlineEnums.fromJson(value as Map<String, dynamic>) as ReturnType;
|
||||||
case 'ObjectWithDeprecatedFields':
|
case 'ObjectWithDeprecatedFields':
|
||||||
return ObjectWithDeprecatedFields.fromJson(value as Map<String, dynamic>) as ReturnType;
|
return ObjectWithDeprecatedFields.fromJson(value as Map<String, dynamic>) as ReturnType;
|
||||||
|
case 'ObjectWithDuplicateInlineEnum':
|
||||||
|
return ObjectWithDuplicateInlineEnum.fromJson(value as Map<String, dynamic>) as ReturnType;
|
||||||
|
case 'ObjectWithInlineEnum':
|
||||||
|
return ObjectWithInlineEnum.fromJson(value as Map<String, dynamic>) as ReturnType;
|
||||||
case 'Order':
|
case 'Order':
|
||||||
return Order.fromJson(value as Map<String, dynamic>) as ReturnType;
|
return Order.fromJson(value as Map<String, dynamic>) as ReturnType;
|
||||||
case 'OuterComposite':
|
case 'OuterComposite':
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element
|
||||||
|
import 'package:openapi/src/model/object_with_duplicate_inline_enum.dart';
|
||||||
|
import 'package:openapi/src/model/object_with_inline_enum.dart';
|
||||||
|
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'object_that_references_objects_with_duplicate_inline_enums.g.dart';
|
||||||
|
|
||||||
|
|
||||||
|
@CopyWith()
|
||||||
|
@JsonSerializable(
|
||||||
|
checked: true,
|
||||||
|
createToJson: true,
|
||||||
|
disallowUnrecognizedKeys: false,
|
||||||
|
explicitToJson: true,
|
||||||
|
)
|
||||||
|
class ObjectThatReferencesObjectsWithDuplicateInlineEnums {
|
||||||
|
/// Returns a new [ObjectThatReferencesObjectsWithDuplicateInlineEnums] instance.
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums({
|
||||||
|
|
||||||
|
this.objectOne,
|
||||||
|
|
||||||
|
this.objectTwo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@JsonKey(
|
||||||
|
|
||||||
|
name: r'object_one',
|
||||||
|
required: false,
|
||||||
|
includeIfNull: false,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
final ObjectWithInlineEnum? objectOne;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@JsonKey(
|
||||||
|
|
||||||
|
name: r'object_two',
|
||||||
|
required: false,
|
||||||
|
includeIfNull: false,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
final ObjectWithDuplicateInlineEnum? objectTwo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is ObjectThatReferencesObjectsWithDuplicateInlineEnums &&
|
||||||
|
other.objectOne == objectOne &&
|
||||||
|
other.objectTwo == objectTwo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
objectOne.hashCode +
|
||||||
|
objectTwo.hashCode;
|
||||||
|
|
||||||
|
factory ObjectThatReferencesObjectsWithDuplicateInlineEnums.fromJson(Map<String, dynamic> json) => _$ObjectThatReferencesObjectsWithDuplicateInlineEnumsFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$ObjectThatReferencesObjectsWithDuplicateInlineEnumsToJson(this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toJson().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element
|
||||||
|
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'object_with_duplicate_inline_enum.g.dart';
|
||||||
|
|
||||||
|
|
||||||
|
@CopyWith()
|
||||||
|
@JsonSerializable(
|
||||||
|
checked: true,
|
||||||
|
createToJson: true,
|
||||||
|
disallowUnrecognizedKeys: false,
|
||||||
|
explicitToJson: true,
|
||||||
|
)
|
||||||
|
class ObjectWithDuplicateInlineEnum {
|
||||||
|
/// Returns a new [ObjectWithDuplicateInlineEnum] instance.
|
||||||
|
ObjectWithDuplicateInlineEnum({
|
||||||
|
|
||||||
|
this.attribute,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// Object two attribute enum
|
||||||
|
@JsonKey(
|
||||||
|
|
||||||
|
name: r'attribute',
|
||||||
|
required: false,
|
||||||
|
includeIfNull: false,
|
||||||
|
unknownEnumValue: Set<ObjectWithDuplicateInlineEnumAttributeEnum>.unknownDefaultOpenApi,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
final Set<ObjectWithDuplicateInlineEnumAttributeEnum>? attribute;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is ObjectWithDuplicateInlineEnum &&
|
||||||
|
other.attribute == attribute;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
attribute.hashCode;
|
||||||
|
|
||||||
|
factory ObjectWithDuplicateInlineEnum.fromJson(Map<String, dynamic> json) => _$ObjectWithDuplicateInlineEnumFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$ObjectWithDuplicateInlineEnumToJson(this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toJson().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum ObjectWithDuplicateInlineEnumAttributeEnum {
|
||||||
|
@JsonValue(r'value_one')
|
||||||
|
valueOne(r'value_one'),
|
||||||
|
@JsonValue(r'value_two')
|
||||||
|
valueTwo(r'value_two'),
|
||||||
|
@JsonValue(r'unknown_default_open_api')
|
||||||
|
unknownDefaultOpenApi(r'unknown_default_open_api');
|
||||||
|
|
||||||
|
const ObjectWithDuplicateInlineEnumAttributeEnum(this.value);
|
||||||
|
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element
|
||||||
|
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'object_with_inline_enum.g.dart';
|
||||||
|
|
||||||
|
|
||||||
|
@CopyWith()
|
||||||
|
@JsonSerializable(
|
||||||
|
checked: true,
|
||||||
|
createToJson: true,
|
||||||
|
disallowUnrecognizedKeys: false,
|
||||||
|
explicitToJson: true,
|
||||||
|
)
|
||||||
|
class ObjectWithInlineEnum {
|
||||||
|
/// Returns a new [ObjectWithInlineEnum] instance.
|
||||||
|
ObjectWithInlineEnum({
|
||||||
|
|
||||||
|
this.attribute,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// Object one attribute enum
|
||||||
|
@JsonKey(
|
||||||
|
|
||||||
|
name: r'attribute',
|
||||||
|
required: false,
|
||||||
|
includeIfNull: false,
|
||||||
|
unknownEnumValue: Set<ObjectWithInlineEnumAttributeEnum>.unknownDefaultOpenApi,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
final Set<ObjectWithInlineEnumAttributeEnum>? attribute;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is ObjectWithInlineEnum &&
|
||||||
|
other.attribute == attribute;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
attribute.hashCode;
|
||||||
|
|
||||||
|
factory ObjectWithInlineEnum.fromJson(Map<String, dynamic> json) => _$ObjectWithInlineEnumFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$ObjectWithInlineEnumToJson(this);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toJson().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum ObjectWithInlineEnumAttributeEnum {
|
||||||
|
@JsonValue(r'value_one')
|
||||||
|
valueOne(r'value_one'),
|
||||||
|
@JsonValue(r'value_two')
|
||||||
|
valueTwo(r'value_two'),
|
||||||
|
@JsonValue(r'unknown_default_open_api')
|
||||||
|
unknownDefaultOpenApi(r'unknown_default_open_api');
|
||||||
|
|
||||||
|
const ObjectWithInlineEnumAttributeEnum(this.value);
|
||||||
|
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:openapi/openapi.dart';
|
||||||
|
|
||||||
|
// tests for ObjectThatReferencesObjectsWithDuplicateInlineEnums
|
||||||
|
void main() {
|
||||||
|
final ObjectThatReferencesObjectsWithDuplicateInlineEnums? instance = /* ObjectThatReferencesObjectsWithDuplicateInlineEnums(...) */ null;
|
||||||
|
// TODO add properties to the entity
|
||||||
|
|
||||||
|
group(ObjectThatReferencesObjectsWithDuplicateInlineEnums, () {
|
||||||
|
// ObjectWithInlineEnum objectOne
|
||||||
|
test('to test the property `objectOne`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// ObjectWithDuplicateInlineEnum objectTwo
|
||||||
|
test('to test the property `objectTwo`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:openapi/openapi.dart';
|
||||||
|
|
||||||
|
// tests for ObjectWithDuplicateInlineEnum
|
||||||
|
void main() {
|
||||||
|
final ObjectWithDuplicateInlineEnum? instance = /* ObjectWithDuplicateInlineEnum(...) */ null;
|
||||||
|
// TODO add properties to the entity
|
||||||
|
|
||||||
|
group(ObjectWithDuplicateInlineEnum, () {
|
||||||
|
// Object two attribute enum
|
||||||
|
// Set<String> attribute
|
||||||
|
test('to test the property `attribute`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:openapi/openapi.dart';
|
||||||
|
|
||||||
|
// tests for ObjectWithInlineEnum
|
||||||
|
void main() {
|
||||||
|
final ObjectWithInlineEnum? instance = /* ObjectWithInlineEnum(...) */ null;
|
||||||
|
// TODO add properties to the entity
|
||||||
|
|
||||||
|
group(ObjectWithInlineEnum, () {
|
||||||
|
// Object one attribute enum
|
||||||
|
// Set<String> attribute
|
||||||
|
test('to test the property `attribute`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
@ -39,7 +39,10 @@ doc/ModelReturn.md
|
|||||||
doc/Name.md
|
doc/Name.md
|
||||||
doc/NullableClass.md
|
doc/NullableClass.md
|
||||||
doc/NumberOnly.md
|
doc/NumberOnly.md
|
||||||
|
doc/ObjectThatReferencesObjectsWithDuplicateInlineEnums.md
|
||||||
doc/ObjectWithDeprecatedFields.md
|
doc/ObjectWithDeprecatedFields.md
|
||||||
|
doc/ObjectWithDuplicateInlineEnum.md
|
||||||
|
doc/ObjectWithInlineEnum.md
|
||||||
doc/Order.md
|
doc/Order.md
|
||||||
doc/OuterComposite.md
|
doc/OuterComposite.md
|
||||||
doc/OuterEnum.md
|
doc/OuterEnum.md
|
||||||
@ -111,7 +114,10 @@ lib/src/model/model_return.dart
|
|||||||
lib/src/model/name.dart
|
lib/src/model/name.dart
|
||||||
lib/src/model/nullable_class.dart
|
lib/src/model/nullable_class.dart
|
||||||
lib/src/model/number_only.dart
|
lib/src/model/number_only.dart
|
||||||
|
lib/src/model/object_that_references_objects_with_duplicate_inline_enums.dart
|
||||||
lib/src/model/object_with_deprecated_fields.dart
|
lib/src/model/object_with_deprecated_fields.dart
|
||||||
|
lib/src/model/object_with_duplicate_inline_enum.dart
|
||||||
|
lib/src/model/object_with_inline_enum.dart
|
||||||
lib/src/model/order.dart
|
lib/src/model/order.dart
|
||||||
lib/src/model/outer_composite.dart
|
lib/src/model/outer_composite.dart
|
||||||
lib/src/model/outer_enum.dart
|
lib/src/model/outer_enum.dart
|
||||||
|
@ -68,6 +68,7 @@ Class | Method | HTTP request | Description
|
|||||||
[*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
|
[*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
[*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo |
|
[*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo |
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
||||||
|
[*FakeApi*](doc/FakeApi.md) | [**fakeDuplicateInlineEnum**](doc/FakeApi.md#fakeduplicateinlineenum) | **GET** /fake/duplicate-inline-enums | test objects with duplicate inline enums see issue# 21582
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
||||||
[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
||||||
@ -149,7 +150,10 @@ Class | Method | HTTP request | Description
|
|||||||
- [Name](doc/Name.md)
|
- [Name](doc/Name.md)
|
||||||
- [NullableClass](doc/NullableClass.md)
|
- [NullableClass](doc/NullableClass.md)
|
||||||
- [NumberOnly](doc/NumberOnly.md)
|
- [NumberOnly](doc/NumberOnly.md)
|
||||||
|
- [ObjectThatReferencesObjectsWithDuplicateInlineEnums](doc/ObjectThatReferencesObjectsWithDuplicateInlineEnums.md)
|
||||||
- [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.md)
|
- [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.md)
|
||||||
|
- [ObjectWithDuplicateInlineEnum](doc/ObjectWithDuplicateInlineEnum.md)
|
||||||
|
- [ObjectWithInlineEnum](doc/ObjectWithInlineEnum.md)
|
||||||
- [Order](doc/Order.md)
|
- [Order](doc/Order.md)
|
||||||
- [OuterComposite](doc/OuterComposite.md)
|
- [OuterComposite](doc/OuterComposite.md)
|
||||||
- [OuterEnum](doc/OuterEnum.md)
|
- [OuterEnum](doc/OuterEnum.md)
|
||||||
|
@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
|||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
||||||
|
[**fakeDuplicateInlineEnum**](FakeApi.md#fakeduplicateinlineenum) | **GET** /fake/duplicate-inline-enums | test objects with duplicate inline enums see issue# 21582
|
||||||
[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
||||||
[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
||||||
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
||||||
@ -72,6 +73,43 @@ 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)
|
[[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)
|
||||||
|
|
||||||
|
# **fakeDuplicateInlineEnum**
|
||||||
|
> ObjectThatReferencesObjectsWithDuplicateInlineEnums fakeDuplicateInlineEnum()
|
||||||
|
|
||||||
|
test objects with duplicate inline enums see issue# 21582
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
|
final api = Openapi().getFakeApi();
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = api.fakeDuplicateInlineEnum();
|
||||||
|
print(response);
|
||||||
|
} catch on DioException (e) {
|
||||||
|
print('Exception when calling FakeApi->fakeDuplicateInlineEnum: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ObjectThatReferencesObjectsWithDuplicateInlineEnums**](ObjectThatReferencesObjectsWithDuplicateInlineEnums.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: 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)
|
||||||
|
|
||||||
# **fakeHealthGet**
|
# **fakeHealthGet**
|
||||||
> HealthCheckResult fakeHealthGet()
|
> HealthCheckResult fakeHealthGet()
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
# openapi.model.ObjectThatReferencesObjectsWithDuplicateInlineEnums
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**objectOne** | [**ObjectWithInlineEnum**](ObjectWithInlineEnum.md) | | [optional]
|
||||||
|
**objectTwo** | [**ObjectWithDuplicateInlineEnum**](ObjectWithDuplicateInlineEnum.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# openapi.model.ObjectWithDuplicateInlineEnum
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**attribute** | **BuiltSet<String>** | Object two attribute enum | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# openapi.model.ObjectWithInlineEnum
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**attribute** | **BuiltSet<String>** | Object one attribute enum | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -52,7 +52,10 @@ export 'package:openapi/src/model/model_return.dart';
|
|||||||
export 'package:openapi/src/model/name.dart';
|
export 'package:openapi/src/model/name.dart';
|
||||||
export 'package:openapi/src/model/nullable_class.dart';
|
export 'package:openapi/src/model/nullable_class.dart';
|
||||||
export 'package:openapi/src/model/number_only.dart';
|
export 'package:openapi/src/model/number_only.dart';
|
||||||
|
export 'package:openapi/src/model/object_that_references_objects_with_duplicate_inline_enums.dart';
|
||||||
export 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
export 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
||||||
|
export 'package:openapi/src/model/object_with_duplicate_inline_enum.dart';
|
||||||
|
export 'package:openapi/src/model/object_with_inline_enum.dart';
|
||||||
export 'package:openapi/src/model/order.dart';
|
export 'package:openapi/src/model/order.dart';
|
||||||
export 'package:openapi/src/model/outer_composite.dart';
|
export 'package:openapi/src/model/outer_composite.dart';
|
||||||
export 'package:openapi/src/model/outer_enum.dart';
|
export 'package:openapi/src/model/outer_enum.dart';
|
||||||
|
@ -19,6 +19,7 @@ import 'package:openapi/src/model/file_schema_test_class.dart';
|
|||||||
import 'package:openapi/src/model/health_check_result.dart';
|
import 'package:openapi/src/model/health_check_result.dart';
|
||||||
import 'package:openapi/src/model/model_client.dart';
|
import 'package:openapi/src/model/model_client.dart';
|
||||||
import 'package:openapi/src/model/model_enum_class.dart';
|
import 'package:openapi/src/model/model_enum_class.dart';
|
||||||
|
import 'package:openapi/src/model/object_that_references_objects_with_duplicate_inline_enums.dart';
|
||||||
import 'package:openapi/src/model/outer_composite.dart';
|
import 'package:openapi/src/model/outer_composite.dart';
|
||||||
import 'package:openapi/src/model/outer_object_with_enum_property.dart';
|
import 'package:openapi/src/model/outer_object_with_enum_property.dart';
|
||||||
import 'package:openapi/src/model/pet.dart';
|
import 'package:openapi/src/model/pet.dart';
|
||||||
@ -106,6 +107,79 @@ class FakeApi {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// test objects with duplicate inline enums see issue# 21582
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// Parameters:
|
||||||
|
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||||
|
/// * [headers] - Can be used to add additional headers to the request
|
||||||
|
/// * [extras] - Can be used to add flags to the request
|
||||||
|
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||||
|
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||||
|
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||||
|
///
|
||||||
|
/// Returns a [Future] containing a [Response] with a [ObjectThatReferencesObjectsWithDuplicateInlineEnums] as data
|
||||||
|
/// Throws [DioException] if API call or serialization fails
|
||||||
|
Future<Response<ObjectThatReferencesObjectsWithDuplicateInlineEnums>> fakeDuplicateInlineEnum({
|
||||||
|
CancelToken? cancelToken,
|
||||||
|
Map<String, dynamic>? headers,
|
||||||
|
Map<String, dynamic>? extra,
|
||||||
|
ValidateStatus? validateStatus,
|
||||||
|
ProgressCallback? onSendProgress,
|
||||||
|
ProgressCallback? onReceiveProgress,
|
||||||
|
}) async {
|
||||||
|
final _path = r'/fake/duplicate-inline-enums';
|
||||||
|
final _options = Options(
|
||||||
|
method: r'GET',
|
||||||
|
headers: <String, dynamic>{
|
||||||
|
...?headers,
|
||||||
|
},
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
'secure': <Map<String, String>>[],
|
||||||
|
...?extra,
|
||||||
|
},
|
||||||
|
validateStatus: validateStatus,
|
||||||
|
);
|
||||||
|
|
||||||
|
final _response = await _dio.request<Object>(
|
||||||
|
_path,
|
||||||
|
options: _options,
|
||||||
|
cancelToken: cancelToken,
|
||||||
|
onSendProgress: onSendProgress,
|
||||||
|
onReceiveProgress: onReceiveProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums? _responseData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
final rawResponse = _response.data;
|
||||||
|
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||||
|
rawResponse,
|
||||||
|
specifiedType: const FullType(ObjectThatReferencesObjectsWithDuplicateInlineEnums),
|
||||||
|
) as ObjectThatReferencesObjectsWithDuplicateInlineEnums;
|
||||||
|
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
throw DioException(
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
response: _response,
|
||||||
|
type: DioExceptionType.unknown,
|
||||||
|
error: error,
|
||||||
|
stackTrace: stackTrace,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response<ObjectThatReferencesObjectsWithDuplicateInlineEnums>(
|
||||||
|
data: _responseData,
|
||||||
|
headers: _response.headers,
|
||||||
|
isRedirect: _response.isRedirect,
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
redirects: _response.redirects,
|
||||||
|
statusCode: _response.statusCode,
|
||||||
|
statusMessage: _response.statusMessage,
|
||||||
|
extra: _response.extra,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Health check endpoint
|
/// Health check endpoint
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
@ -0,0 +1,128 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element
|
||||||
|
import 'package:openapi/src/model/object_with_duplicate_inline_enum.dart';
|
||||||
|
import 'package:openapi/src/model/object_with_inline_enum.dart';
|
||||||
|
import 'package:built_value/built_value.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
|
||||||
|
part 'object_that_references_objects_with_duplicate_inline_enums.g.dart';
|
||||||
|
|
||||||
|
/// ObjectThatReferencesObjectsWithDuplicateInlineEnums
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [objectOne]
|
||||||
|
/// * [objectTwo]
|
||||||
|
@BuiltValue()
|
||||||
|
abstract class ObjectThatReferencesObjectsWithDuplicateInlineEnums implements Built<ObjectThatReferencesObjectsWithDuplicateInlineEnums, ObjectThatReferencesObjectsWithDuplicateInlineEnumsBuilder> {
|
||||||
|
@BuiltValueField(wireName: r'object_one')
|
||||||
|
ObjectWithInlineEnum? get objectOne;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'object_two')
|
||||||
|
ObjectWithDuplicateInlineEnum? get objectTwo;
|
||||||
|
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums._();
|
||||||
|
|
||||||
|
factory ObjectThatReferencesObjectsWithDuplicateInlineEnums([void updates(ObjectThatReferencesObjectsWithDuplicateInlineEnumsBuilder b)]) = _$ObjectThatReferencesObjectsWithDuplicateInlineEnums;
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(ObjectThatReferencesObjectsWithDuplicateInlineEnumsBuilder b) => b;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<ObjectThatReferencesObjectsWithDuplicateInlineEnums> get serializer => _$ObjectThatReferencesObjectsWithDuplicateInlineEnumsSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$ObjectThatReferencesObjectsWithDuplicateInlineEnumsSerializer implements PrimitiveSerializer<ObjectThatReferencesObjectsWithDuplicateInlineEnums> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [ObjectThatReferencesObjectsWithDuplicateInlineEnums, _$ObjectThatReferencesObjectsWithDuplicateInlineEnums];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'ObjectThatReferencesObjectsWithDuplicateInlineEnums';
|
||||||
|
|
||||||
|
Iterable<Object?> _serializeProperties(
|
||||||
|
Serializers serializers,
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums object, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) sync* {
|
||||||
|
if (object.objectOne != null) {
|
||||||
|
yield r'object_one';
|
||||||
|
yield serializers.serialize(
|
||||||
|
object.objectOne,
|
||||||
|
specifiedType: const FullType(ObjectWithInlineEnum),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (object.objectTwo != null) {
|
||||||
|
yield r'object_two';
|
||||||
|
yield serializers.serialize(
|
||||||
|
object.objectTwo,
|
||||||
|
specifiedType: const FullType(ObjectWithDuplicateInlineEnum),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Object serialize(
|
||||||
|
Serializers serializers,
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums object, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) {
|
||||||
|
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _deserializeProperties(
|
||||||
|
Serializers serializers,
|
||||||
|
Object serialized, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
required List<Object?> serializedList,
|
||||||
|
required ObjectThatReferencesObjectsWithDuplicateInlineEnumsBuilder result,
|
||||||
|
required List<Object?> unhandled,
|
||||||
|
}) {
|
||||||
|
for (var i = 0; i < serializedList.length; i += 2) {
|
||||||
|
final key = serializedList[i] as String;
|
||||||
|
final value = serializedList[i + 1];
|
||||||
|
switch (key) {
|
||||||
|
case r'object_one':
|
||||||
|
final valueDes = serializers.deserialize(
|
||||||
|
value,
|
||||||
|
specifiedType: const FullType(ObjectWithInlineEnum),
|
||||||
|
) as ObjectWithInlineEnum;
|
||||||
|
result.objectOne.replace(valueDes);
|
||||||
|
break;
|
||||||
|
case r'object_two':
|
||||||
|
final valueDes = serializers.deserialize(
|
||||||
|
value,
|
||||||
|
specifiedType: const FullType(ObjectWithDuplicateInlineEnum),
|
||||||
|
) as ObjectWithDuplicateInlineEnum;
|
||||||
|
result.objectTwo.replace(valueDes);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unhandled.add(key);
|
||||||
|
unhandled.add(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums deserialize(
|
||||||
|
Serializers serializers,
|
||||||
|
Object serialized, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) {
|
||||||
|
final result = ObjectThatReferencesObjectsWithDuplicateInlineEnumsBuilder();
|
||||||
|
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||||
|
final unhandled = <Object?>[];
|
||||||
|
_deserializeProperties(
|
||||||
|
serializers,
|
||||||
|
serialized,
|
||||||
|
specifiedType: specifiedType,
|
||||||
|
serializedList: serializedList,
|
||||||
|
unhandled: unhandled,
|
||||||
|
result: result,
|
||||||
|
);
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element
|
||||||
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:built_value/built_value.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
|
||||||
|
part 'object_with_duplicate_inline_enum.g.dart';
|
||||||
|
|
||||||
|
/// ObjectWithDuplicateInlineEnum
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [attribute] - Object two attribute enum
|
||||||
|
@BuiltValue()
|
||||||
|
abstract class ObjectWithDuplicateInlineEnum implements Built<ObjectWithDuplicateInlineEnum, ObjectWithDuplicateInlineEnumBuilder> {
|
||||||
|
/// Object two attribute enum
|
||||||
|
@BuiltValueField(wireName: r'attribute')
|
||||||
|
BuiltSet<ObjectWithDuplicateInlineEnumAttributeEnum>? get attribute;
|
||||||
|
// enum attributeEnum { value_one, value_two, };
|
||||||
|
|
||||||
|
ObjectWithDuplicateInlineEnum._();
|
||||||
|
|
||||||
|
factory ObjectWithDuplicateInlineEnum([void updates(ObjectWithDuplicateInlineEnumBuilder b)]) = _$ObjectWithDuplicateInlineEnum;
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(ObjectWithDuplicateInlineEnumBuilder b) => b;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<ObjectWithDuplicateInlineEnum> get serializer => _$ObjectWithDuplicateInlineEnumSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$ObjectWithDuplicateInlineEnumSerializer implements PrimitiveSerializer<ObjectWithDuplicateInlineEnum> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [ObjectWithDuplicateInlineEnum, _$ObjectWithDuplicateInlineEnum];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'ObjectWithDuplicateInlineEnum';
|
||||||
|
|
||||||
|
Iterable<Object?> _serializeProperties(
|
||||||
|
Serializers serializers,
|
||||||
|
ObjectWithDuplicateInlineEnum object, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) sync* {
|
||||||
|
if (object.attribute != null) {
|
||||||
|
yield r'attribute';
|
||||||
|
yield serializers.serialize(
|
||||||
|
object.attribute,
|
||||||
|
specifiedType: const FullType(BuiltSet, [FullType(ObjectWithDuplicateInlineEnumAttributeEnum)]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Object serialize(
|
||||||
|
Serializers serializers,
|
||||||
|
ObjectWithDuplicateInlineEnum object, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) {
|
||||||
|
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _deserializeProperties(
|
||||||
|
Serializers serializers,
|
||||||
|
Object serialized, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
required List<Object?> serializedList,
|
||||||
|
required ObjectWithDuplicateInlineEnumBuilder result,
|
||||||
|
required List<Object?> unhandled,
|
||||||
|
}) {
|
||||||
|
for (var i = 0; i < serializedList.length; i += 2) {
|
||||||
|
final key = serializedList[i] as String;
|
||||||
|
final value = serializedList[i + 1];
|
||||||
|
switch (key) {
|
||||||
|
case r'attribute':
|
||||||
|
final valueDes = serializers.deserialize(
|
||||||
|
value,
|
||||||
|
specifiedType: const FullType(BuiltSet, [FullType(ObjectWithDuplicateInlineEnumAttributeEnum)]),
|
||||||
|
) as BuiltSet<ObjectWithDuplicateInlineEnumAttributeEnum>;
|
||||||
|
result.attribute.replace(valueDes);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unhandled.add(key);
|
||||||
|
unhandled.add(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ObjectWithDuplicateInlineEnum deserialize(
|
||||||
|
Serializers serializers,
|
||||||
|
Object serialized, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) {
|
||||||
|
final result = ObjectWithDuplicateInlineEnumBuilder();
|
||||||
|
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||||
|
final unhandled = <Object?>[];
|
||||||
|
_deserializeProperties(
|
||||||
|
serializers,
|
||||||
|
serialized,
|
||||||
|
specifiedType: specifiedType,
|
||||||
|
serializedList: serializedList,
|
||||||
|
unhandled: unhandled,
|
||||||
|
result: result,
|
||||||
|
);
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ObjectWithDuplicateInlineEnumAttributeEnum extends EnumClass {
|
||||||
|
|
||||||
|
@BuiltValueEnumConst(wireName: r'value_one')
|
||||||
|
static const ObjectWithDuplicateInlineEnumAttributeEnum valueOne = _$objectWithDuplicateInlineEnumAttributeEnum_valueOne;
|
||||||
|
@BuiltValueEnumConst(wireName: r'value_two')
|
||||||
|
static const ObjectWithDuplicateInlineEnumAttributeEnum valueTwo = _$objectWithDuplicateInlineEnumAttributeEnum_valueTwo;
|
||||||
|
@BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true)
|
||||||
|
static const ObjectWithDuplicateInlineEnumAttributeEnum unknownDefaultOpenApi = _$objectWithDuplicateInlineEnumAttributeEnum_unknownDefaultOpenApi;
|
||||||
|
|
||||||
|
static Serializer<ObjectWithDuplicateInlineEnumAttributeEnum> get serializer => _$objectWithDuplicateInlineEnumAttributeEnumSerializer;
|
||||||
|
|
||||||
|
const ObjectWithDuplicateInlineEnumAttributeEnum._(String name): super(name);
|
||||||
|
|
||||||
|
static BuiltSet<ObjectWithDuplicateInlineEnumAttributeEnum> get values => _$objectWithDuplicateInlineEnumAttributeEnumValues;
|
||||||
|
static ObjectWithDuplicateInlineEnumAttributeEnum valueOf(String name) => _$objectWithDuplicateInlineEnumAttributeEnumValueOf(name);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element
|
||||||
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:built_value/built_value.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
|
||||||
|
part 'object_with_inline_enum.g.dart';
|
||||||
|
|
||||||
|
/// ObjectWithInlineEnum
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [attribute] - Object one attribute enum
|
||||||
|
@BuiltValue()
|
||||||
|
abstract class ObjectWithInlineEnum implements Built<ObjectWithInlineEnum, ObjectWithInlineEnumBuilder> {
|
||||||
|
/// Object one attribute enum
|
||||||
|
@BuiltValueField(wireName: r'attribute')
|
||||||
|
BuiltSet<ObjectWithInlineEnumAttributeEnum>? get attribute;
|
||||||
|
// enum attributeEnum { value_one, value_two, };
|
||||||
|
|
||||||
|
ObjectWithInlineEnum._();
|
||||||
|
|
||||||
|
factory ObjectWithInlineEnum([void updates(ObjectWithInlineEnumBuilder b)]) = _$ObjectWithInlineEnum;
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(ObjectWithInlineEnumBuilder b) => b;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<ObjectWithInlineEnum> get serializer => _$ObjectWithInlineEnumSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$ObjectWithInlineEnumSerializer implements PrimitiveSerializer<ObjectWithInlineEnum> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [ObjectWithInlineEnum, _$ObjectWithInlineEnum];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'ObjectWithInlineEnum';
|
||||||
|
|
||||||
|
Iterable<Object?> _serializeProperties(
|
||||||
|
Serializers serializers,
|
||||||
|
ObjectWithInlineEnum object, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) sync* {
|
||||||
|
if (object.attribute != null) {
|
||||||
|
yield r'attribute';
|
||||||
|
yield serializers.serialize(
|
||||||
|
object.attribute,
|
||||||
|
specifiedType: const FullType(BuiltSet, [FullType(ObjectWithInlineEnumAttributeEnum)]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Object serialize(
|
||||||
|
Serializers serializers,
|
||||||
|
ObjectWithInlineEnum object, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) {
|
||||||
|
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _deserializeProperties(
|
||||||
|
Serializers serializers,
|
||||||
|
Object serialized, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
required List<Object?> serializedList,
|
||||||
|
required ObjectWithInlineEnumBuilder result,
|
||||||
|
required List<Object?> unhandled,
|
||||||
|
}) {
|
||||||
|
for (var i = 0; i < serializedList.length; i += 2) {
|
||||||
|
final key = serializedList[i] as String;
|
||||||
|
final value = serializedList[i + 1];
|
||||||
|
switch (key) {
|
||||||
|
case r'attribute':
|
||||||
|
final valueDes = serializers.deserialize(
|
||||||
|
value,
|
||||||
|
specifiedType: const FullType(BuiltSet, [FullType(ObjectWithInlineEnumAttributeEnum)]),
|
||||||
|
) as BuiltSet<ObjectWithInlineEnumAttributeEnum>;
|
||||||
|
result.attribute.replace(valueDes);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unhandled.add(key);
|
||||||
|
unhandled.add(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ObjectWithInlineEnum deserialize(
|
||||||
|
Serializers serializers,
|
||||||
|
Object serialized, {
|
||||||
|
FullType specifiedType = FullType.unspecified,
|
||||||
|
}) {
|
||||||
|
final result = ObjectWithInlineEnumBuilder();
|
||||||
|
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||||
|
final unhandled = <Object?>[];
|
||||||
|
_deserializeProperties(
|
||||||
|
serializers,
|
||||||
|
serialized,
|
||||||
|
specifiedType: specifiedType,
|
||||||
|
serializedList: serializedList,
|
||||||
|
unhandled: unhandled,
|
||||||
|
result: result,
|
||||||
|
);
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ObjectWithInlineEnumAttributeEnum extends EnumClass {
|
||||||
|
|
||||||
|
@BuiltValueEnumConst(wireName: r'value_one')
|
||||||
|
static const ObjectWithInlineEnumAttributeEnum valueOne = _$objectWithInlineEnumAttributeEnum_valueOne;
|
||||||
|
@BuiltValueEnumConst(wireName: r'value_two')
|
||||||
|
static const ObjectWithInlineEnumAttributeEnum valueTwo = _$objectWithInlineEnumAttributeEnum_valueTwo;
|
||||||
|
@BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true)
|
||||||
|
static const ObjectWithInlineEnumAttributeEnum unknownDefaultOpenApi = _$objectWithInlineEnumAttributeEnum_unknownDefaultOpenApi;
|
||||||
|
|
||||||
|
static Serializer<ObjectWithInlineEnumAttributeEnum> get serializer => _$objectWithInlineEnumAttributeEnumSerializer;
|
||||||
|
|
||||||
|
const ObjectWithInlineEnumAttributeEnum._(String name): super(name);
|
||||||
|
|
||||||
|
static BuiltSet<ObjectWithInlineEnumAttributeEnum> get values => _$objectWithInlineEnumAttributeEnumValues;
|
||||||
|
static ObjectWithInlineEnumAttributeEnum valueOf(String name) => _$objectWithInlineEnumAttributeEnumValueOf(name);
|
||||||
|
}
|
||||||
|
|
@ -48,7 +48,10 @@ import 'package:openapi/src/model/model_return.dart';
|
|||||||
import 'package:openapi/src/model/name.dart';
|
import 'package:openapi/src/model/name.dart';
|
||||||
import 'package:openapi/src/model/nullable_class.dart';
|
import 'package:openapi/src/model/nullable_class.dart';
|
||||||
import 'package:openapi/src/model/number_only.dart';
|
import 'package:openapi/src/model/number_only.dart';
|
||||||
|
import 'package:openapi/src/model/object_that_references_objects_with_duplicate_inline_enums.dart';
|
||||||
import 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
import 'package:openapi/src/model/object_with_deprecated_fields.dart';
|
||||||
|
import 'package:openapi/src/model/object_with_duplicate_inline_enum.dart';
|
||||||
|
import 'package:openapi/src/model/object_with_inline_enum.dart';
|
||||||
import 'package:openapi/src/model/order.dart';
|
import 'package:openapi/src/model/order.dart';
|
||||||
import 'package:openapi/src/model/outer_composite.dart';
|
import 'package:openapi/src/model/outer_composite.dart';
|
||||||
import 'package:openapi/src/model/outer_enum.dart';
|
import 'package:openapi/src/model/outer_enum.dart';
|
||||||
@ -104,7 +107,10 @@ part 'serializers.g.dart';
|
|||||||
Name,
|
Name,
|
||||||
NullableClass,
|
NullableClass,
|
||||||
NumberOnly,
|
NumberOnly,
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums,
|
||||||
ObjectWithDeprecatedFields,
|
ObjectWithDeprecatedFields,
|
||||||
|
ObjectWithDuplicateInlineEnum,
|
||||||
|
ObjectWithInlineEnum,
|
||||||
Order,
|
Order,
|
||||||
OuterComposite,
|
OuterComposite,
|
||||||
OuterEnum,
|
OuterEnum,
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:openapi/openapi.dart';
|
||||||
|
|
||||||
|
// tests for ObjectThatReferencesObjectsWithDuplicateInlineEnums
|
||||||
|
void main() {
|
||||||
|
final instance = ObjectThatReferencesObjectsWithDuplicateInlineEnumsBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(ObjectThatReferencesObjectsWithDuplicateInlineEnums, () {
|
||||||
|
// ObjectWithInlineEnum objectOne
|
||||||
|
test('to test the property `objectOne`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// ObjectWithDuplicateInlineEnum objectTwo
|
||||||
|
test('to test the property `objectTwo`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:openapi/openapi.dart';
|
||||||
|
|
||||||
|
// tests for ObjectWithDuplicateInlineEnum
|
||||||
|
void main() {
|
||||||
|
final instance = ObjectWithDuplicateInlineEnumBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(ObjectWithDuplicateInlineEnum, () {
|
||||||
|
// Object two attribute enum
|
||||||
|
// BuiltSet<String> attribute
|
||||||
|
test('to test the property `attribute`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:openapi/openapi.dart';
|
||||||
|
|
||||||
|
// tests for ObjectWithInlineEnum
|
||||||
|
void main() {
|
||||||
|
final instance = ObjectWithInlineEnumBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(ObjectWithInlineEnum, () {
|
||||||
|
// Object one attribute enum
|
||||||
|
// BuiltSet<String> attribute
|
||||||
|
test('to test the property `attribute`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
@ -40,7 +40,10 @@ doc/ModelReturn.md
|
|||||||
doc/Name.md
|
doc/Name.md
|
||||||
doc/NullableClass.md
|
doc/NullableClass.md
|
||||||
doc/NumberOnly.md
|
doc/NumberOnly.md
|
||||||
|
doc/ObjectThatReferencesObjectsWithDuplicateInlineEnums.md
|
||||||
doc/ObjectWithDeprecatedFields.md
|
doc/ObjectWithDeprecatedFields.md
|
||||||
|
doc/ObjectWithDuplicateInlineEnum.md
|
||||||
|
doc/ObjectWithInlineEnum.md
|
||||||
doc/Order.md
|
doc/Order.md
|
||||||
doc/OuterComposite.md
|
doc/OuterComposite.md
|
||||||
doc/OuterEnum.md
|
doc/OuterEnum.md
|
||||||
@ -112,7 +115,10 @@ lib/model/model_return.dart
|
|||||||
lib/model/name.dart
|
lib/model/name.dart
|
||||||
lib/model/nullable_class.dart
|
lib/model/nullable_class.dart
|
||||||
lib/model/number_only.dart
|
lib/model/number_only.dart
|
||||||
|
lib/model/object_that_references_objects_with_duplicate_inline_enums.dart
|
||||||
lib/model/object_with_deprecated_fields.dart
|
lib/model/object_with_deprecated_fields.dart
|
||||||
|
lib/model/object_with_duplicate_inline_enum.dart
|
||||||
|
lib/model/object_with_inline_enum.dart
|
||||||
lib/model/order.dart
|
lib/model/order.dart
|
||||||
lib/model/outer_composite.dart
|
lib/model/outer_composite.dart
|
||||||
lib/model/outer_enum.dart
|
lib/model/outer_enum.dart
|
||||||
|
@ -62,6 +62,7 @@ Class | Method | HTTP request | Description
|
|||||||
*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
|
*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo |
|
*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo |
|
||||||
*FakeApi* | [**fakeBigDecimalMap**](doc//FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
*FakeApi* | [**fakeBigDecimalMap**](doc//FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
||||||
|
*FakeApi* | [**fakeDuplicateInlineEnum**](doc//FakeApi.md#fakeduplicateinlineenum) | **GET** /fake/duplicate-inline-enums | test objects with duplicate inline enums see issue# 21582
|
||||||
*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
||||||
*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
||||||
*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
||||||
@ -143,7 +144,10 @@ Class | Method | HTTP request | Description
|
|||||||
- [Name](doc//Name.md)
|
- [Name](doc//Name.md)
|
||||||
- [NullableClass](doc//NullableClass.md)
|
- [NullableClass](doc//NullableClass.md)
|
||||||
- [NumberOnly](doc//NumberOnly.md)
|
- [NumberOnly](doc//NumberOnly.md)
|
||||||
|
- [ObjectThatReferencesObjectsWithDuplicateInlineEnums](doc//ObjectThatReferencesObjectsWithDuplicateInlineEnums.md)
|
||||||
- [ObjectWithDeprecatedFields](doc//ObjectWithDeprecatedFields.md)
|
- [ObjectWithDeprecatedFields](doc//ObjectWithDeprecatedFields.md)
|
||||||
|
- [ObjectWithDuplicateInlineEnum](doc//ObjectWithDuplicateInlineEnum.md)
|
||||||
|
- [ObjectWithInlineEnum](doc//ObjectWithInlineEnum.md)
|
||||||
- [Order](doc//Order.md)
|
- [Order](doc//Order.md)
|
||||||
- [OuterComposite](doc//OuterComposite.md)
|
- [OuterComposite](doc//OuterComposite.md)
|
||||||
- [OuterEnum](doc//OuterEnum.md)
|
- [OuterEnum](doc//OuterEnum.md)
|
||||||
|
@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
|||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
|
||||||
|
[**fakeDuplicateInlineEnum**](FakeApi.md#fakeduplicateinlineenum) | **GET** /fake/duplicate-inline-enums | test objects with duplicate inline enums see issue# 21582
|
||||||
[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
|
||||||
[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
|
||||||
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
|
||||||
@ -72,6 +73,43 @@ 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)
|
[[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)
|
||||||
|
|
||||||
|
# **fakeDuplicateInlineEnum**
|
||||||
|
> ObjectThatReferencesObjectsWithDuplicateInlineEnums fakeDuplicateInlineEnum()
|
||||||
|
|
||||||
|
test objects with duplicate inline enums see issue# 21582
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
|
||||||
|
final api_instance = FakeApi();
|
||||||
|
|
||||||
|
try {
|
||||||
|
final result = api_instance.fakeDuplicateInlineEnum();
|
||||||
|
print(result);
|
||||||
|
} catch (e) {
|
||||||
|
print('Exception when calling FakeApi->fakeDuplicateInlineEnum: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ObjectThatReferencesObjectsWithDuplicateInlineEnums**](ObjectThatReferencesObjectsWithDuplicateInlineEnums.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: 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)
|
||||||
|
|
||||||
# **fakeHealthGet**
|
# **fakeHealthGet**
|
||||||
> HealthCheckResult fakeHealthGet()
|
> HealthCheckResult fakeHealthGet()
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
# openapi.model.ObjectThatReferencesObjectsWithDuplicateInlineEnums
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**objectOne** | [**ObjectWithInlineEnum**](ObjectWithInlineEnum.md) | | [optional]
|
||||||
|
**objectTwo** | [**ObjectWithDuplicateInlineEnum**](ObjectWithDuplicateInlineEnum.md) | | [optional]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# openapi.model.ObjectWithDuplicateInlineEnum
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**attribute** | **Set<String>** | Object two attribute enum | [optional] [default to const {}]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
# openapi.model.ObjectWithInlineEnum
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**attribute** | **Set<String>** | Object one attribute enum | [optional] [default to const {}]
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -70,7 +70,10 @@ part 'model/model_return.dart';
|
|||||||
part 'model/name.dart';
|
part 'model/name.dart';
|
||||||
part 'model/nullable_class.dart';
|
part 'model/nullable_class.dart';
|
||||||
part 'model/number_only.dart';
|
part 'model/number_only.dart';
|
||||||
|
part 'model/object_that_references_objects_with_duplicate_inline_enums.dart';
|
||||||
part 'model/object_with_deprecated_fields.dart';
|
part 'model/object_with_deprecated_fields.dart';
|
||||||
|
part 'model/object_with_duplicate_inline_enum.dart';
|
||||||
|
part 'model/object_with_inline_enum.dart';
|
||||||
part 'model/order.dart';
|
part 'model/order.dart';
|
||||||
part 'model/outer_composite.dart';
|
part 'model/outer_composite.dart';
|
||||||
part 'model/outer_enum.dart';
|
part 'model/outer_enum.dart';
|
||||||
|
@ -60,6 +60,50 @@ class FakeApi {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// test objects with duplicate inline enums see issue# 21582
|
||||||
|
///
|
||||||
|
/// Note: This method returns the HTTP [Response].
|
||||||
|
Future<Response> fakeDuplicateInlineEnumWithHttpInfo() async {
|
||||||
|
// ignore: prefer_const_declarations
|
||||||
|
final path = r'/fake/duplicate-inline-enums';
|
||||||
|
|
||||||
|
// ignore: prefer_final_locals
|
||||||
|
Object? postBody;
|
||||||
|
|
||||||
|
final queryParams = <QueryParam>[];
|
||||||
|
final headerParams = <String, String>{};
|
||||||
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
const contentTypes = <String>[];
|
||||||
|
|
||||||
|
|
||||||
|
return apiClient.invokeAPI(
|
||||||
|
path,
|
||||||
|
'GET',
|
||||||
|
queryParams,
|
||||||
|
postBody,
|
||||||
|
headerParams,
|
||||||
|
formParams,
|
||||||
|
contentTypes.isEmpty ? null : contentTypes.first,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// test objects with duplicate inline enums see issue# 21582
|
||||||
|
Future<ObjectThatReferencesObjectsWithDuplicateInlineEnums?> fakeDuplicateInlineEnum() async {
|
||||||
|
final response = await fakeDuplicateInlineEnumWithHttpInfo();
|
||||||
|
if (response.statusCode >= HttpStatus.badRequest) {
|
||||||
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||||
|
}
|
||||||
|
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||||
|
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||||
|
// FormatException when trying to decode an empty string.
|
||||||
|
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||||
|
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ObjectThatReferencesObjectsWithDuplicateInlineEnums',) as ObjectThatReferencesObjectsWithDuplicateInlineEnums;
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// Health check endpoint
|
/// Health check endpoint
|
||||||
///
|
///
|
||||||
/// Note: This method returns the HTTP [Response].
|
/// Note: This method returns the HTTP [Response].
|
||||||
|
@ -250,8 +250,14 @@ class ApiClient {
|
|||||||
return NullableClass.fromJson(value);
|
return NullableClass.fromJson(value);
|
||||||
case 'NumberOnly':
|
case 'NumberOnly':
|
||||||
return NumberOnly.fromJson(value);
|
return NumberOnly.fromJson(value);
|
||||||
|
case 'ObjectThatReferencesObjectsWithDuplicateInlineEnums':
|
||||||
|
return ObjectThatReferencesObjectsWithDuplicateInlineEnums.fromJson(value);
|
||||||
case 'ObjectWithDeprecatedFields':
|
case 'ObjectWithDeprecatedFields':
|
||||||
return ObjectWithDeprecatedFields.fromJson(value);
|
return ObjectWithDeprecatedFields.fromJson(value);
|
||||||
|
case 'ObjectWithDuplicateInlineEnum':
|
||||||
|
return ObjectWithDuplicateInlineEnum.fromJson(value);
|
||||||
|
case 'ObjectWithInlineEnum':
|
||||||
|
return ObjectWithInlineEnum.fromJson(value);
|
||||||
case 'Order':
|
case 'Order':
|
||||||
return Order.fromJson(value);
|
return Order.fromJson(value);
|
||||||
case 'OuterComposite':
|
case 'OuterComposite':
|
||||||
|
@ -0,0 +1,135 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class ObjectThatReferencesObjectsWithDuplicateInlineEnums {
|
||||||
|
/// Returns a new [ObjectThatReferencesObjectsWithDuplicateInlineEnums] instance.
|
||||||
|
ObjectThatReferencesObjectsWithDuplicateInlineEnums({
|
||||||
|
this.objectOne,
|
||||||
|
this.objectTwo,
|
||||||
|
});
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Please note: This property should have been non-nullable! Since the specification file
|
||||||
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
|
/// source code must fall back to having a nullable type.
|
||||||
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||||
|
///
|
||||||
|
ObjectWithInlineEnum? objectOne;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Please note: This property should have been non-nullable! Since the specification file
|
||||||
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
|
/// source code must fall back to having a nullable type.
|
||||||
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||||
|
///
|
||||||
|
ObjectWithDuplicateInlineEnum? objectTwo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is ObjectThatReferencesObjectsWithDuplicateInlineEnums &&
|
||||||
|
other.objectOne == objectOne &&
|
||||||
|
other.objectTwo == objectTwo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(objectOne == null ? 0 : objectOne!.hashCode) +
|
||||||
|
(objectTwo == null ? 0 : objectTwo!.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'ObjectThatReferencesObjectsWithDuplicateInlineEnums[objectOne=$objectOne, objectTwo=$objectTwo]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
if (this.objectOne != null) {
|
||||||
|
json[r'object_one'] = this.objectOne;
|
||||||
|
} else {
|
||||||
|
json[r'object_one'] = null;
|
||||||
|
}
|
||||||
|
if (this.objectTwo != null) {
|
||||||
|
json[r'object_two'] = this.objectTwo;
|
||||||
|
} else {
|
||||||
|
json[r'object_two'] = null;
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [ObjectThatReferencesObjectsWithDuplicateInlineEnums] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static ObjectThatReferencesObjectsWithDuplicateInlineEnums? fromJson(dynamic value) {
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
// Ensure that the map contains the required keys.
|
||||||
|
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||||
|
// Note 2: this code is stripped in release mode!
|
||||||
|
assert(() {
|
||||||
|
requiredKeys.forEach((key) {
|
||||||
|
assert(json.containsKey(key), 'Required key "ObjectThatReferencesObjectsWithDuplicateInlineEnums[$key]" is missing from JSON.');
|
||||||
|
assert(json[key] != null, 'Required key "ObjectThatReferencesObjectsWithDuplicateInlineEnums[$key]" has a null value in JSON.');
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
|
|
||||||
|
return ObjectThatReferencesObjectsWithDuplicateInlineEnums(
|
||||||
|
objectOne: ObjectWithInlineEnum.fromJson(json[r'object_one']),
|
||||||
|
objectTwo: ObjectWithDuplicateInlineEnum.fromJson(json[r'object_two']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<ObjectThatReferencesObjectsWithDuplicateInlineEnums> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <ObjectThatReferencesObjectsWithDuplicateInlineEnums>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = ObjectThatReferencesObjectsWithDuplicateInlineEnums.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, ObjectThatReferencesObjectsWithDuplicateInlineEnums> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, ObjectThatReferencesObjectsWithDuplicateInlineEnums>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = ObjectThatReferencesObjectsWithDuplicateInlineEnums.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of ObjectThatReferencesObjectsWithDuplicateInlineEnums-objects as value to a dart map
|
||||||
|
static Map<String, List<ObjectThatReferencesObjectsWithDuplicateInlineEnums>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<ObjectThatReferencesObjectsWithDuplicateInlineEnums>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = ObjectThatReferencesObjectsWithDuplicateInlineEnums.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,183 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class ObjectWithDuplicateInlineEnum {
|
||||||
|
/// Returns a new [ObjectWithDuplicateInlineEnum] instance.
|
||||||
|
ObjectWithDuplicateInlineEnum({
|
||||||
|
this.attribute = const {},
|
||||||
|
});
|
||||||
|
|
||||||
|
/// Object two attribute enum
|
||||||
|
Set<ObjectWithDuplicateInlineEnumAttributeEnum> attribute;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is ObjectWithDuplicateInlineEnum &&
|
||||||
|
_deepEquality.equals(other.attribute, attribute);
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(attribute.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'ObjectWithDuplicateInlineEnum[attribute=$attribute]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'attribute'] = this.attribute.toList(growable: false);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [ObjectWithDuplicateInlineEnum] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static ObjectWithDuplicateInlineEnum? fromJson(dynamic value) {
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
// Ensure that the map contains the required keys.
|
||||||
|
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||||
|
// Note 2: this code is stripped in release mode!
|
||||||
|
assert(() {
|
||||||
|
requiredKeys.forEach((key) {
|
||||||
|
assert(json.containsKey(key), 'Required key "ObjectWithDuplicateInlineEnum[$key]" is missing from JSON.');
|
||||||
|
assert(json[key] != null, 'Required key "ObjectWithDuplicateInlineEnum[$key]" has a null value in JSON.');
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
|
|
||||||
|
return ObjectWithDuplicateInlineEnum(
|
||||||
|
attribute: ObjectWithDuplicateInlineEnumAttributeEnum.listFromJson(json[r'attribute']).toSet(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<ObjectWithDuplicateInlineEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <ObjectWithDuplicateInlineEnum>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = ObjectWithDuplicateInlineEnum.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, ObjectWithDuplicateInlineEnum> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, ObjectWithDuplicateInlineEnum>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = ObjectWithDuplicateInlineEnum.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of ObjectWithDuplicateInlineEnum-objects as value to a dart map
|
||||||
|
static Map<String, List<ObjectWithDuplicateInlineEnum>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<ObjectWithDuplicateInlineEnum>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = ObjectWithDuplicateInlineEnum.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectWithDuplicateInlineEnumAttributeEnum {
|
||||||
|
/// Instantiate a new enum with the provided [value].
|
||||||
|
const ObjectWithDuplicateInlineEnumAttributeEnum._(this.value);
|
||||||
|
|
||||||
|
/// The underlying value of this enum member.
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => value;
|
||||||
|
|
||||||
|
String toJson() => value;
|
||||||
|
|
||||||
|
static const valueOne = ObjectWithDuplicateInlineEnumAttributeEnum._(r'value_one');
|
||||||
|
static const valueTwo = ObjectWithDuplicateInlineEnumAttributeEnum._(r'value_two');
|
||||||
|
|
||||||
|
/// List of all possible values in this [enum][ObjectWithDuplicateInlineEnumAttributeEnum].
|
||||||
|
static const values = <ObjectWithDuplicateInlineEnumAttributeEnum>[
|
||||||
|
valueOne,
|
||||||
|
valueTwo,
|
||||||
|
];
|
||||||
|
|
||||||
|
static ObjectWithDuplicateInlineEnumAttributeEnum? fromJson(dynamic value) => ObjectWithDuplicateInlineEnumAttributeEnumTypeTransformer().decode(value);
|
||||||
|
|
||||||
|
static List<ObjectWithDuplicateInlineEnumAttributeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <ObjectWithDuplicateInlineEnumAttributeEnum>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = ObjectWithDuplicateInlineEnumAttributeEnum.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Transformation class that can [encode] an instance of [ObjectWithDuplicateInlineEnumAttributeEnum] to String,
|
||||||
|
/// and [decode] dynamic data back to [ObjectWithDuplicateInlineEnumAttributeEnum].
|
||||||
|
class ObjectWithDuplicateInlineEnumAttributeEnumTypeTransformer {
|
||||||
|
factory ObjectWithDuplicateInlineEnumAttributeEnumTypeTransformer() => _instance ??= const ObjectWithDuplicateInlineEnumAttributeEnumTypeTransformer._();
|
||||||
|
|
||||||
|
const ObjectWithDuplicateInlineEnumAttributeEnumTypeTransformer._();
|
||||||
|
|
||||||
|
String encode(ObjectWithDuplicateInlineEnumAttributeEnum data) => data.value;
|
||||||
|
|
||||||
|
/// Decodes a [dynamic value][data] to a ObjectWithDuplicateInlineEnumAttributeEnum.
|
||||||
|
///
|
||||||
|
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||||
|
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||||
|
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||||
|
///
|
||||||
|
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||||
|
/// and users are still using an old app with the old code.
|
||||||
|
ObjectWithDuplicateInlineEnumAttributeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||||
|
if (data != null) {
|
||||||
|
switch (data) {
|
||||||
|
case r'value_one': return ObjectWithDuplicateInlineEnumAttributeEnum.valueOne;
|
||||||
|
case r'value_two': return ObjectWithDuplicateInlineEnumAttributeEnum.valueTwo;
|
||||||
|
default:
|
||||||
|
if (!allowNull) {
|
||||||
|
throw ArgumentError('Unknown enum value to decode: $data');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Singleton [ObjectWithDuplicateInlineEnumAttributeEnumTypeTransformer] instance.
|
||||||
|
static ObjectWithDuplicateInlineEnumAttributeEnumTypeTransformer? _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,183 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class ObjectWithInlineEnum {
|
||||||
|
/// Returns a new [ObjectWithInlineEnum] instance.
|
||||||
|
ObjectWithInlineEnum({
|
||||||
|
this.attribute = const {},
|
||||||
|
});
|
||||||
|
|
||||||
|
/// Object one attribute enum
|
||||||
|
Set<ObjectWithInlineEnumAttributeEnum> attribute;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is ObjectWithInlineEnum &&
|
||||||
|
_deepEquality.equals(other.attribute, attribute);
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(attribute.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'ObjectWithInlineEnum[attribute=$attribute]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'attribute'] = this.attribute.toList(growable: false);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [ObjectWithInlineEnum] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static ObjectWithInlineEnum? fromJson(dynamic value) {
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
// Ensure that the map contains the required keys.
|
||||||
|
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||||
|
// Note 2: this code is stripped in release mode!
|
||||||
|
assert(() {
|
||||||
|
requiredKeys.forEach((key) {
|
||||||
|
assert(json.containsKey(key), 'Required key "ObjectWithInlineEnum[$key]" is missing from JSON.');
|
||||||
|
assert(json[key] != null, 'Required key "ObjectWithInlineEnum[$key]" has a null value in JSON.');
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
|
|
||||||
|
return ObjectWithInlineEnum(
|
||||||
|
attribute: ObjectWithInlineEnumAttributeEnum.listFromJson(json[r'attribute']).toSet(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<ObjectWithInlineEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <ObjectWithInlineEnum>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = ObjectWithInlineEnum.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, ObjectWithInlineEnum> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, ObjectWithInlineEnum>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = ObjectWithInlineEnum.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of ObjectWithInlineEnum-objects as value to a dart map
|
||||||
|
static Map<String, List<ObjectWithInlineEnum>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<ObjectWithInlineEnum>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = ObjectWithInlineEnum.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectWithInlineEnumAttributeEnum {
|
||||||
|
/// Instantiate a new enum with the provided [value].
|
||||||
|
const ObjectWithInlineEnumAttributeEnum._(this.value);
|
||||||
|
|
||||||
|
/// The underlying value of this enum member.
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => value;
|
||||||
|
|
||||||
|
String toJson() => value;
|
||||||
|
|
||||||
|
static const valueOne = ObjectWithInlineEnumAttributeEnum._(r'value_one');
|
||||||
|
static const valueTwo = ObjectWithInlineEnumAttributeEnum._(r'value_two');
|
||||||
|
|
||||||
|
/// List of all possible values in this [enum][ObjectWithInlineEnumAttributeEnum].
|
||||||
|
static const values = <ObjectWithInlineEnumAttributeEnum>[
|
||||||
|
valueOne,
|
||||||
|
valueTwo,
|
||||||
|
];
|
||||||
|
|
||||||
|
static ObjectWithInlineEnumAttributeEnum? fromJson(dynamic value) => ObjectWithInlineEnumAttributeEnumTypeTransformer().decode(value);
|
||||||
|
|
||||||
|
static List<ObjectWithInlineEnumAttributeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <ObjectWithInlineEnumAttributeEnum>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = ObjectWithInlineEnumAttributeEnum.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Transformation class that can [encode] an instance of [ObjectWithInlineEnumAttributeEnum] to String,
|
||||||
|
/// and [decode] dynamic data back to [ObjectWithInlineEnumAttributeEnum].
|
||||||
|
class ObjectWithInlineEnumAttributeEnumTypeTransformer {
|
||||||
|
factory ObjectWithInlineEnumAttributeEnumTypeTransformer() => _instance ??= const ObjectWithInlineEnumAttributeEnumTypeTransformer._();
|
||||||
|
|
||||||
|
const ObjectWithInlineEnumAttributeEnumTypeTransformer._();
|
||||||
|
|
||||||
|
String encode(ObjectWithInlineEnumAttributeEnum data) => data.value;
|
||||||
|
|
||||||
|
/// Decodes a [dynamic value][data] to a ObjectWithInlineEnumAttributeEnum.
|
||||||
|
///
|
||||||
|
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||||
|
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||||
|
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||||
|
///
|
||||||
|
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||||
|
/// and users are still using an old app with the old code.
|
||||||
|
ObjectWithInlineEnumAttributeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||||
|
if (data != null) {
|
||||||
|
switch (data) {
|
||||||
|
case r'value_one': return ObjectWithInlineEnumAttributeEnum.valueOne;
|
||||||
|
case r'value_two': return ObjectWithInlineEnumAttributeEnum.valueTwo;
|
||||||
|
default:
|
||||||
|
if (!allowNull) {
|
||||||
|
throw ArgumentError('Unknown enum value to decode: $data');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Singleton [ObjectWithInlineEnumAttributeEnumTypeTransformer] instance.
|
||||||
|
static ObjectWithInlineEnumAttributeEnumTypeTransformer? _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
// tests for ObjectThatReferencesObjectsWithDuplicateInlineEnums
|
||||||
|
void main() {
|
||||||
|
// final instance = ObjectThatReferencesObjectsWithDuplicateInlineEnums();
|
||||||
|
|
||||||
|
group('test ObjectThatReferencesObjectsWithDuplicateInlineEnums', () {
|
||||||
|
// ObjectWithInlineEnum objectOne
|
||||||
|
test('to test the property `objectOne`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// ObjectWithDuplicateInlineEnum objectTwo
|
||||||
|
test('to test the property `objectTwo`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
// tests for ObjectWithDuplicateInlineEnum
|
||||||
|
void main() {
|
||||||
|
// final instance = ObjectWithDuplicateInlineEnum();
|
||||||
|
|
||||||
|
group('test ObjectWithDuplicateInlineEnum', () {
|
||||||
|
// Object two attribute enum
|
||||||
|
// Set<String> attribute (default value: const {})
|
||||||
|
test('to test the property `attribute`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
import 'package:openapi/api.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
// tests for ObjectWithInlineEnum
|
||||||
|
void main() {
|
||||||
|
// final instance = ObjectWithInlineEnum();
|
||||||
|
|
||||||
|
group('test ObjectWithInlineEnum', () {
|
||||||
|
// Object one attribute enum
|
||||||
|
// Set<String> attribute (default value: const {})
|
||||||
|
test('to test the property `attribute`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user