File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed
openapi-generator-annotations/lib/src Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -216,13 +216,15 @@ class JaguarProperties extends AdditionalProperties {
216
216
class DioProperties extends AdditionalProperties {
217
217
/// Choose serialization format JSON or PROTO is supported
218
218
final DioDateLibrary ? dateLibrary;
219
+ final DioSerializationLibrary ? serializationLibrary;
219
220
220
221
/// Is the null fields should be in the JSON payload
221
222
final bool ? nullableFields;
222
223
223
224
const DioProperties (
224
225
{this .dateLibrary,
225
226
this .nullableFields,
227
+ this .serializationLibrary,
226
228
bool allowUnicodeIdentifiers = false ,
227
229
bool ensureUniqueParams = true ,
228
230
bool prependFormOrBodyParameters = false ,
@@ -318,6 +320,8 @@ enum DioDateLibrary {
318
320
timemachine
319
321
}
320
322
323
+ enum DioSerializationLibrary { built_value, json_serializable }
324
+
321
325
enum SerializationFormat { JSON , PROTO }
322
326
323
327
/// The name of the generator to use
Original file line number Diff line number Diff line change @@ -328,6 +328,7 @@ class OpenapiGenerator extends GeneratorForAnnotation<annots.Openapi> {
328
328
return value.toStringValue () ??
329
329
value.toBoolValue ()? .toString () ??
330
330
value.toIntValue ()? .toString () ??
331
+ value.getField ('_name' )? .toStringValue () ??
331
332
'' ;
332
333
}
333
334
}
Original file line number Diff line number Diff line change @@ -15,5 +15,6 @@ dependencies:
15
15
openapi_generator_cli : ^4.0.0
16
16
17
17
dev_dependencies :
18
+ test : ^1.23.1
18
19
pedantic :
19
20
Original file line number Diff line number Diff line change
1
+ import 'package:openapi_generator/src/openapi_generator_runner.dart' ;
2
+ import 'package:test/test.dart' ;
3
+
4
+
5
+ void main () {
6
+ group ('convertToPropertyKey()' , () {
7
+ final generator = OpenapiGenerator ();
8
+
9
+ test ('convert "nullSafeArrayDefault"' , () {
10
+ expect (generator.convertToPropertyKey ('nullSafeArrayDefault' ),
11
+ equals ('nullSafe-array-default' ));
12
+ });
13
+
14
+ test ('convert "pubspecDependencies"' , () {
15
+ expect (generator.convertToPropertyKey ('pubspecDependencies' ),
16
+ equals ('pubspec-dependencies' ));
17
+ });
18
+
19
+ test ('convert "pubspecDevDependencies"' , () {
20
+ expect (generator.convertToPropertyKey ('pubspecDevDependencies' ),
21
+ equals ('pubspec-dev-dependencies' ));
22
+ });
23
+
24
+ group ('convertToPropertyValue()' , () {
25
+ // TODO.
26
+ });
27
+ });
28
+ }
You can’t perform that action at this time.
0 commit comments