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 {
216216class DioProperties extends AdditionalProperties {
217217 /// Choose serialization format JSON or PROTO is supported
218218 final DioDateLibrary ? dateLibrary;
219+ final DioSerializationLibrary ? serializationLibrary;
219220
220221 /// Is the null fields should be in the JSON payload
221222 final bool ? nullableFields;
222223
223224 const DioProperties (
224225 {this .dateLibrary,
225226 this .nullableFields,
227+ this .serializationLibrary,
226228 bool allowUnicodeIdentifiers = false ,
227229 bool ensureUniqueParams = true ,
228230 bool prependFormOrBodyParameters = false ,
@@ -318,6 +320,8 @@ enum DioDateLibrary {
318320 timemachine
319321}
320322
323+ enum DioSerializationLibrary { built_value, json_serializable }
324+
321325enum SerializationFormat { JSON , PROTO }
322326
323327/// 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> {
328328 return value.toStringValue () ??
329329 value.toBoolValue ()? .toString () ??
330330 value.toIntValue ()? .toString () ??
331+ value.getField ('_name' )? .toStringValue () ??
331332 '' ;
332333 }
333334}
Original file line number Diff line number Diff line change @@ -15,5 +15,6 @@ dependencies:
1515 openapi_generator_cli : ^4.0.0
1616
1717dev_dependencies :
18+ test : ^1.23.1
1819 pedantic :
1920
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