diff --git a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache index a7f830a51352..82b6057a683e 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -76,13 +76,19 @@ class {{classname}} { {{/hasFormParams}} {{#bodyParam}} - {{#isArray}} + {{#isArray}} const type = FullType(BuiltList, [FullType({{baseType}})]); final serializedBody = _serializers.serialize({{paramName}}, specifiedType: type); - {{/isArray}} - {{^isArray}} - final serializedBody = _serializers.serialize({{paramName}}); - {{/isArray}} + {{/isArray}} + {{^isArray}} + {{#isPrimitiveType}} + var serializedBody = {{paramName}}; + {{/isPrimitiveType}} + {{^isPrimitiveType}} + final bodySerializer = _serializers.serializerForType({{baseType}}); + final serializedBody = _serializers.serializeWith(bodySerializer, {{paramName}}); + {{/isPrimitiveType}} + {{/isArray}} final json{{paramName}} = json.encode(serializedBody); bodyData = json{{paramName}}; {{/bodyParam}} diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index 0179f6ae3a5c..4e37f1e056a1 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -43,17 +43,10 @@ class PetApi { 'application/xml', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(body); + final bodySerializer = _serializers.serializerForType(Pet); + final serializedBody = _serializers.serializeWith(bodySerializer, body); final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -======= - - var bodySerializer = _serializers.serializerForType(Pet); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; ->>>>>>> Updates samples return _dio.request( _path, @@ -355,21 +348,12 @@ class PetApi { 'application/xml', ]; - final serializedBody = _serializers.serialize(body); + final bodySerializer = _serializers.serializerForType(Pet); + final serializedBody = _serializers.serializeWith(bodySerializer, body); final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(Pet); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index f626e0187e86..260956e42153 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -205,17 +205,10 @@ class StoreApi { final List contentTypes = []; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(body); + final bodySerializer = _serializers.serializerForType(Order); + final serializedBody = _serializers.serializeWith(bodySerializer, body); final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -======= - - var bodySerializer = _serializers.serializerForType(Order); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; ->>>>>>> Updates samples return _dio.request( _path, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index ec03c9c2bb42..64d597726099 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -37,17 +37,10 @@ class UserApi { final List contentTypes = []; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(body); + final bodySerializer = _serializers.serializerForType(User); + final serializedBody = _serializers.serializeWith(bodySerializer, body); final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -======= - - var bodySerializer = _serializers.serializerForType(User); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; ->>>>>>> Updates samples return _dio.request( _path, @@ -402,17 +395,10 @@ class UserApi { final List contentTypes = []; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(body); + final bodySerializer = _serializers.serializerForType(User); + final serializedBody = _serializers.serializeWith(bodySerializer, body); final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -======= - - var bodySerializer = _serializers.serializerForType(User); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; ->>>>>>> Updates samples return _dio.request( _path, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index 116aeaa9e290..646a68b206ec 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -43,17 +43,10 @@ class PetApi { 'application/xml', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(pet); + final bodySerializer = _serializers.serializerForType(Pet); + final serializedBody = _serializers.serializeWith(bodySerializer, pet); final jsonpet = json.encode(serializedBody); bodyData = jsonpet; -======= - - var bodySerializer = _serializers.serializerForType(Pet); - var serializedBody = _serializers.serializeWith(bodySerializer, pet); - var jsonpet = json.encode(serializedBody); - bodyData = jsonpet; ->>>>>>> Updates samples return _dio.request( _path, @@ -368,21 +361,12 @@ class PetApi { 'application/xml', ]; - final serializedBody = _serializers.serialize(pet); + final bodySerializer = _serializers.serializerForType(Pet); + final serializedBody = _serializers.serializeWith(bodySerializer, pet); final jsonpet = json.encode(serializedBody); bodyData = jsonpet; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(Pet); - var serializedBody = _serializers.serializeWith(bodySerializer, pet); - var jsonpet = json.encode(serializedBody); - bodyData = jsonpet; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index c8dc47f28b77..e7f61eb64090 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -207,17 +207,10 @@ class StoreApi { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(order); + final bodySerializer = _serializers.serializerForType(Order); + final serializedBody = _serializers.serializeWith(bodySerializer, order); final jsonorder = json.encode(serializedBody); bodyData = jsonorder; -======= - - var bodySerializer = _serializers.serializerForType(Order); - var serializedBody = _serializers.serializeWith(bodySerializer, order); - var jsonorder = json.encode(serializedBody); - bodyData = jsonorder; ->>>>>>> Updates samples return _dio.request( _path, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index abd9490d55bb..b3291c98cda8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -39,17 +39,10 @@ class UserApi { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(user); + final bodySerializer = _serializers.serializerForType(User); + final serializedBody = _serializers.serializeWith(bodySerializer, user); final jsonuser = json.encode(serializedBody); bodyData = jsonuser; -======= - - var bodySerializer = _serializers.serializerForType(User); - var serializedBody = _serializers.serializeWith(bodySerializer, user); - var jsonuser = json.encode(serializedBody); - bodyData = jsonuser; ->>>>>>> Updates samples return _dio.request( _path, @@ -445,17 +438,10 @@ class UserApi { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(user); + final bodySerializer = _serializers.serializerForType(User); + final serializedBody = _serializers.serializeWith(bodySerializer, user); final jsonuser = json.encode(serializedBody); bodyData = jsonuser; -======= - - var bodySerializer = _serializers.serializerForType(User); - var serializedBody = _serializers.serializeWith(bodySerializer, user); - var jsonuser = json.encode(serializedBody); - bodyData = jsonuser; ->>>>>>> Updates samples return _dio.request( _path, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart index bd4745c9fdb9..b0a1bb7491b8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -38,17 +38,10 @@ class AnotherFakeApi { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(modelClient); + final bodySerializer = _serializers.serializerForType(ModelClient); + final serializedBody = _serializers.serializeWith(bodySerializer, modelClient); final jsonmodelClient = json.encode(serializedBody); bodyData = jsonmodelClient; -======= - - var bodySerializer = _serializers.serializerForType(Client); - var serializedBody = _serializers.serializeWith(bodySerializer, client); - var jsonclient = json.encode(serializedBody); - bodyData = jsonclient; ->>>>>>> Updates samples return _dio.request( _path, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart index 053182a393da..4e054b7de8a1 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -108,21 +108,12 @@ class FakeApi { 'application/xml', ]; - final serializedBody = _serializers.serialize(pet); + final bodySerializer = _serializers.serializerForType(Pet); + final serializedBody = _serializers.serializeWith(bodySerializer, pet); final jsonpet = json.encode(serializedBody); bodyData = jsonpet; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(Pet); - var serializedBody = _serializers.serializeWith(bodySerializer, pet); - var jsonpet = json.encode(serializedBody); - bodyData = jsonpet; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -174,21 +165,11 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(body); + var serializedBody = body; final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(bool); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -247,21 +228,12 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(outerComposite); + final bodySerializer = _serializers.serializerForType(OuterComposite); + final serializedBody = _serializers.serializeWith(bodySerializer, outerComposite); final jsonouterComposite = json.encode(serializedBody); bodyData = jsonouterComposite; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(OuterComposite); - var serializedBody = _serializers.serializeWith(bodySerializer, outerComposite); - var jsonouterComposite = json.encode(serializedBody); - bodyData = jsonouterComposite; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -321,21 +293,11 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(body); + var serializedBody = body; final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(num); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -394,21 +356,11 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(body); + var serializedBody = body; final jsonbody = json.encode(serializedBody); bodyData = jsonbody; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(String); - var serializedBody = _serializers.serializeWith(bodySerializer, body); - var jsonbody = json.encode(serializedBody); - bodyData = jsonbody; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -467,21 +419,12 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(fileSchemaTestClass); + final bodySerializer = _serializers.serializerForType(FileSchemaTestClass); + final serializedBody = _serializers.serializeWith(bodySerializer, fileSchemaTestClass); final jsonfileSchemaTestClass = json.encode(serializedBody); bodyData = jsonfileSchemaTestClass; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(FileSchemaTestClass); - var serializedBody = _serializers.serializeWith(bodySerializer, fileSchemaTestClass); - var jsonfileSchemaTestClass = json.encode(serializedBody); - bodyData = jsonfileSchemaTestClass; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -530,21 +473,12 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(user); + final bodySerializer = _serializers.serializerForType(User); + final serializedBody = _serializers.serializeWith(bodySerializer, user); final jsonuser = json.encode(serializedBody); bodyData = jsonuser; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(User); - var serializedBody = _serializers.serializeWith(bodySerializer, user); - var jsonuser = json.encode(serializedBody); - bodyData = jsonuser; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -591,21 +525,12 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(modelClient); + final bodySerializer = _serializers.serializerForType(ModelClient); + final serializedBody = _serializers.serializeWith(bodySerializer, modelClient); final jsonmodelClient = json.encode(serializedBody); bodyData = jsonmodelClient; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(Client); - var serializedBody = _serializers.serializeWith(bodySerializer, client); - var jsonclient = json.encode(serializedBody); - bodyData = jsonclient; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -873,21 +798,12 @@ class FakeApi { 'application/json', ]; - final serializedBody = _serializers.serialize(requestBody); + final bodySerializer = _serializers.serializerForType(String); + final serializedBody = _serializers.serializeWith(bodySerializer, requestBody); final jsonrequestBody = json.encode(serializedBody); bodyData = jsonrequestBody; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(String); - var serializedBody = _serializers.serializeWith(bodySerializer, requestBody); - var jsonrequestBody = json.encode(serializedBody); - bodyData = jsonrequestBody; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index cff8db57087a..ce622874e326 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -38,17 +38,10 @@ class FakeClassnameTags123Api { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(modelClient); + final bodySerializer = _serializers.serializerForType(ModelClient); + final serializedBody = _serializers.serializeWith(bodySerializer, modelClient); final jsonmodelClient = json.encode(serializedBody); bodyData = jsonmodelClient; -======= - - var bodySerializer = _serializers.serializerForType(Client); - var serializedBody = _serializers.serializeWith(bodySerializer, client); - var jsonclient = json.encode(serializedBody); - bodyData = jsonclient; ->>>>>>> Updates samples return _dio.request( _path, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart index dba1fdec5561..e340d126ccf6 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart @@ -43,21 +43,12 @@ class PetApi { 'application/xml', ]; - final serializedBody = _serializers.serialize(pet); + final bodySerializer = _serializers.serializerForType(Pet); + final serializedBody = _serializers.serializeWith(bodySerializer, pet); final jsonpet = json.encode(serializedBody); bodyData = jsonpet; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(Pet); - var serializedBody = _serializers.serializeWith(bodySerializer, pet); - var jsonpet = json.encode(serializedBody); - bodyData = jsonpet; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, @@ -357,21 +348,12 @@ class PetApi { 'application/xml', ]; - final serializedBody = _serializers.serialize(pet); + final bodySerializer = _serializers.serializerForType(Pet); + final serializedBody = _serializers.serializeWith(bodySerializer, pet); final jsonpet = json.encode(serializedBody); bodyData = jsonpet; -<<<<<<< HEAD return _dio.request( -======= - - var bodySerializer = _serializers.serializerForType(Pet); - var serializedBody = _serializers.serializeWith(bodySerializer, pet); - var jsonpet = json.encode(serializedBody); - bodyData = jsonpet; - - return _dio.request( ->>>>>>> Updates samples _path, queryParameters: queryParams, data: bodyData, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart index eccb4b304876..ea1d9cbdd4f6 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart @@ -207,17 +207,10 @@ class StoreApi { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(order); + final bodySerializer = _serializers.serializerForType(Order); + final serializedBody = _serializers.serializeWith(bodySerializer, order); final jsonorder = json.encode(serializedBody); bodyData = jsonorder; -======= - - var bodySerializer = _serializers.serializerForType(Order); - var serializedBody = _serializers.serializeWith(bodySerializer, order); - var jsonorder = json.encode(serializedBody); - bodyData = jsonorder; ->>>>>>> Updates samples return _dio.request( _path, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart index 478243bb5eee..63865bc24438 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart @@ -39,17 +39,10 @@ class UserApi { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(user); + final bodySerializer = _serializers.serializerForType(User); + final serializedBody = _serializers.serializeWith(bodySerializer, user); final jsonuser = json.encode(serializedBody); bodyData = jsonuser; -======= - - var bodySerializer = _serializers.serializerForType(User); - var serializedBody = _serializers.serializeWith(bodySerializer, user); - var jsonuser = json.encode(serializedBody); - bodyData = jsonuser; ->>>>>>> Updates samples return _dio.request( _path, @@ -410,17 +403,10 @@ class UserApi { 'application/json', ]; -<<<<<<< HEAD - final serializedBody = _serializers.serialize(user); + final bodySerializer = _serializers.serializerForType(User); + final serializedBody = _serializers.serializeWith(bodySerializer, user); final jsonuser = json.encode(serializedBody); bodyData = jsonuser; -======= - - var bodySerializer = _serializers.serializerForType(User); - var serializedBody = _serializers.serializeWith(bodySerializer, user); - var jsonuser = json.encode(serializedBody); - bodyData = jsonuser; ->>>>>>> Updates samples return _dio.request( _path,