Skip to content

Commit 5e84663

Browse files
committed
more dart dio tests, update samples
1 parent 8b01ebb commit 5e84663

6 files changed

Lines changed: 21 additions & 87 deletions

File tree

.github/workflows/samples-dart-build-test.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ on:
44
push:
55
branches:
66
paths:
7-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
8-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
9-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
7+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
8+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
9+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
1010
- samples/openapi3/client/petstore/dart-dio/oneof/**
1111
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
1212
- samples/openapi3/client/petstore/dart-dio/binary_response/**
1313
- samples/openapi3/client/petstore/dart-dio/petstore-timemachine/**
1414
pull_request:
1515
paths:
16-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
17-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
18-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
16+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
17+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/**
18+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/**
1919
- samples/openapi3/client/petstore/dart-dio/oneof/**
2020
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
2121
- samples/openapi3/client/petstore/dart-dio/binary_response/**
@@ -29,9 +29,9 @@ jobs:
2929
os: [ubuntu-latest, windows-latest]
3030
sdk: ["3.9.0"]
3131
sample:
32-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/
33-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/
34-
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/
32+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/
33+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/
34+
- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/
3535
- samples/openapi3/client/petstore/dart-dio/oneof/
3636
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/
3737
- samples/openapi3/client/petstore/dart-dio/binary_response/

modules/openapi-generator/src/test/resources/3_0/dart/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,8 +1928,9 @@ components:
19281928
properties:
19291929
type:
19301930
type: string
1931-
enum:
1932-
- ChildWithNullable
1931+
# comment out as it's causing compilation errors in Dart Dio client generator
1932+
#enum:
1933+
# - ChildWithNullable
19331934
nullableProperty:
19341935
type: string
19351936
nullable: true

samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/child_with_nullable.dart

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ class ChildWithNullable {
3535
name: r'type',
3636
required: false,
3737
includeIfNull: false,
38-
unknownEnumValue: ChildWithNullableTypeEnum.unknownDefaultOpenApi,
3938
)
4039

4140

42-
final ChildWithNullableTypeEnum? type;
41+
final String? type;
4342

4443

4544

@@ -92,19 +91,3 @@ class ChildWithNullable {
9291

9392
}
9493

95-
96-
enum ChildWithNullableTypeEnum {
97-
@JsonValue(r'ChildWithNullable')
98-
childWithNullable(r'ChildWithNullable'),
99-
@JsonValue(r'unknown_default_open_api')
100-
unknownDefaultOpenApi(r'unknown_default_open_api');
101-
102-
const ChildWithNullableTypeEnum(this.value);
103-
104-
final String value;
105-
106-
@override
107-
String toString() => value;
108-
}
109-
110-

samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/parent_with_nullable.dart

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ class ParentWithNullable {
3030
name: r'type',
3131
required: false,
3232
includeIfNull: false,
33-
unknownEnumValue: ParentWithNullableTypeEnum.unknownDefaultOpenApi,
3433
)
3534

3635

37-
final ParentWithNullableTypeEnum? type;
36+
final String? type;
3837

3938

4039

@@ -73,19 +72,3 @@ class ParentWithNullable {
7372

7473
}
7574

76-
77-
enum ParentWithNullableTypeEnum {
78-
@JsonValue(r'ChildWithNullable')
79-
childWithNullable(r'ChildWithNullable'),
80-
@JsonValue(r'unknown_default_open_api')
81-
unknownDefaultOpenApi(r'unknown_default_open_api');
82-
83-
const ParentWithNullableTypeEnum(this.value);
84-
85-
final String value;
86-
87-
@override
88-
String toString() => value;
89-
}
90-
91-

samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/child_with_nullable.dart

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//
44

55
// ignore_for_file: unused_element
6-
import 'package:built_collection/built_collection.dart';
76
import 'package:openapi/src/model/parent_with_nullable.dart';
87
import 'package:built_value/built_value.dart';
98
import 'package:built_value/serializer.dart';
@@ -48,7 +47,7 @@ class _$ChildWithNullableSerializer implements PrimitiveSerializer<ChildWithNull
4847
yield r'type';
4948
yield serializers.serialize(
5049
object.type,
51-
specifiedType: const FullType(ParentWithNullableTypeEnum),
50+
specifiedType: const FullType(String),
5251
);
5352
}
5453
if (object.nullableProperty != null) {
@@ -91,8 +90,8 @@ class _$ChildWithNullableSerializer implements PrimitiveSerializer<ChildWithNull
9190
case r'type':
9291
final valueDes = serializers.deserialize(
9392
value,
94-
specifiedType: const FullType(ParentWithNullableTypeEnum),
95-
) as ParentWithNullableTypeEnum;
93+
specifiedType: const FullType(String),
94+
) as String;
9695
result.type = valueDes;
9796
break;
9897
case r'nullableProperty':
@@ -139,18 +138,3 @@ class _$ChildWithNullableSerializer implements PrimitiveSerializer<ChildWithNull
139138
}
140139
}
141140

142-
class ChildWithNullableTypeEnum extends EnumClass {
143-
144-
@BuiltValueEnumConst(wireName: r'ChildWithNullable')
145-
static const ChildWithNullableTypeEnum childWithNullable = _$childWithNullableTypeEnum_childWithNullable;
146-
@BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true)
147-
static const ChildWithNullableTypeEnum unknownDefaultOpenApi = _$childWithNullableTypeEnum_unknownDefaultOpenApi;
148-
149-
static Serializer<ChildWithNullableTypeEnum> get serializer => _$childWithNullableTypeEnumSerializer;
150-
151-
const ChildWithNullableTypeEnum._(String name): super(name);
152-
153-
static BuiltSet<ChildWithNullableTypeEnum> get values => _$childWithNullableTypeEnumValues;
154-
static ChildWithNullableTypeEnum valueOf(String name) => _$childWithNullableTypeEnumValueOf(name);
155-
}
156-

samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/parent_with_nullable.dart

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//
44

55
// ignore_for_file: unused_element
6-
import 'package:built_collection/built_collection.dart';
76
import 'package:openapi/src/model/child_with_nullable.dart';
87
import 'package:built_value/built_value.dart';
98
import 'package:built_value/serializer.dart';
@@ -18,8 +17,7 @@ part 'parent_with_nullable.g.dart';
1817
@BuiltValue(instantiable: false)
1918
abstract class ParentWithNullable {
2019
@BuiltValueField(wireName: r'type')
21-
ParentWithNullableTypeEnum? get type;
22-
// enum typeEnum { ChildWithNullable, };
20+
String? get type;
2321

2422
@BuiltValueField(wireName: r'nullableProperty')
2523
String? get nullableProperty;
@@ -67,7 +65,7 @@ class _$ParentWithNullableSerializer implements PrimitiveSerializer<ParentWithNu
6765
yield r'type';
6866
yield serializers.serialize(
6967
object.type,
70-
specifiedType: const FullType(ParentWithNullableTypeEnum),
68+
specifiedType: const FullType(String),
7169
);
7270
}
7371
if (object.nullableProperty != null) {
@@ -154,8 +152,8 @@ class _$$ParentWithNullableSerializer implements PrimitiveSerializer<$ParentWith
154152
case r'type':
155153
final valueDes = serializers.deserialize(
156154
value,
157-
specifiedType: const FullType(ParentWithNullableTypeEnum),
158-
) as ParentWithNullableTypeEnum;
155+
specifiedType: const FullType(String),
156+
) as String;
159157
result.type = valueDes;
160158
break;
161159
case r'nullableProperty':
@@ -195,18 +193,3 @@ class _$$ParentWithNullableSerializer implements PrimitiveSerializer<$ParentWith
195193
}
196194
}
197195

198-
class ParentWithNullableTypeEnum extends EnumClass {
199-
200-
@BuiltValueEnumConst(wireName: r'ChildWithNullable')
201-
static const ParentWithNullableTypeEnum childWithNullable = _$parentWithNullableTypeEnum_childWithNullable;
202-
@BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true)
203-
static const ParentWithNullableTypeEnum unknownDefaultOpenApi = _$parentWithNullableTypeEnum_unknownDefaultOpenApi;
204-
205-
static Serializer<ParentWithNullableTypeEnum> get serializer => _$parentWithNullableTypeEnumSerializer;
206-
207-
const ParentWithNullableTypeEnum._(String name): super(name);
208-
209-
static BuiltSet<ParentWithNullableTypeEnum> get values => _$parentWithNullableTypeEnumValues;
210-
static ParentWithNullableTypeEnum valueOf(String name) => _$parentWithNullableTypeEnumValueOf(name);
211-
}
212-

0 commit comments

Comments
 (0)