From 6ce1a277b8eb5321e9a4b3a221daef92b27bc779 Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Thu, 16 Nov 2023 22:22:40 +0100 Subject: [PATCH] chore(dynamite_end_to_end_test): regenerate specs Signed-off-by: Nikolas Rimikis --- .../lib/any_of.openapi.dart | 192 +++++++++++++- .../lib/any_of.openapi.g.dart | 157 ------------ .../lib/nested_ofs.openapi.dart | 242 +++++++++++++++++- .../lib/nested_ofs.openapi.g.dart | 196 -------------- .../lib/one_of.openapi.dart | 192 +++++++++++++- .../lib/one_of.openapi.g.dart | 157 ------------ .../lib/type_defs.openapi.dart | 135 +++++++++- .../lib/type_defs.openapi.g.dart | 103 -------- 8 files changed, 746 insertions(+), 628 deletions(-) diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.dart index 7115c38b..817b2c3d 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.dart @@ -47,7 +47,53 @@ abstract class ObjectAnyOf0 implements ObjectAnyOf0Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$objectAnyOf0Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$ObjectAnyOf0Serializer(); +} + +class _$ObjectAnyOf0Serializer implements StructuredSerializer { + const _$ObjectAnyOf0Serializer(); + + @override + Iterable get types => const [ObjectAnyOf0, _$ObjectAnyOf0]; + + @override + String get wireName => 'ObjectAnyOf0'; + + @override + Iterable serialize( + final Serializers serializers, + final ObjectAnyOf0 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute1-anyOf', + serializers.serialize(object.attribute1AnyOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + ObjectAnyOf0 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectAnyOf0Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute1-anyOf': + result.attribute1AnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -65,7 +111,53 @@ abstract class ObjectAnyOf1 implements ObjectAnyOf1Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$objectAnyOf1Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$ObjectAnyOf1Serializer(); +} + +class _$ObjectAnyOf1Serializer implements StructuredSerializer { + const _$ObjectAnyOf1Serializer(); + + @override + Iterable get types => const [ObjectAnyOf1, _$ObjectAnyOf1]; + + @override + String get wireName => 'ObjectAnyOf1'; + + @override + Iterable serialize( + final Serializers serializers, + final ObjectAnyOf1 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute2-anyOf', + serializers.serialize(object.attribute2AnyOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + ObjectAnyOf1 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectAnyOf1Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute2-anyOf': + result.attribute2AnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -150,7 +242,53 @@ abstract class MixedAnyOf1 implements MixedAnyOf1Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$mixedAnyOf1Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$MixedAnyOf1Serializer(); +} + +class _$MixedAnyOf1Serializer implements StructuredSerializer { + const _$MixedAnyOf1Serializer(); + + @override + Iterable get types => const [MixedAnyOf1, _$MixedAnyOf1]; + + @override + String get wireName => 'MixedAnyOf1'; + + @override + Iterable serialize( + final Serializers serializers, + final MixedAnyOf1 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-anyOf', + serializers.serialize(object.attributeAnyOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + MixedAnyOf1 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = MixedAnyOf1Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-anyOf': + result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -236,7 +374,53 @@ abstract class OneObjectAnyOf0 implements OneObjectAnyOf0Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$oneObjectAnyOf0Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$OneObjectAnyOf0Serializer(); +} + +class _$OneObjectAnyOf0Serializer implements StructuredSerializer { + const _$OneObjectAnyOf0Serializer(); + + @override + Iterable get types => const [OneObjectAnyOf0, _$OneObjectAnyOf0]; + + @override + String get wireName => 'OneObjectAnyOf0'; + + @override + Iterable serialize( + final Serializers serializers, + final OneObjectAnyOf0 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-anyOf', + serializers.serialize(object.attributeAnyOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + OneObjectAnyOf0 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = OneObjectAnyOf0Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-anyOf': + result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.g.dart b/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.g.dart index c0bc1795..85921459 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.g.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.g.dart @@ -6,163 +6,6 @@ part of 'any_of.openapi.dart'; // BuiltValueGenerator // ************************************************************************** -Serializer _$objectAnyOf0Serializer = _$ObjectAnyOf0Serializer(); -Serializer _$objectAnyOf1Serializer = _$ObjectAnyOf1Serializer(); -Serializer _$mixedAnyOf1Serializer = _$MixedAnyOf1Serializer(); -Serializer _$oneObjectAnyOf0Serializer = _$OneObjectAnyOf0Serializer(); - -class _$ObjectAnyOf0Serializer implements StructuredSerializer { - @override - final Iterable types = const [ObjectAnyOf0, _$ObjectAnyOf0]; - @override - final String wireName = 'ObjectAnyOf0'; - - @override - Iterable serialize(Serializers serializers, ObjectAnyOf0 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute1-anyOf', - serializers.serialize(object.attribute1AnyOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - ObjectAnyOf0 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = ObjectAnyOf0Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute1-anyOf': - result.attribute1AnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$ObjectAnyOf1Serializer implements StructuredSerializer { - @override - final Iterable types = const [ObjectAnyOf1, _$ObjectAnyOf1]; - @override - final String wireName = 'ObjectAnyOf1'; - - @override - Iterable serialize(Serializers serializers, ObjectAnyOf1 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute2-anyOf', - serializers.serialize(object.attribute2AnyOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - ObjectAnyOf1 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = ObjectAnyOf1Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute2-anyOf': - result.attribute2AnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$MixedAnyOf1Serializer implements StructuredSerializer { - @override - final Iterable types = const [MixedAnyOf1, _$MixedAnyOf1]; - @override - final String wireName = 'MixedAnyOf1'; - - @override - Iterable serialize(Serializers serializers, MixedAnyOf1 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-anyOf', - serializers.serialize(object.attributeAnyOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - MixedAnyOf1 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = MixedAnyOf1Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-anyOf': - result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$OneObjectAnyOf0Serializer implements StructuredSerializer { - @override - final Iterable types = const [OneObjectAnyOf0, _$OneObjectAnyOf0]; - @override - final String wireName = 'OneObjectAnyOf0'; - - @override - Iterable serialize(Serializers serializers, OneObjectAnyOf0 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-anyOf', - serializers.serialize(object.attributeAnyOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - OneObjectAnyOf0 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = OneObjectAnyOf0Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-anyOf': - result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - abstract mixin class ObjectAnyOf0InterfaceBuilder { void replace(ObjectAnyOf0Interface other); void update(void Function(ObjectAnyOf0InterfaceBuilder) updates); diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart index 2119651b..bba36d04 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart @@ -46,7 +46,53 @@ abstract class Base implements BaseInterface, Built { Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$baseSerializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$BaseSerializer(); +} + +class _$BaseSerializer implements StructuredSerializer { + const _$BaseSerializer(); + + @override + Iterable get types => const [Base, _$Base]; + + @override + String get wireName => 'Base'; + + @override + Iterable serialize( + final Serializers serializers, + final Base object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute', + serializers.serialize(object.attribute, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + Base deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = BaseBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute': + result.attribute = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -85,7 +131,53 @@ abstract class BaseOneOf1 implements BaseOneOf1Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$baseOneOf1Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$BaseOneOf1Serializer(); +} + +class _$BaseOneOf1Serializer implements StructuredSerializer { + const _$BaseOneOf1Serializer(); + + @override + Iterable get types => const [BaseOneOf1, _$BaseOneOf1]; + + @override + String get wireName => 'BaseOneOf1'; + + @override + Iterable serialize( + final Serializers serializers, + final BaseOneOf1 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-oneOf', + serializers.serialize(object.attributeOneOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + BaseOneOf1 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = BaseOneOf1Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-oneOf': + result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -170,7 +262,53 @@ abstract class BaseAnyOf1 implements BaseAnyOf1Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$baseAnyOf1Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$BaseAnyOf1Serializer(); +} + +class _$BaseAnyOf1Serializer implements StructuredSerializer { + const _$BaseAnyOf1Serializer(); + + @override + Iterable get types => const [BaseAnyOf1, _$BaseAnyOf1]; + + @override + String get wireName => 'BaseAnyOf1'; + + @override + Iterable serialize( + final Serializers serializers, + final BaseAnyOf1 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-anyOf', + serializers.serialize(object.attributeAnyOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + BaseAnyOf1 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = BaseAnyOf1Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-anyOf': + result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -279,7 +417,54 @@ abstract class BaseNestedOneOf3 implements BaseNestedOneOf3Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$baseNestedOneOf3Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$BaseNestedOneOf3Serializer(); +} + +class _$BaseNestedOneOf3Serializer implements StructuredSerializer { + const _$BaseNestedOneOf3Serializer(); + + @override + Iterable get types => const [BaseNestedOneOf3, _$BaseNestedOneOf3]; + + @override + String get wireName => 'BaseNestedOneOf3'; + + @override + Iterable serialize( + final Serializers serializers, + final BaseNestedOneOf3 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-nested-oneOf', + serializers.serialize(object.attributeNestedOneOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + BaseNestedOneOf3 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = BaseNestedOneOf3Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-nested-oneOf': + result.attributeNestedOneOf = + serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -378,7 +563,54 @@ abstract class BaseNestedAnyOf3 implements BaseNestedAnyOf3Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$baseNestedAnyOf3Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$BaseNestedAnyOf3Serializer(); +} + +class _$BaseNestedAnyOf3Serializer implements StructuredSerializer { + const _$BaseNestedAnyOf3Serializer(); + + @override + Iterable get types => const [BaseNestedAnyOf3, _$BaseNestedAnyOf3]; + + @override + String get wireName => 'BaseNestedAnyOf3'; + + @override + Iterable serialize( + final Serializers serializers, + final BaseNestedAnyOf3 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-nested-anyOf', + serializers.serialize(object.attributeNestedAnyOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + BaseNestedAnyOf3 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = BaseNestedAnyOf3Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-nested-anyOf': + result.attributeNestedAnyOf = + serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.g.dart b/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.g.dart index 9de20256..a51c4b62 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.g.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.g.dart @@ -6,50 +6,8 @@ part of 'nested_ofs.openapi.dart'; // BuiltValueGenerator // ************************************************************************** -Serializer _$baseSerializer = _$BaseSerializer(); Serializer _$baseAllOfSerializer = _$BaseAllOfSerializer(); -Serializer _$baseOneOf1Serializer = _$BaseOneOf1Serializer(); -Serializer _$baseAnyOf1Serializer = _$BaseAnyOf1Serializer(); Serializer _$baseNestedAllOfSerializer = _$BaseNestedAllOfSerializer(); -Serializer _$baseNestedOneOf3Serializer = _$BaseNestedOneOf3Serializer(); -Serializer _$baseNestedAnyOf3Serializer = _$BaseNestedAnyOf3Serializer(); - -class _$BaseSerializer implements StructuredSerializer { - @override - final Iterable types = const [Base, _$Base]; - @override - final String wireName = 'Base'; - - @override - Iterable serialize(Serializers serializers, Base object, {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute', - serializers.serialize(object.attribute, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - Base deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = BaseBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute': - result.attribute = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} class _$BaseAllOfSerializer implements StructuredSerializer { @override @@ -94,82 +52,6 @@ class _$BaseAllOfSerializer implements StructuredSerializer { } } -class _$BaseOneOf1Serializer implements StructuredSerializer { - @override - final Iterable types = const [BaseOneOf1, _$BaseOneOf1]; - @override - final String wireName = 'BaseOneOf1'; - - @override - Iterable serialize(Serializers serializers, BaseOneOf1 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-oneOf', - serializers.serialize(object.attributeOneOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - BaseOneOf1 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = BaseOneOf1Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-oneOf': - result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$BaseAnyOf1Serializer implements StructuredSerializer { - @override - final Iterable types = const [BaseAnyOf1, _$BaseAnyOf1]; - @override - final String wireName = 'BaseAnyOf1'; - - @override - Iterable serialize(Serializers serializers, BaseAnyOf1 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-anyOf', - serializers.serialize(object.attributeAnyOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - BaseAnyOf1 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = BaseAnyOf1Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-anyOf': - result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - class _$BaseNestedAllOfSerializer implements StructuredSerializer { @override final Iterable types = const [BaseNestedAllOf, _$BaseNestedAllOf]; @@ -248,84 +130,6 @@ class _$BaseNestedAllOfSerializer implements StructuredSerializer { - @override - final Iterable types = const [BaseNestedOneOf3, _$BaseNestedOneOf3]; - @override - final String wireName = 'BaseNestedOneOf3'; - - @override - Iterable serialize(Serializers serializers, BaseNestedOneOf3 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-nested-oneOf', - serializers.serialize(object.attributeNestedOneOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - BaseNestedOneOf3 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = BaseNestedOneOf3Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-nested-oneOf': - result.attributeNestedOneOf = - serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$BaseNestedAnyOf3Serializer implements StructuredSerializer { - @override - final Iterable types = const [BaseNestedAnyOf3, _$BaseNestedAnyOf3]; - @override - final String wireName = 'BaseNestedAnyOf3'; - - @override - Iterable serialize(Serializers serializers, BaseNestedAnyOf3 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-nested-anyOf', - serializers.serialize(object.attributeNestedAnyOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - BaseNestedAnyOf3 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = BaseNestedAnyOf3Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-nested-anyOf': - result.attributeNestedAnyOf = - serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - abstract mixin class BaseInterfaceBuilder { void replace(BaseInterface other); void update(void Function(BaseInterfaceBuilder) updates); diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.dart index 5cc846ad..1e92b8e5 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.dart @@ -47,7 +47,53 @@ abstract class ObjectOneOf0 implements ObjectOneOf0Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$objectOneOf0Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$ObjectOneOf0Serializer(); +} + +class _$ObjectOneOf0Serializer implements StructuredSerializer { + const _$ObjectOneOf0Serializer(); + + @override + Iterable get types => const [ObjectOneOf0, _$ObjectOneOf0]; + + @override + String get wireName => 'ObjectOneOf0'; + + @override + Iterable serialize( + final Serializers serializers, + final ObjectOneOf0 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute1-oneOf', + serializers.serialize(object.attribute1OneOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + ObjectOneOf0 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectOneOf0Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute1-oneOf': + result.attribute1OneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -65,7 +111,53 @@ abstract class ObjectOneOf1 implements ObjectOneOf1Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$objectOneOf1Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$ObjectOneOf1Serializer(); +} + +class _$ObjectOneOf1Serializer implements StructuredSerializer { + const _$ObjectOneOf1Serializer(); + + @override + Iterable get types => const [ObjectOneOf1, _$ObjectOneOf1]; + + @override + String get wireName => 'ObjectOneOf1'; + + @override + Iterable serialize( + final Serializers serializers, + final ObjectOneOf1 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute2-oneOf', + serializers.serialize(object.attribute2OneOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + ObjectOneOf1 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectOneOf1Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute2-oneOf': + result.attribute2OneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -150,7 +242,53 @@ abstract class MixedOneOf1 implements MixedOneOf1Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$mixedOneOf1Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$MixedOneOf1Serializer(); +} + +class _$MixedOneOf1Serializer implements StructuredSerializer { + const _$MixedOneOf1Serializer(); + + @override + Iterable get types => const [MixedOneOf1, _$MixedOneOf1]; + + @override + String get wireName => 'MixedOneOf1'; + + @override + Iterable serialize( + final Serializers serializers, + final MixedOneOf1 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-oneOf', + serializers.serialize(object.attributeOneOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + MixedOneOf1 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = MixedOneOf1Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-oneOf': + result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -236,7 +374,53 @@ abstract class OneObjectOneOf0 implements OneObjectOneOf0Interface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$oneObjectOneOf0Serializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$OneObjectOneOf0Serializer(); +} + +class _$OneObjectOneOf0Serializer implements StructuredSerializer { + const _$OneObjectOneOf0Serializer(); + + @override + Iterable get types => const [OneObjectOneOf0, _$OneObjectOneOf0]; + + @override + String get wireName => 'OneObjectOneOf0'; + + @override + Iterable serialize( + final Serializers serializers, + final OneObjectOneOf0 object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = [ + 'attribute-oneOf', + serializers.serialize(object.attributeOneOf, specifiedType: const FullType(String)), + ]; + return result; + } + + @override + OneObjectOneOf0 deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = OneObjectOneOf0Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute-oneOf': + result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.g.dart b/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.g.dart index 5a1ad85d..9961b1c1 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.g.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/one_of.openapi.g.dart @@ -6,163 +6,6 @@ part of 'one_of.openapi.dart'; // BuiltValueGenerator // ************************************************************************** -Serializer _$objectOneOf0Serializer = _$ObjectOneOf0Serializer(); -Serializer _$objectOneOf1Serializer = _$ObjectOneOf1Serializer(); -Serializer _$mixedOneOf1Serializer = _$MixedOneOf1Serializer(); -Serializer _$oneObjectOneOf0Serializer = _$OneObjectOneOf0Serializer(); - -class _$ObjectOneOf0Serializer implements StructuredSerializer { - @override - final Iterable types = const [ObjectOneOf0, _$ObjectOneOf0]; - @override - final String wireName = 'ObjectOneOf0'; - - @override - Iterable serialize(Serializers serializers, ObjectOneOf0 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute1-oneOf', - serializers.serialize(object.attribute1OneOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - ObjectOneOf0 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = ObjectOneOf0Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute1-oneOf': - result.attribute1OneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$ObjectOneOf1Serializer implements StructuredSerializer { - @override - final Iterable types = const [ObjectOneOf1, _$ObjectOneOf1]; - @override - final String wireName = 'ObjectOneOf1'; - - @override - Iterable serialize(Serializers serializers, ObjectOneOf1 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute2-oneOf', - serializers.serialize(object.attribute2OneOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - ObjectOneOf1 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = ObjectOneOf1Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute2-oneOf': - result.attribute2OneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$MixedOneOf1Serializer implements StructuredSerializer { - @override - final Iterable types = const [MixedOneOf1, _$MixedOneOf1]; - @override - final String wireName = 'MixedOneOf1'; - - @override - Iterable serialize(Serializers serializers, MixedOneOf1 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-oneOf', - serializers.serialize(object.attributeOneOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - MixedOneOf1 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = MixedOneOf1Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-oneOf': - result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - -class _$OneObjectOneOf0Serializer implements StructuredSerializer { - @override - final Iterable types = const [OneObjectOneOf0, _$OneObjectOneOf0]; - @override - final String wireName = 'OneObjectOneOf0'; - - @override - Iterable serialize(Serializers serializers, OneObjectOneOf0 object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'attribute-oneOf', - serializers.serialize(object.attributeOneOf, specifiedType: const FullType(String)), - ]; - - return result; - } - - @override - OneObjectOneOf0 deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = OneObjectOneOf0Builder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute-oneOf': - result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String; - break; - } - } - - return result.build(); - } -} - abstract mixin class ObjectOneOf0InterfaceBuilder { void replace(ObjectOneOf0Interface other); void update(void Function(ObjectOneOf0InterfaceBuilder) updates); diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.dart index 20cd4f8c..e004eb92 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.dart @@ -56,7 +56,60 @@ abstract class Base implements BaseInterface, Built { Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$baseSerializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$BaseSerializer(); +} + +class _$BaseSerializer implements StructuredSerializer { + const _$BaseSerializer(); + + @override + Iterable get types => const [Base, _$Base]; + + @override + String get wireName => 'Base'; + + @override + Iterable serialize( + final Serializers serializers, + final Base object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = []; + Object? value; + value = object.attribute; + if (value != null) { + result + ..add('attribute') + ..add( + serializers.serialize(value, specifiedType: const FullType(String)), + ); + } + + return result; + } + + @override + Base deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = BaseBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'attribute': + result.attribute = serializers.deserialize(value, specifiedType: const FullType(String))! as String; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) @@ -76,7 +129,85 @@ abstract class NestedRedirect implements NestedRedirectInterface, Built toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - static Serializer get serializer => _$nestedRedirectSerializer; + @BuiltValueSerializer(custom: true) + static Serializer get serializer => const _$NestedRedirectSerializer(); +} + +class _$NestedRedirectSerializer implements StructuredSerializer { + const _$NestedRedirectSerializer(); + + @override + Iterable get types => const [NestedRedirect, _$NestedRedirect]; + + @override + String get wireName => 'NestedRedirect'; + + @override + Iterable serialize( + final Serializers serializers, + final NestedRedirect object, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = []; + Object? value; + value = object.redirect; + if (value != null) { + result + ..add('redirect') + ..add( + serializers.serialize(value, specifiedType: const FullType(Base)), + ); + } + + value = object.redirectBaseType; + if (value != null) { + result + ..add('redirectBaseType') + ..add( + serializers.serialize(value, specifiedType: const FullType(int)), + ); + } + + value = object.redirectEmptyType; + if (value != null) { + result + ..add('redirectEmptyType') + ..add( + serializers.serialize(value, specifiedType: const FullType(JsonObject)), + ); + } + + return result; + } + + @override + NestedRedirect deserialize( + final Serializers serializers, + final Iterable serialized, { + final FullType specifiedType = FullType.unspecified, + }) { + final result = NestedRedirectBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final value = iterator.current; + switch (key) { + case 'redirect': + result.redirect.replace( + serializers.deserialize(value, specifiedType: const FullType(Base))! as Base, + ); + case 'redirectBaseType': + result.redirectBaseType = serializers.deserialize(value, specifiedType: const FullType(int))! as int; + case 'redirectEmptyType': + result.redirectEmptyType = + serializers.deserialize(value, specifiedType: const FullType(JsonObject))! as JsonObject; + } + } + + return result.build(); + } } @BuiltValue(instantiable: false) diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.g.dart b/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.g.dart index 87686cf1..82384d02 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.g.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/type_defs.openapi.g.dart @@ -6,109 +6,6 @@ part of 'type_defs.openapi.dart'; // BuiltValueGenerator // ************************************************************************** -Serializer _$baseSerializer = _$BaseSerializer(); -Serializer _$nestedRedirectSerializer = _$NestedRedirectSerializer(); - -class _$BaseSerializer implements StructuredSerializer { - @override - final Iterable types = const [Base, _$Base]; - @override - final String wireName = 'Base'; - - @override - Iterable serialize(Serializers serializers, Base object, {FullType specifiedType = FullType.unspecified}) { - final result = []; - Object? value; - value = object.attribute; - if (value != null) { - result - ..add('attribute') - ..add(serializers.serialize(value, specifiedType: const FullType(String))); - } - return result; - } - - @override - Base deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = BaseBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'attribute': - result.attribute = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; - break; - } - } - - return result.build(); - } -} - -class _$NestedRedirectSerializer implements StructuredSerializer { - @override - final Iterable types = const [NestedRedirect, _$NestedRedirect]; - @override - final String wireName = 'NestedRedirect'; - - @override - Iterable serialize(Serializers serializers, NestedRedirect object, - {FullType specifiedType = FullType.unspecified}) { - final result = []; - Object? value; - value = object.redirect; - if (value != null) { - result - ..add('redirect') - ..add(serializers.serialize(value, specifiedType: const FullType(Base))); - } - value = object.redirectBaseType; - if (value != null) { - result - ..add('redirectBaseType') - ..add(serializers.serialize(value, specifiedType: const FullType(int))); - } - value = object.redirectEmptyType; - if (value != null) { - result - ..add('redirectEmptyType') - ..add(serializers.serialize(value, specifiedType: const FullType(JsonObject))); - } - return result; - } - - @override - NestedRedirect deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = NestedRedirectBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current! as String; - iterator.moveNext(); - final Object? value = iterator.current; - switch (key) { - case 'redirect': - result.redirect.replace(serializers.deserialize(value, specifiedType: const FullType(Base))! as Base); - break; - case 'redirectBaseType': - result.redirectBaseType = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; - break; - case 'redirectEmptyType': - result.redirectEmptyType = - serializers.deserialize(value, specifiedType: const FullType(JsonObject)) as JsonObject?; - break; - } - } - - return result.build(); - } -} - abstract mixin class BaseInterfaceBuilder { void replace(BaseInterface other); void update(void Function(BaseInterfaceBuilder) updates);