Browse Source

fix(dynamite,dynamite_end_to_end_test): fix allOf with primitive types

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/1156/head
Nikolas Rimikis 1 year ago
parent
commit
19e7fe6202
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 35
      packages/dynamite/dynamite/lib/src/builder/ofs_builder.dart
  2. 55
      packages/dynamite/dynamite/lib/src/builder/resolve_interface.dart
  3. 72
      packages/dynamite/dynamite_end_to_end_test/lib/all_of.openapi.dart
  4. 419
      packages/dynamite/dynamite_end_to_end_test/lib/all_of.openapi.g.dart
  5. 38
      packages/dynamite/dynamite_end_to_end_test/lib/all_of.openapi.json
  6. 78
      packages/dynamite/dynamite_end_to_end_test/test/all_of_test.dart

35
packages/dynamite/dynamite/lib/src/builder/ofs_builder.dart

@ -22,10 +22,18 @@ TypeResult resolveAllOf(
if (state.resolvedTypes.add(result)) { if (state.resolvedTypes.add(result)) {
final interfaces = <TypeResultObject>{}; final interfaces = <TypeResultObject>{};
final methods = ListBuilder<Method>();
for (final s in schema.allOf!) { for (final s in schema.allOf!) {
final TypeResultObject interfaceClass; if (s.properties != null) {
if (s.ref != null) { final interfaceClass = resolveInterface(
spec,
state,
'${identifier}_${schema.allOf!.indexOf(s)}',
s,
);
interfaces.add(interfaceClass);
} else {
final object = resolveType( final object = resolveType(
spec, spec,
state, state,
@ -34,25 +42,22 @@ TypeResult resolveAllOf(
nullable: nullable, nullable: nullable,
); );
if (object is! TypeResultObject) { if (object is TypeResultObject) {
throw StateError('allOf does only allow objects. Please change $identifier'); interfaces.add(object);
}
interfaceClass = object;
} else { } else {
interfaceClass = resolveInterface( final property = generateProperty(
spec, object,
state, object.className,
'${identifier}_${schema.allOf!.indexOf(s)}', s.formattedDescription,
s,
); );
}
interfaces.add(interfaceClass); methods.add(property);
}
}
} }
state.output.add( state.output.add(
buildInterface(identifier, interfaces: interfaces), buildInterface(identifier, interfaces: interfaces, methods: methods.build()),
); );
state.output.add( state.output.add(

55
packages/dynamite/dynamite/lib/src/builder/resolve_interface.dart

@ -14,6 +14,12 @@ TypeResultObject resolveInterface(
final String identifier, final String identifier,
final openapi.Schema schema, final openapi.Schema schema,
) { ) {
final properties = schema.properties?.entries;
if (properties == null || properties.isEmpty) {
throw StateError('The schema must have a non empty properties field.');
}
final result = TypeResultObject( final result = TypeResultObject(
identifier, identifier,
); );
@ -22,12 +28,11 @@ TypeResultObject resolveInterface(
final $interface = buildInterface( final $interface = buildInterface(
identifier, identifier,
methods: BuiltList.build((final b) { methods: BuiltList.build((final b) {
for (final property in schema.properties!.entries) { b.addAll(
b.add( properties.map((final property) {
Method(
(final b) {
final propertyName = property.key; final propertyName = property.key;
final propertySchema = property.value; final propertySchema = property.value;
final result = resolveType( final result = resolveType(
spec, spec,
state, state,
@ -39,13 +44,37 @@ TypeResultObject resolveInterface(
), ),
); );
return generateProperty(
result,
propertyName,
propertySchema.formattedDescription,
);
}),
);
}),
);
state.output.add($interface);
}
return result;
}
Method generateProperty(
final TypeResult type,
final String propertyName,
final Iterable<String> description,
) =>
Method(
(final b) {
final name = toFieldName(toDartName(propertyName), type.name);
b b
..name = toDartName(propertyName) ..name = name
..returns = refer(result.nullableName) ..returns = refer(type.nullableName)
..type = MethodType.getter ..type = MethodType.getter
..docs.addAll(propertySchema.formattedDescription); ..docs.addAll(description);
if (toDartName(propertyName) != propertyName) { if (name != propertyName) {
b.annotations.add( b.annotations.add(
refer('BuiltValueField').call([], { refer('BuiltValueField').call([], {
'wireName': literalString(propertyName), 'wireName': literalString(propertyName),
@ -53,17 +82,7 @@ TypeResultObject resolveInterface(
); );
} }
}, },
),
); );
}
}),
);
state.output.add($interface);
}
return result;
}
Spec buildInterface( Spec buildInterface(
final String identifier, { final String identifier, {

72
packages/dynamite/dynamite_end_to_end_test/lib/all_of.openapi.dart

@ -79,12 +79,82 @@ abstract class OneObjectAllOf implements OneObjectAllOfInterface, Built<OneObjec
static Serializer<OneObjectAllOf> get serializer => _$oneObjectAllOfSerializer; static Serializer<OneObjectAllOf> get serializer => _$oneObjectAllOfSerializer;
} }
@BuiltValue(instantiable: false)
abstract interface class PrimitiveAllOfInterface {
@BuiltValueField(wireName: 'int')
int get $int;
@BuiltValueField(wireName: 'String')
String get string;
}
abstract class PrimitiveAllOf implements PrimitiveAllOfInterface, Built<PrimitiveAllOf, PrimitiveAllOfBuilder> {
factory PrimitiveAllOf([final void Function(PrimitiveAllOfBuilder)? b]) = _$PrimitiveAllOf;
const PrimitiveAllOf._();
factory PrimitiveAllOf.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
static Serializer<PrimitiveAllOf> get serializer => _$primitiveAllOfSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class MixedAllOf_1Interface {
@BuiltValueField(wireName: 'attribute-allOf')
String get attributeAllOf;
}
@BuiltValue(instantiable: false)
abstract interface class MixedAllOfInterface implements MixedAllOf_1Interface {
@BuiltValueField(wireName: 'String')
String get string;
}
abstract class MixedAllOf implements MixedAllOfInterface, Built<MixedAllOf, MixedAllOfBuilder> {
factory MixedAllOf([final void Function(MixedAllOfBuilder)? b]) = _$MixedAllOf;
const MixedAllOf._();
factory MixedAllOf.fromJson(final Map<String, dynamic> json) => _jsonSerializers.deserializeWith(serializer, json)!;
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
static Serializer<MixedAllOf> get serializer => _$mixedAllOfSerializer;
}
@BuiltValue(instantiable: false)
abstract interface class OneValueAllOfInterface {
@BuiltValueField(wireName: 'String')
String get string;
}
abstract class OneValueAllOf implements OneValueAllOfInterface, Built<OneValueAllOf, OneValueAllOfBuilder> {
factory OneValueAllOf([final void Function(OneValueAllOfBuilder)? b]) = _$OneValueAllOf;
const OneValueAllOf._();
factory OneValueAllOf.fromJson(final Map<String, dynamic> json) =>
_jsonSerializers.deserializeWith(serializer, json)!;
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;
static Serializer<OneValueAllOf> get serializer => _$oneValueAllOfSerializer;
}
// coverage:ignore-start // coverage:ignore-start
final Serializers _serializers = (Serializers().toBuilder() final Serializers _serializers = (Serializers().toBuilder()
..addBuilderFactory(const FullType(ObjectAllOf), ObjectAllOf.new) ..addBuilderFactory(const FullType(ObjectAllOf), ObjectAllOf.new)
..add(ObjectAllOf.serializer) ..add(ObjectAllOf.serializer)
..addBuilderFactory(const FullType(OneObjectAllOf), OneObjectAllOf.new) ..addBuilderFactory(const FullType(OneObjectAllOf), OneObjectAllOf.new)
..add(OneObjectAllOf.serializer)) ..add(OneObjectAllOf.serializer)
..addBuilderFactory(const FullType(PrimitiveAllOf), PrimitiveAllOf.new)
..add(PrimitiveAllOf.serializer)
..addBuilderFactory(const FullType(MixedAllOf), MixedAllOf.new)
..add(MixedAllOf.serializer)
..addBuilderFactory(const FullType(OneValueAllOf), OneValueAllOf.new)
..add(OneValueAllOf.serializer))
.build(); .build();
final Serializers _jsonSerializers = (_serializers.toBuilder() final Serializers _jsonSerializers = (_serializers.toBuilder()

419
packages/dynamite/dynamite_end_to_end_test/lib/all_of.openapi.g.dart

@ -8,6 +8,9 @@ part of 'all_of.openapi.dart';
Serializer<ObjectAllOf> _$objectAllOfSerializer = _$ObjectAllOfSerializer(); Serializer<ObjectAllOf> _$objectAllOfSerializer = _$ObjectAllOfSerializer();
Serializer<OneObjectAllOf> _$oneObjectAllOfSerializer = _$OneObjectAllOfSerializer(); Serializer<OneObjectAllOf> _$oneObjectAllOfSerializer = _$OneObjectAllOfSerializer();
Serializer<PrimitiveAllOf> _$primitiveAllOfSerializer = _$PrimitiveAllOfSerializer();
Serializer<MixedAllOf> _$mixedAllOfSerializer = _$MixedAllOfSerializer();
Serializer<OneValueAllOf> _$oneValueAllOfSerializer = _$OneValueAllOfSerializer();
class _$ObjectAllOfSerializer implements StructuredSerializer<ObjectAllOf> { class _$ObjectAllOfSerializer implements StructuredSerializer<ObjectAllOf> {
@override @override
@ -90,6 +93,130 @@ class _$OneObjectAllOfSerializer implements StructuredSerializer<OneObjectAllOf>
} }
} }
class _$PrimitiveAllOfSerializer implements StructuredSerializer<PrimitiveAllOf> {
@override
final Iterable<Type> types = const [PrimitiveAllOf, _$PrimitiveAllOf];
@override
final String wireName = 'PrimitiveAllOf';
@override
Iterable<Object?> serialize(Serializers serializers, PrimitiveAllOf object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[
'int',
serializers.serialize(object.$int, specifiedType: const FullType(int)),
'String',
serializers.serialize(object.string, specifiedType: const FullType(String)),
];
return result;
}
@override
PrimitiveAllOf deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = PrimitiveAllOfBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current! as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case 'int':
result.$int = serializers.deserialize(value, specifiedType: const FullType(int))! as int;
break;
case 'String':
result.string = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break;
}
}
return result.build();
}
}
class _$MixedAllOfSerializer implements StructuredSerializer<MixedAllOf> {
@override
final Iterable<Type> types = const [MixedAllOf, _$MixedAllOf];
@override
final String wireName = 'MixedAllOf';
@override
Iterable<Object?> serialize(Serializers serializers, MixedAllOf object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[
'String',
serializers.serialize(object.string, specifiedType: const FullType(String)),
'attribute-allOf',
serializers.serialize(object.attributeAllOf, specifiedType: const FullType(String)),
];
return result;
}
@override
MixedAllOf deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = MixedAllOfBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current! as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case 'String':
result.string = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break;
case 'attribute-allOf':
result.attributeAllOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break;
}
}
return result.build();
}
}
class _$OneValueAllOfSerializer implements StructuredSerializer<OneValueAllOf> {
@override
final Iterable<Type> types = const [OneValueAllOf, _$OneValueAllOf];
@override
final String wireName = 'OneValueAllOf';
@override
Iterable<Object?> serialize(Serializers serializers, OneValueAllOf object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[
'String',
serializers.serialize(object.string, specifiedType: const FullType(String)),
];
return result;
}
@override
OneValueAllOf deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = OneValueAllOfBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current! as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case 'String':
result.string = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break;
}
}
return result.build();
}
}
abstract mixin class ObjectAllOf_0InterfaceBuilder { abstract mixin class ObjectAllOf_0InterfaceBuilder {
void replace(ObjectAllOf_0Interface other); void replace(ObjectAllOf_0Interface other);
void update(void Function(ObjectAllOf_0InterfaceBuilder) updates); void update(void Function(ObjectAllOf_0InterfaceBuilder) updates);
@ -298,4 +425,296 @@ class OneObjectAllOfBuilder implements Builder<OneObjectAllOf, OneObjectAllOfBui
} }
} }
abstract mixin class PrimitiveAllOfInterfaceBuilder {
void replace(PrimitiveAllOfInterface other);
void update(void Function(PrimitiveAllOfInterfaceBuilder) updates);
int? get $int;
set $int(int? $int);
String? get string;
set string(String? string);
}
class _$PrimitiveAllOf extends PrimitiveAllOf {
@override
final int $int;
@override
final String string;
factory _$PrimitiveAllOf([void Function(PrimitiveAllOfBuilder)? updates]) =>
(PrimitiveAllOfBuilder()..update(updates))._build();
_$PrimitiveAllOf._({required this.$int, required this.string}) : super._() {
BuiltValueNullFieldError.checkNotNull($int, r'PrimitiveAllOf', '\$int');
BuiltValueNullFieldError.checkNotNull(string, r'PrimitiveAllOf', 'string');
}
@override
PrimitiveAllOf rebuild(void Function(PrimitiveAllOfBuilder) updates) => (toBuilder()..update(updates)).build();
@override
PrimitiveAllOfBuilder toBuilder() => PrimitiveAllOfBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is PrimitiveAllOf && $int == other.$int && string == other.string;
}
@override
int get hashCode {
var _$hash = 0;
_$hash = $jc(_$hash, $int.hashCode);
_$hash = $jc(_$hash, string.hashCode);
_$hash = $jf(_$hash);
return _$hash;
}
@override
String toString() {
return (newBuiltValueToStringHelper(r'PrimitiveAllOf')
..add('\$int', $int)
..add('string', string))
.toString();
}
}
class PrimitiveAllOfBuilder implements Builder<PrimitiveAllOf, PrimitiveAllOfBuilder>, PrimitiveAllOfInterfaceBuilder {
_$PrimitiveAllOf? _$v;
int? _$int;
int? get $int => _$this._$int;
set $int(covariant int? $int) => _$this._$int = $int;
String? _string;
String? get string => _$this._string;
set string(covariant String? string) => _$this._string = string;
PrimitiveAllOfBuilder();
PrimitiveAllOfBuilder get _$this {
final $v = _$v;
if ($v != null) {
_$int = $v.$int;
_string = $v.string;
_$v = null;
}
return this;
}
@override
void replace(covariant PrimitiveAllOf other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$PrimitiveAllOf;
}
@override
void update(void Function(PrimitiveAllOfBuilder)? updates) {
if (updates != null) updates(this);
}
@override
PrimitiveAllOf build() => _build();
_$PrimitiveAllOf _build() {
final _$result = _$v ??
_$PrimitiveAllOf._(
$int: BuiltValueNullFieldError.checkNotNull($int, r'PrimitiveAllOf', '\$int'),
string: BuiltValueNullFieldError.checkNotNull(string, r'PrimitiveAllOf', 'string'));
replace(_$result);
return _$result;
}
}
abstract mixin class MixedAllOf_1InterfaceBuilder {
void replace(MixedAllOf_1Interface other);
void update(void Function(MixedAllOf_1InterfaceBuilder) updates);
String? get attributeAllOf;
set attributeAllOf(String? attributeAllOf);
}
abstract mixin class MixedAllOfInterfaceBuilder implements MixedAllOf_1InterfaceBuilder {
void replace(covariant MixedAllOfInterface other);
void update(void Function(MixedAllOfInterfaceBuilder) updates);
String? get string;
set string(covariant String? string);
String? get attributeAllOf;
set attributeAllOf(covariant String? attributeAllOf);
}
class _$MixedAllOf extends MixedAllOf {
@override
final String string;
@override
final String attributeAllOf;
factory _$MixedAllOf([void Function(MixedAllOfBuilder)? updates]) => (MixedAllOfBuilder()..update(updates))._build();
_$MixedAllOf._({required this.string, required this.attributeAllOf}) : super._() {
BuiltValueNullFieldError.checkNotNull(string, r'MixedAllOf', 'string');
BuiltValueNullFieldError.checkNotNull(attributeAllOf, r'MixedAllOf', 'attributeAllOf');
}
@override
MixedAllOf rebuild(void Function(MixedAllOfBuilder) updates) => (toBuilder()..update(updates)).build();
@override
MixedAllOfBuilder toBuilder() => MixedAllOfBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is MixedAllOf && string == other.string && attributeAllOf == other.attributeAllOf;
}
@override
int get hashCode {
var _$hash = 0;
_$hash = $jc(_$hash, string.hashCode);
_$hash = $jc(_$hash, attributeAllOf.hashCode);
_$hash = $jf(_$hash);
return _$hash;
}
@override
String toString() {
return (newBuiltValueToStringHelper(r'MixedAllOf')
..add('string', string)
..add('attributeAllOf', attributeAllOf))
.toString();
}
}
class MixedAllOfBuilder implements Builder<MixedAllOf, MixedAllOfBuilder>, MixedAllOfInterfaceBuilder {
_$MixedAllOf? _$v;
String? _string;
String? get string => _$this._string;
set string(covariant String? string) => _$this._string = string;
String? _attributeAllOf;
String? get attributeAllOf => _$this._attributeAllOf;
set attributeAllOf(covariant String? attributeAllOf) => _$this._attributeAllOf = attributeAllOf;
MixedAllOfBuilder();
MixedAllOfBuilder get _$this {
final $v = _$v;
if ($v != null) {
_string = $v.string;
_attributeAllOf = $v.attributeAllOf;
_$v = null;
}
return this;
}
@override
void replace(covariant MixedAllOf other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$MixedAllOf;
}
@override
void update(void Function(MixedAllOfBuilder)? updates) {
if (updates != null) updates(this);
}
@override
MixedAllOf build() => _build();
_$MixedAllOf _build() {
final _$result = _$v ??
_$MixedAllOf._(
string: BuiltValueNullFieldError.checkNotNull(string, r'MixedAllOf', 'string'),
attributeAllOf: BuiltValueNullFieldError.checkNotNull(attributeAllOf, r'MixedAllOf', 'attributeAllOf'));
replace(_$result);
return _$result;
}
}
abstract mixin class OneValueAllOfInterfaceBuilder {
void replace(OneValueAllOfInterface other);
void update(void Function(OneValueAllOfInterfaceBuilder) updates);
String? get string;
set string(String? string);
}
class _$OneValueAllOf extends OneValueAllOf {
@override
final String string;
factory _$OneValueAllOf([void Function(OneValueAllOfBuilder)? updates]) =>
(OneValueAllOfBuilder()..update(updates))._build();
_$OneValueAllOf._({required this.string}) : super._() {
BuiltValueNullFieldError.checkNotNull(string, r'OneValueAllOf', 'string');
}
@override
OneValueAllOf rebuild(void Function(OneValueAllOfBuilder) updates) => (toBuilder()..update(updates)).build();
@override
OneValueAllOfBuilder toBuilder() => OneValueAllOfBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is OneValueAllOf && string == other.string;
}
@override
int get hashCode {
var _$hash = 0;
_$hash = $jc(_$hash, string.hashCode);
_$hash = $jf(_$hash);
return _$hash;
}
@override
String toString() {
return (newBuiltValueToStringHelper(r'OneValueAllOf')..add('string', string)).toString();
}
}
class OneValueAllOfBuilder implements Builder<OneValueAllOf, OneValueAllOfBuilder>, OneValueAllOfInterfaceBuilder {
_$OneValueAllOf? _$v;
String? _string;
String? get string => _$this._string;
set string(covariant String? string) => _$this._string = string;
OneValueAllOfBuilder();
OneValueAllOfBuilder get _$this {
final $v = _$v;
if ($v != null) {
_string = $v.string;
_$v = null;
}
return this;
}
@override
void replace(covariant OneValueAllOf other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$OneValueAllOf;
}
@override
void update(void Function(OneValueAllOfBuilder)? updates) {
if (updates != null) updates(this);
}
@override
OneValueAllOf build() => _build();
_$OneValueAllOf _build() {
final _$result =
_$v ?? _$OneValueAllOf._(string: BuiltValueNullFieldError.checkNotNull(string, r'OneValueAllOf', 'string'));
replace(_$result);
return _$result;
}
}
// ignore_for_file: deprecated_member_use_from_same_package,type=lint // ignore_for_file: deprecated_member_use_from_same_package,type=lint

38
packages/dynamite/dynamite_end_to_end_test/lib/all_of.openapi.json

@ -48,6 +48,44 @@
} }
} }
] ]
},
"PrimitiveAllOf": {
"description": "All of with an primitive values.",
"allOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
"MixedAllOf": {
"description": "All of with object and primitive value.",
"allOf": [
{
"type": "string"
},
{
"type": "object",
"required": [
"attribute-allOf"
],
"properties": {
"attribute-allOf": {
"type": "string"
}
}
}
]
},
"OneValueAllOf": {
"description": "All of with one primitive value.",
"allOf": [
{
"type": "string"
}
]
} }
} }
}, },

78
packages/dynamite/dynamite_end_to_end_test/test/all_of_test.dart

@ -0,0 +1,78 @@
import 'package:dynamite_end_to_end_test/all_of.openapi.dart';
import 'package:test/test.dart';
void main() {
test('ObjectAllOf', () {
final object = ObjectAllOf(
(final b) => b
..attribute1AllOf = 'attribute1AllOfValue'
..attribute2AllOf = 'attribute2AllOfValue',
);
final json = {
'attribute1-allOf': 'attribute1AllOfValue',
'attribute2-allOf': 'attribute2AllOfValue',
};
expect(object.toJson(), equals(json));
expect(ObjectAllOf.fromJson(json), equals(object));
});
test('OneObjectAllOf', () {
final object = OneObjectAllOf(
(final b) => b..attributeAllOf = 'attributeAllOfValue',
);
final json = {
'attribute-allOf': 'attributeAllOfValue',
};
expect(object.toJson(), equals(json));
expect(OneObjectAllOf.fromJson(json), equals(object));
});
test('PrimitiveAllOf', () {
final object = PrimitiveAllOf(
(final b) => b
..string = 'stringValue'
..$int = 62,
);
final json = {
'String': 'stringValue',
'int': 62,
};
expect(object.toJson(), equals(json));
expect(PrimitiveAllOf.fromJson(json), equals(object));
});
test('MixedAllOf', () {
final object = MixedAllOf(
(final b) => b
..string = 'stringValue'
..attributeAllOf = 'attributeAllOfValue',
);
final json = {
'String': 'stringValue',
'attribute-allOf': 'attributeAllOfValue',
};
expect(object.toJson(), equals(json));
expect(MixedAllOf.fromJson(json), equals(object));
});
test('OneValueAllOf', () {
final object = OneValueAllOf(
(final b) => b..string = 'stringValue',
);
final json = {
'String': 'stringValue',
};
expect(object.toJson(), equals(json));
expect(OneValueAllOf.fromJson(json), equals(object));
});
}
Loading…
Cancel
Save