Browse Source

fix(dynamite,nextcloud): make oneOf and anyOf throw at build time rather then on deserialization

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/1001/head
Nikolas Rimikis 1 year ago
parent
commit
ec77029c28
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 75
      packages/dynamite/dynamite/lib/src/builder/ofs_builder.dart
  2. 135
      packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart
  3. 228
      packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.g.dart
  4. 21
      packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.json
  5. 1
      packages/dynamite/dynamite_end_to_end_test/pubspec.yaml
  6. 77
      packages/dynamite/dynamite_end_to_end_test/test/nested_ofs_test.dart
  7. 228
      packages/nextcloud/lib/src/api/core.openapi.dart
  8. 5
      packages/nextcloud/lib/src/api/core.openapi.g.dart
  9. 92
      packages/nextcloud/lib/src/api/files_sharing.openapi.dart
  10. 4
      packages/nextcloud/lib/src/api/files_sharing.openapi.g.dart
  11. 232
      packages/nextcloud/lib/src/api/provisioning_api.openapi.dart
  12. 10
      packages/nextcloud/lib/src/api/provisioning_api.openapi.g.dart
  13. 45
      packages/nextcloud/lib/src/api/user_status.openapi.dart
  14. 2
      packages/nextcloud/lib/src/api/user_status.openapi.g.dart

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

@ -101,8 +101,7 @@ TypeResult resolveOfs(
fields[result.name] = toFieldName(dartName, result.name); fields[result.name] = toFieldName(dartName, result.name);
} }
state.output.addAll([ final interface = buildInterface(
buildInterface(
identifier, identifier,
methods: BuiltList.from( methods: BuiltList.from(
results.map( results.map(
@ -118,12 +117,47 @@ TypeResult resolveOfs(
), ),
), ),
), ),
);
final hook = Method((final b) {
b
..name = '_validate'
..returns = refer('void')
..annotations.add(
refer('BuiltValueHook').call([], {'finalizeBuilder': literalTrue}),
)
..static = true
..requiredParameters.add(
Parameter(
(final b) => b
..name = 'b'
..type = refer('${identifier}Builder'),
), ),
buildBuiltClass( );
final buffer = StringBuffer()
..writeln('// When this is rebuild from another builder')
..writeln('if (b._data == null) { return;}')
..writeln()
..writeln('final match = ')
..writeln('[${fields.values.map((final e) => 'b._$e').join(',')}]')
..writeln(schema.oneOf != null ? '.singleWhereOrNull' : '.firstWhereOrNull')
..writeln('((final x) => x != null);')
..writeln('if (match == null) {')
..writeln(
'throw StateError("Need ${schema.oneOf != null ? 'exactly' : 'at least'} one of ${fields.values.map((final e) => "'$e'").join(', ')} for \${b._data}");',
)
..writeln('}');
b.body = Code(buffer.toString());
});
final $class = buildBuiltClass(
identifier, identifier,
customSerializer: true, customSerializer: true,
methods: BuiltList.build( methods: BuiltList.build(
(final b) => b.add( (final b) => b
..add(
Method( Method(
(final b) { (final b) {
b b
@ -132,10 +166,12 @@ TypeResult resolveOfs(
..type = MethodType.getter; ..type = MethodType.getter;
}, },
), ),
)
..add(hook),
), ),
), );
),
Class( final serializer = Class(
(final b) => b (final b) => b
..name = '_\$${identifier}Serializer' ..name = '_\$${identifier}Serializer'
..implements.add(refer('PrimitiveSerializer<$identifier>')) ..implements.add(refer('PrimitiveSerializer<$identifier>'))
@ -214,7 +250,7 @@ TypeResult resolveOfs(
) )
..body = Code( ..body = Code(
<String>[ <String>[
'final result = new ${identifier}Builder()', 'final result = ${identifier}Builder()',
'..data = JsonObject(data);', '..data = JsonObject(data);',
if (schema.discriminator != null) ...[ if (schema.discriminator != null) ...[
'if (data is! Iterable) {', 'if (data is! Iterable) {',
@ -249,11 +285,11 @@ TypeResult resolveOfs(
], ],
], ],
'try {', 'try {',
if (result is TypeResultBase || result is TypeResultEnum) ...[ 'final value = ${result.deserialize('data')};',
'result._${fields[result.name]!} = ${result.deserialize('data')};', if (result is TypeResultBase || result is TypeResultEnum)
] else ...[ 'result.${fields[result.name]!} = value;'
'result._${fields[result.name]!} = ${result.deserialize('data')}.toBuilder();', else
], 'result.${fields[result.name]!}.replace(value);',
'} catch (_) {', '} catch (_) {',
if (schema.discriminator != null) ...[ if (schema.discriminator != null) ...[
'rethrow;', 'rethrow;',
@ -263,18 +299,17 @@ TypeResult resolveOfs(
'}', '}',
], ],
], ],
if (schema.oneOf != null) ...[
"assert([${fields.values.map((final e) => 'result._$e').join(',')}].where((final x) => x != null).length >= 1, 'Need oneOf for \${result._data}');",
],
if (schema.anyOf != null) ...[
"assert([${fields.values.map((final e) => 'result._$e').join(',')}].where((final x) => x != null).length >= 1, 'Need anyOf for \${result._data}');",
],
'return result.build();', 'return result.build();',
].join(), ].join(),
); );
}), }),
]), ]),
), );
state.output.addAll([
interface,
$class,
serializer,
]); ]);
} }

135
packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart

@ -7,6 +7,7 @@ import 'package:built_value/built_value.dart';
import 'package:built_value/json_object.dart'; import 'package:built_value/json_object.dart';
import 'package:built_value/serializer.dart'; import 'package:built_value/serializer.dart';
import 'package:built_value/standard_json_plugin.dart'; import 'package:built_value/standard_json_plugin.dart';
import 'package:collection/collection.dart';
import 'package:dynamite_runtime/built_value.dart'; import 'package:dynamite_runtime/built_value.dart';
import 'package:dynamite_runtime/http_client.dart'; import 'package:dynamite_runtime/http_client.dart';
@ -33,7 +34,7 @@ class Client extends DynamiteClient {
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class BaseInterface { abstract interface class BaseInterface {
String? get attribute; String get attribute;
} }
abstract class Base implements BaseInterface, Built<Base, BaseBuilder> { abstract class Base implements BaseInterface, Built<Base, BaseBuilder> {
@ -57,7 +58,7 @@ abstract class Base implements BaseInterface, Built<Base, BaseBuilder> {
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class BaseAllOf_1Interface { abstract interface class BaseAllOf_1Interface {
@BuiltValueField(wireName: 'attribute-allOf') @BuiltValueField(wireName: 'attribute-allOf')
String? get attributeAllOf; String get attributeAllOf;
} }
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
@ -84,7 +85,7 @@ abstract class BaseAllOf implements BaseAllOfInterface, Built<BaseAllOf, BaseAll
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class BaseOneOf1Interface { abstract interface class BaseOneOf1Interface {
@BuiltValueField(wireName: 'attribute-oneOf') @BuiltValueField(wireName: 'attribute-oneOf')
String? get attributeOneOf; String get attributeOneOf;
} }
abstract class BaseOneOf1 implements BaseOneOf1Interface, Built<BaseOneOf1, BaseOneOf1Builder> { abstract class BaseOneOf1 implements BaseOneOf1Interface, Built<BaseOneOf1, BaseOneOf1Builder> {
@ -130,6 +131,18 @@ abstract class BaseOneOf implements BaseOneOfInterface, Built<BaseOneOf, BaseOne
static Serializer<BaseOneOf> get serializer => _$BaseOneOfSerializer(); static Serializer<BaseOneOf> get serializer => _$BaseOneOfSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final BaseOneOfBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._base, b._baseOneOf1].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of 'base', 'baseOneOf1' for ${b._data}");
}
}
} }
class _$BaseOneOfSerializer implements PrimitiveSerializer<BaseOneOf> { class _$BaseOneOfSerializer implements PrimitiveSerializer<BaseOneOf> {
@ -155,16 +168,13 @@ class _$BaseOneOfSerializer implements PrimitiveSerializer<BaseOneOf> {
}) { }) {
final result = BaseOneOfBuilder()..data = JsonObject(data); final result = BaseOneOfBuilder()..data = JsonObject(data);
try { try {
result._base = (_jsonSerializers.deserialize(data, specifiedType: const FullType(Base))! as Base).toBuilder(); final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(Base))! as Base;
result.base.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseOneOf1 = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf1))! as BaseOneOf1;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf1))! as BaseOneOf1).toBuilder(); result.baseOneOf1.replace(value);
} catch (_) {} } catch (_) {}
assert(
[result._base, result._baseOneOf1].where((final x) => x != null).isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -172,7 +182,7 @@ class _$BaseOneOfSerializer implements PrimitiveSerializer<BaseOneOf> {
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class BaseAnyOf1Interface { abstract interface class BaseAnyOf1Interface {
@BuiltValueField(wireName: 'attribute-anyOf') @BuiltValueField(wireName: 'attribute-anyOf')
String? get attributeAnyOf; String get attributeAnyOf;
} }
abstract class BaseAnyOf1 implements BaseAnyOf1Interface, Built<BaseAnyOf1, BaseAnyOf1Builder> { abstract class BaseAnyOf1 implements BaseAnyOf1Interface, Built<BaseAnyOf1, BaseAnyOf1Builder> {
@ -218,6 +228,18 @@ abstract class BaseAnyOf implements BaseAnyOfInterface, Built<BaseAnyOf, BaseAny
static Serializer<BaseAnyOf> get serializer => _$BaseAnyOfSerializer(); static Serializer<BaseAnyOf> get serializer => _$BaseAnyOfSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final BaseAnyOfBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._base, b._baseAnyOf1].firstWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need at least one of 'base', 'baseAnyOf1' for ${b._data}");
}
}
} }
class _$BaseAnyOfSerializer implements PrimitiveSerializer<BaseAnyOf> { class _$BaseAnyOfSerializer implements PrimitiveSerializer<BaseAnyOf> {
@ -243,16 +265,13 @@ class _$BaseAnyOfSerializer implements PrimitiveSerializer<BaseAnyOf> {
}) { }) {
final result = BaseAnyOfBuilder()..data = JsonObject(data); final result = BaseAnyOfBuilder()..data = JsonObject(data);
try { try {
result._base = (_jsonSerializers.deserialize(data, specifiedType: const FullType(Base))! as Base).toBuilder(); final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(Base))! as Base;
result.base.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseAnyOf1 = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf1))! as BaseAnyOf1;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf1))! as BaseAnyOf1).toBuilder(); result.baseAnyOf1.replace(value);
} catch (_) {} } catch (_) {}
assert(
[result._base, result._baseAnyOf1].where((final x) => x != null).isNotEmpty,
'Need anyOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -260,7 +279,7 @@ class _$BaseAnyOfSerializer implements PrimitiveSerializer<BaseAnyOf> {
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class BaseNestedAllOf_3Interface { abstract interface class BaseNestedAllOf_3Interface {
@BuiltValueField(wireName: 'attribute-nested-allOf') @BuiltValueField(wireName: 'attribute-nested-allOf')
String? get attributeNestedAllOf; String get attributeNestedAllOf;
} }
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
@ -289,7 +308,7 @@ abstract class BaseNestedAllOf implements BaseNestedAllOfInterface, Built<BaseNe
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class BaseNestedOneOf3Interface { abstract interface class BaseNestedOneOf3Interface {
@BuiltValueField(wireName: 'attribute-nested-oneOf') @BuiltValueField(wireName: 'attribute-nested-oneOf')
String? get attributeNestedOneOf; String get attributeNestedOneOf;
} }
abstract class BaseNestedOneOf3 implements BaseNestedOneOf3Interface, Built<BaseNestedOneOf3, BaseNestedOneOf3Builder> { abstract class BaseNestedOneOf3 implements BaseNestedOneOf3Interface, Built<BaseNestedOneOf3, BaseNestedOneOf3Builder> {
@ -339,6 +358,19 @@ abstract class BaseNestedOneOf implements BaseNestedOneOfInterface, Built<BaseNe
static Serializer<BaseNestedOneOf> get serializer => _$BaseNestedOneOfSerializer(); static Serializer<BaseNestedOneOf> get serializer => _$BaseNestedOneOfSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final BaseNestedOneOfBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match =
[b._baseAllOf, b._baseOneOf, b._baseAnyOf, b._baseNestedOneOf3].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of 'baseAllOf', 'baseOneOf', 'baseAnyOf', 'baseNestedOneOf3' for ${b._data}");
}
}
} }
class _$BaseNestedOneOfSerializer implements PrimitiveSerializer<BaseNestedOneOf> { class _$BaseNestedOneOfSerializer implements PrimitiveSerializer<BaseNestedOneOf> {
@ -364,28 +396,22 @@ class _$BaseNestedOneOfSerializer implements PrimitiveSerializer<BaseNestedOneOf
}) { }) {
final result = BaseNestedOneOfBuilder()..data = JsonObject(data); final result = BaseNestedOneOfBuilder()..data = JsonObject(data);
try { try {
result._baseAllOf = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAllOf))! as BaseAllOf;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAllOf))! as BaseAllOf).toBuilder(); result.baseAllOf.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseOneOf = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf))! as BaseOneOf;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf))! as BaseOneOf).toBuilder(); result.baseOneOf.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseAnyOf = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf))! as BaseAnyOf;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf))! as BaseAnyOf).toBuilder(); result.baseAnyOf.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseNestedOneOf3 = final value =
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseNestedOneOf3))! as BaseNestedOneOf3) _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseNestedOneOf3))! as BaseNestedOneOf3;
.toBuilder(); result.baseNestedOneOf3.replace(value);
} catch (_) {} } catch (_) {}
assert(
[result._baseAllOf, result._baseOneOf, result._baseAnyOf, result._baseNestedOneOf3]
.where((final x) => x != null)
.isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -393,7 +419,7 @@ class _$BaseNestedOneOfSerializer implements PrimitiveSerializer<BaseNestedOneOf
@BuiltValue(instantiable: false) @BuiltValue(instantiable: false)
abstract interface class BaseNestedAnyOf3Interface { abstract interface class BaseNestedAnyOf3Interface {
@BuiltValueField(wireName: 'attribute-nested-anyOf') @BuiltValueField(wireName: 'attribute-nested-anyOf')
String? get attributeNestedAnyOf; String get attributeNestedAnyOf;
} }
abstract class BaseNestedAnyOf3 implements BaseNestedAnyOf3Interface, Built<BaseNestedAnyOf3, BaseNestedAnyOf3Builder> { abstract class BaseNestedAnyOf3 implements BaseNestedAnyOf3Interface, Built<BaseNestedAnyOf3, BaseNestedAnyOf3Builder> {
@ -443,6 +469,19 @@ abstract class BaseNestedAnyOf implements BaseNestedAnyOfInterface, Built<BaseNe
static Serializer<BaseNestedAnyOf> get serializer => _$BaseNestedAnyOfSerializer(); static Serializer<BaseNestedAnyOf> get serializer => _$BaseNestedAnyOfSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final BaseNestedAnyOfBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match =
[b._baseAllOf, b._baseOneOf, b._baseAnyOf, b._baseNestedAnyOf3].firstWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need at least one of 'baseAllOf', 'baseOneOf', 'baseAnyOf', 'baseNestedAnyOf3' for ${b._data}");
}
}
} }
class _$BaseNestedAnyOfSerializer implements PrimitiveSerializer<BaseNestedAnyOf> { class _$BaseNestedAnyOfSerializer implements PrimitiveSerializer<BaseNestedAnyOf> {
@ -468,28 +507,22 @@ class _$BaseNestedAnyOfSerializer implements PrimitiveSerializer<BaseNestedAnyOf
}) { }) {
final result = BaseNestedAnyOfBuilder()..data = JsonObject(data); final result = BaseNestedAnyOfBuilder()..data = JsonObject(data);
try { try {
result._baseAllOf = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAllOf))! as BaseAllOf;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAllOf))! as BaseAllOf).toBuilder(); result.baseAllOf.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseOneOf = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf))! as BaseOneOf;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf))! as BaseOneOf).toBuilder(); result.baseOneOf.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseAnyOf = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf))! as BaseAnyOf;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf))! as BaseAnyOf).toBuilder(); result.baseAnyOf.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._baseNestedAnyOf3 = final value =
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseNestedAnyOf3))! as BaseNestedAnyOf3) _jsonSerializers.deserialize(data, specifiedType: const FullType(BaseNestedAnyOf3))! as BaseNestedAnyOf3;
.toBuilder(); result.baseNestedAnyOf3.replace(value);
} catch (_) {} } catch (_) {}
assert(
[result._baseAllOf, result._baseOneOf, result._baseAnyOf, result._baseNestedAnyOf3]
.where((final x) => x != null)
.isNotEmpty,
'Need anyOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }

228
packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.g.dart

@ -22,14 +22,11 @@ class _$BaseSerializer implements StructuredSerializer<Base> {
@override @override
Iterable<Object?> serialize(Serializers serializers, Base object, {FullType specifiedType = FullType.unspecified}) { Iterable<Object?> serialize(Serializers serializers, Base object, {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[]; final result = <Object?>[
Object? value; 'attribute',
value = object.attribute; serializers.serialize(object.attribute, specifiedType: const FullType(String)),
if (value != null) { ];
result
..add('attribute')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -45,7 +42,7 @@ class _$BaseSerializer implements StructuredSerializer<Base> {
final Object? value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'attribute': case 'attribute':
result.attribute = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; result.attribute = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
} }
} }
@ -63,20 +60,13 @@ class _$BaseAllOfSerializer implements StructuredSerializer<BaseAllOf> {
@override @override
Iterable<Object?> serialize(Serializers serializers, BaseAllOf object, Iterable<Object?> serialize(Serializers serializers, BaseAllOf object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[]; final result = <Object?>[
Object? value; 'attribute',
value = object.attribute; serializers.serialize(object.attribute, specifiedType: const FullType(String)),
if (value != null) { 'attribute-allOf',
result serializers.serialize(object.attributeAllOf, specifiedType: const FullType(String)),
..add('attribute') ];
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
value = object.attributeAllOf;
if (value != null) {
result
..add('attribute-allOf')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -92,10 +82,10 @@ class _$BaseAllOfSerializer implements StructuredSerializer<BaseAllOf> {
final Object? value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'attribute': case 'attribute':
result.attribute = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; result.attribute = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
case 'attribute-allOf': case 'attribute-allOf':
result.attributeAllOf = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; result.attributeAllOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
} }
} }
@ -113,14 +103,11 @@ class _$BaseOneOf1Serializer implements StructuredSerializer<BaseOneOf1> {
@override @override
Iterable<Object?> serialize(Serializers serializers, BaseOneOf1 object, Iterable<Object?> serialize(Serializers serializers, BaseOneOf1 object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[]; final result = <Object?>[
Object? value; 'attribute-oneOf',
value = object.attributeOneOf; serializers.serialize(object.attributeOneOf, specifiedType: const FullType(String)),
if (value != null) { ];
result
..add('attribute-oneOf')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -136,7 +123,7 @@ class _$BaseOneOf1Serializer implements StructuredSerializer<BaseOneOf1> {
final Object? value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'attribute-oneOf': case 'attribute-oneOf':
result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; result.attributeOneOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
} }
} }
@ -154,14 +141,11 @@ class _$BaseAnyOf1Serializer implements StructuredSerializer<BaseAnyOf1> {
@override @override
Iterable<Object?> serialize(Serializers serializers, BaseAnyOf1 object, Iterable<Object?> serialize(Serializers serializers, BaseAnyOf1 object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[]; final result = <Object?>[
Object? value; 'attribute-anyOf',
value = object.attributeAnyOf; serializers.serialize(object.attributeAnyOf, specifiedType: const FullType(String)),
if (value != null) { ];
result
..add('attribute-anyOf')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -177,7 +161,7 @@ class _$BaseAnyOf1Serializer implements StructuredSerializer<BaseAnyOf1> {
final Object? value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'attribute-anyOf': case 'attribute-anyOf':
result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; result.attributeAnyOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
} }
} }
@ -195,20 +179,15 @@ class _$BaseNestedAllOfSerializer implements StructuredSerializer<BaseNestedAllO
@override @override
Iterable<Object?> serialize(Serializers serializers, BaseNestedAllOf object, Iterable<Object?> serialize(Serializers serializers, BaseNestedAllOf object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[]; final result = <Object?>[
'attribute',
serializers.serialize(object.attribute, specifiedType: const FullType(String)),
'attribute-allOf',
serializers.serialize(object.attributeAllOf, specifiedType: const FullType(String)),
'attribute-nested-allOf',
serializers.serialize(object.attributeNestedAllOf, specifiedType: const FullType(String)),
];
Object? value; Object? value;
value = object.attribute;
if (value != null) {
result
..add('attribute')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
value = object.attributeAllOf;
if (value != null) {
result
..add('attribute-allOf')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
value = object.base; value = object.base;
if (value != null) { if (value != null) {
result result
@ -227,12 +206,6 @@ class _$BaseNestedAllOfSerializer implements StructuredSerializer<BaseNestedAllO
..add('baseAnyOf1') ..add('baseAnyOf1')
..add(serializers.serialize(value, specifiedType: const FullType(BaseAnyOf1))); ..add(serializers.serialize(value, specifiedType: const FullType(BaseAnyOf1)));
} }
value = object.attributeNestedAllOf;
if (value != null) {
result
..add('attribute-nested-allOf')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -248,10 +221,10 @@ class _$BaseNestedAllOfSerializer implements StructuredSerializer<BaseNestedAllO
final Object? value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'attribute': case 'attribute':
result.attribute = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; result.attribute = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
case 'attribute-allOf': case 'attribute-allOf':
result.attributeAllOf = serializers.deserialize(value, specifiedType: const FullType(String)) as String?; result.attributeAllOf = serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
case 'base': case 'base':
result.base.replace(serializers.deserialize(value, specifiedType: const FullType(Base))! as Base); result.base.replace(serializers.deserialize(value, specifiedType: const FullType(Base))! as Base);
@ -266,7 +239,7 @@ class _$BaseNestedAllOfSerializer implements StructuredSerializer<BaseNestedAllO
break; break;
case 'attribute-nested-allOf': case 'attribute-nested-allOf':
result.attributeNestedAllOf = result.attributeNestedAllOf =
serializers.deserialize(value, specifiedType: const FullType(String)) as String?; serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
} }
} }
@ -284,14 +257,11 @@ class _$BaseNestedOneOf3Serializer implements StructuredSerializer<BaseNestedOne
@override @override
Iterable<Object?> serialize(Serializers serializers, BaseNestedOneOf3 object, Iterable<Object?> serialize(Serializers serializers, BaseNestedOneOf3 object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[]; final result = <Object?>[
Object? value; 'attribute-nested-oneOf',
value = object.attributeNestedOneOf; serializers.serialize(object.attributeNestedOneOf, specifiedType: const FullType(String)),
if (value != null) { ];
result
..add('attribute-nested-oneOf')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -308,7 +278,7 @@ class _$BaseNestedOneOf3Serializer implements StructuredSerializer<BaseNestedOne
switch (key) { switch (key) {
case 'attribute-nested-oneOf': case 'attribute-nested-oneOf':
result.attributeNestedOneOf = result.attributeNestedOneOf =
serializers.deserialize(value, specifiedType: const FullType(String)) as String?; serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
} }
} }
@ -326,14 +296,11 @@ class _$BaseNestedAnyOf3Serializer implements StructuredSerializer<BaseNestedAny
@override @override
Iterable<Object?> serialize(Serializers serializers, BaseNestedAnyOf3 object, Iterable<Object?> serialize(Serializers serializers, BaseNestedAnyOf3 object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[]; final result = <Object?>[
Object? value; 'attribute-nested-anyOf',
value = object.attributeNestedAnyOf; serializers.serialize(object.attributeNestedAnyOf, specifiedType: const FullType(String)),
if (value != null) { ];
result
..add('attribute-nested-anyOf')
..add(serializers.serialize(value, specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -350,7 +317,7 @@ class _$BaseNestedAnyOf3Serializer implements StructuredSerializer<BaseNestedAny
switch (key) { switch (key) {
case 'attribute-nested-anyOf': case 'attribute-nested-anyOf':
result.attributeNestedAnyOf = result.attributeNestedAnyOf =
serializers.deserialize(value, specifiedType: const FullType(String)) as String?; serializers.deserialize(value, specifiedType: const FullType(String))! as String;
break; break;
} }
} }
@ -368,11 +335,13 @@ abstract mixin class BaseInterfaceBuilder {
class _$Base extends Base { class _$Base extends Base {
@override @override
final String? attribute; final String attribute;
factory _$Base([void Function(BaseBuilder)? updates]) => (BaseBuilder()..update(updates))._build(); factory _$Base([void Function(BaseBuilder)? updates]) => (BaseBuilder()..update(updates))._build();
_$Base._({this.attribute}) : super._(); _$Base._({required this.attribute}) : super._() {
BuiltValueNullFieldError.checkNotNull(attribute, r'Base', 'attribute');
}
@override @override
Base rebuild(void Function(BaseBuilder) updates) => (toBuilder()..update(updates)).build(); Base rebuild(void Function(BaseBuilder) updates) => (toBuilder()..update(updates)).build();
@ -433,7 +402,7 @@ class BaseBuilder implements Builder<Base, BaseBuilder>, BaseInterfaceBuilder {
Base build() => _build(); Base build() => _build();
_$Base _build() { _$Base _build() {
final _$result = _$v ?? _$Base._(attribute: attribute); final _$result = _$v ?? _$Base._(attribute: BuiltValueNullFieldError.checkNotNull(attribute, r'Base', 'attribute'));
replace(_$result); replace(_$result);
return _$result; return _$result;
} }
@ -458,13 +427,16 @@ abstract mixin class BaseAllOfInterfaceBuilder implements BaseInterfaceBuilder,
class _$BaseAllOf extends BaseAllOf { class _$BaseAllOf extends BaseAllOf {
@override @override
final String? attribute; final String attribute;
@override @override
final String? attributeAllOf; final String attributeAllOf;
factory _$BaseAllOf([void Function(BaseAllOfBuilder)? updates]) => (BaseAllOfBuilder()..update(updates))._build(); factory _$BaseAllOf([void Function(BaseAllOfBuilder)? updates]) => (BaseAllOfBuilder()..update(updates))._build();
_$BaseAllOf._({this.attribute, this.attributeAllOf}) : super._(); _$BaseAllOf._({required this.attribute, required this.attributeAllOf}) : super._() {
BuiltValueNullFieldError.checkNotNull(attribute, r'BaseAllOf', 'attribute');
BuiltValueNullFieldError.checkNotNull(attributeAllOf, r'BaseAllOf', 'attributeAllOf');
}
@override @override
BaseAllOf rebuild(void Function(BaseAllOfBuilder) updates) => (toBuilder()..update(updates)).build(); BaseAllOf rebuild(void Function(BaseAllOfBuilder) updates) => (toBuilder()..update(updates)).build();
@ -534,7 +506,10 @@ class BaseAllOfBuilder implements Builder<BaseAllOf, BaseAllOfBuilder>, BaseAllO
BaseAllOf build() => _build(); BaseAllOf build() => _build();
_$BaseAllOf _build() { _$BaseAllOf _build() {
final _$result = _$v ?? _$BaseAllOf._(attribute: attribute, attributeAllOf: attributeAllOf); final _$result = _$v ??
_$BaseAllOf._(
attribute: BuiltValueNullFieldError.checkNotNull(attribute, r'BaseAllOf', 'attribute'),
attributeAllOf: BuiltValueNullFieldError.checkNotNull(attributeAllOf, r'BaseAllOf', 'attributeAllOf'));
replace(_$result); replace(_$result);
return _$result; return _$result;
} }
@ -549,11 +524,13 @@ abstract mixin class BaseOneOf1InterfaceBuilder {
class _$BaseOneOf1 extends BaseOneOf1 { class _$BaseOneOf1 extends BaseOneOf1 {
@override @override
final String? attributeOneOf; final String attributeOneOf;
factory _$BaseOneOf1([void Function(BaseOneOf1Builder)? updates]) => (BaseOneOf1Builder()..update(updates))._build(); factory _$BaseOneOf1([void Function(BaseOneOf1Builder)? updates]) => (BaseOneOf1Builder()..update(updates))._build();
_$BaseOneOf1._({this.attributeOneOf}) : super._(); _$BaseOneOf1._({required this.attributeOneOf}) : super._() {
BuiltValueNullFieldError.checkNotNull(attributeOneOf, r'BaseOneOf1', 'attributeOneOf');
}
@override @override
BaseOneOf1 rebuild(void Function(BaseOneOf1Builder) updates) => (toBuilder()..update(updates)).build(); BaseOneOf1 rebuild(void Function(BaseOneOf1Builder) updates) => (toBuilder()..update(updates)).build();
@ -614,7 +591,9 @@ class BaseOneOf1Builder implements Builder<BaseOneOf1, BaseOneOf1Builder>, BaseO
BaseOneOf1 build() => _build(); BaseOneOf1 build() => _build();
_$BaseOneOf1 _build() { _$BaseOneOf1 _build() {
final _$result = _$v ?? _$BaseOneOf1._(attributeOneOf: attributeOneOf); final _$result = _$v ??
_$BaseOneOf1._(
attributeOneOf: BuiltValueNullFieldError.checkNotNull(attributeOneOf, r'BaseOneOf1', 'attributeOneOf'));
replace(_$result); replace(_$result);
return _$result; return _$result;
} }
@ -719,6 +698,7 @@ class BaseOneOfBuilder implements Builder<BaseOneOf, BaseOneOfBuilder>, BaseOneO
BaseOneOf build() => _build(); BaseOneOf build() => _build();
_$BaseOneOf _build() { _$BaseOneOf _build() {
BaseOneOf._validate(this);
_$BaseOneOf _$result; _$BaseOneOf _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -752,11 +732,13 @@ abstract mixin class BaseAnyOf1InterfaceBuilder {
class _$BaseAnyOf1 extends BaseAnyOf1 { class _$BaseAnyOf1 extends BaseAnyOf1 {
@override @override
final String? attributeAnyOf; final String attributeAnyOf;
factory _$BaseAnyOf1([void Function(BaseAnyOf1Builder)? updates]) => (BaseAnyOf1Builder()..update(updates))._build(); factory _$BaseAnyOf1([void Function(BaseAnyOf1Builder)? updates]) => (BaseAnyOf1Builder()..update(updates))._build();
_$BaseAnyOf1._({this.attributeAnyOf}) : super._(); _$BaseAnyOf1._({required this.attributeAnyOf}) : super._() {
BuiltValueNullFieldError.checkNotNull(attributeAnyOf, r'BaseAnyOf1', 'attributeAnyOf');
}
@override @override
BaseAnyOf1 rebuild(void Function(BaseAnyOf1Builder) updates) => (toBuilder()..update(updates)).build(); BaseAnyOf1 rebuild(void Function(BaseAnyOf1Builder) updates) => (toBuilder()..update(updates)).build();
@ -817,7 +799,9 @@ class BaseAnyOf1Builder implements Builder<BaseAnyOf1, BaseAnyOf1Builder>, BaseA
BaseAnyOf1 build() => _build(); BaseAnyOf1 build() => _build();
_$BaseAnyOf1 _build() { _$BaseAnyOf1 _build() {
final _$result = _$v ?? _$BaseAnyOf1._(attributeAnyOf: attributeAnyOf); final _$result = _$v ??
_$BaseAnyOf1._(
attributeAnyOf: BuiltValueNullFieldError.checkNotNull(attributeAnyOf, r'BaseAnyOf1', 'attributeAnyOf'));
replace(_$result); replace(_$result);
return _$result; return _$result;
} }
@ -922,6 +906,7 @@ class BaseAnyOfBuilder implements Builder<BaseAnyOf, BaseAnyOfBuilder>, BaseAnyO
BaseAnyOf build() => _build(); BaseAnyOf build() => _build();
_$BaseAnyOf _build() { _$BaseAnyOf _build() {
BaseAnyOf._validate(this);
_$BaseAnyOf _$result; _$BaseAnyOf _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -982,9 +967,9 @@ abstract mixin class BaseNestedAllOfInterfaceBuilder
class _$BaseNestedAllOf extends BaseNestedAllOf { class _$BaseNestedAllOf extends BaseNestedAllOf {
@override @override
final String? attribute; final String attribute;
@override @override
final String? attributeAllOf; final String attributeAllOf;
@override @override
final Base? base; final Base? base;
@override @override
@ -992,14 +977,23 @@ class _$BaseNestedAllOf extends BaseNestedAllOf {
@override @override
final BaseAnyOf1? baseAnyOf1; final BaseAnyOf1? baseAnyOf1;
@override @override
final String? attributeNestedAllOf; final String attributeNestedAllOf;
factory _$BaseNestedAllOf([void Function(BaseNestedAllOfBuilder)? updates]) => factory _$BaseNestedAllOf([void Function(BaseNestedAllOfBuilder)? updates]) =>
(BaseNestedAllOfBuilder()..update(updates))._build(); (BaseNestedAllOfBuilder()..update(updates))._build();
_$BaseNestedAllOf._( _$BaseNestedAllOf._(
{this.attribute, this.attributeAllOf, this.base, this.baseOneOf1, this.baseAnyOf1, this.attributeNestedAllOf}) {required this.attribute,
: super._(); required this.attributeAllOf,
this.base,
this.baseOneOf1,
this.baseAnyOf1,
required this.attributeNestedAllOf})
: super._() {
BuiltValueNullFieldError.checkNotNull(attribute, r'BaseNestedAllOf', 'attribute');
BuiltValueNullFieldError.checkNotNull(attributeAllOf, r'BaseNestedAllOf', 'attributeAllOf');
BuiltValueNullFieldError.checkNotNull(attributeNestedAllOf, r'BaseNestedAllOf', 'attributeNestedAllOf');
}
@override @override
BaseNestedAllOf rebuild(void Function(BaseNestedAllOfBuilder) updates) => (toBuilder()..update(updates)).build(); BaseNestedAllOf rebuild(void Function(BaseNestedAllOfBuilder) updates) => (toBuilder()..update(updates)).build();
@ -1109,12 +1103,14 @@ class BaseNestedAllOfBuilder
try { try {
_$result = _$v ?? _$result = _$v ??
_$BaseNestedAllOf._( _$BaseNestedAllOf._(
attribute: attribute, attribute: BuiltValueNullFieldError.checkNotNull(attribute, r'BaseNestedAllOf', 'attribute'),
attributeAllOf: attributeAllOf, attributeAllOf:
BuiltValueNullFieldError.checkNotNull(attributeAllOf, r'BaseNestedAllOf', 'attributeAllOf'),
base: _base?.build(), base: _base?.build(),
baseOneOf1: _baseOneOf1?.build(), baseOneOf1: _baseOneOf1?.build(),
baseAnyOf1: _baseAnyOf1?.build(), baseAnyOf1: _baseAnyOf1?.build(),
attributeNestedAllOf: attributeNestedAllOf); attributeNestedAllOf: BuiltValueNullFieldError.checkNotNull(
attributeNestedAllOf, r'BaseNestedAllOf', 'attributeNestedAllOf'));
} catch (_) { } catch (_) {
late String _$failedField; late String _$failedField;
try { try {
@ -1143,12 +1139,14 @@ abstract mixin class BaseNestedOneOf3InterfaceBuilder {
class _$BaseNestedOneOf3 extends BaseNestedOneOf3 { class _$BaseNestedOneOf3 extends BaseNestedOneOf3 {
@override @override
final String? attributeNestedOneOf; final String attributeNestedOneOf;
factory _$BaseNestedOneOf3([void Function(BaseNestedOneOf3Builder)? updates]) => factory _$BaseNestedOneOf3([void Function(BaseNestedOneOf3Builder)? updates]) =>
(BaseNestedOneOf3Builder()..update(updates))._build(); (BaseNestedOneOf3Builder()..update(updates))._build();
_$BaseNestedOneOf3._({this.attributeNestedOneOf}) : super._(); _$BaseNestedOneOf3._({required this.attributeNestedOneOf}) : super._() {
BuiltValueNullFieldError.checkNotNull(attributeNestedOneOf, r'BaseNestedOneOf3', 'attributeNestedOneOf');
}
@override @override
BaseNestedOneOf3 rebuild(void Function(BaseNestedOneOf3Builder) updates) => (toBuilder()..update(updates)).build(); BaseNestedOneOf3 rebuild(void Function(BaseNestedOneOf3Builder) updates) => (toBuilder()..update(updates)).build();
@ -1212,7 +1210,10 @@ class BaseNestedOneOf3Builder
BaseNestedOneOf3 build() => _build(); BaseNestedOneOf3 build() => _build();
_$BaseNestedOneOf3 _build() { _$BaseNestedOneOf3 _build() {
final _$result = _$v ?? _$BaseNestedOneOf3._(attributeNestedOneOf: attributeNestedOneOf); final _$result = _$v ??
_$BaseNestedOneOf3._(
attributeNestedOneOf: BuiltValueNullFieldError.checkNotNull(
attributeNestedOneOf, r'BaseNestedOneOf3', 'attributeNestedOneOf'));
replace(_$result); replace(_$result);
return _$result; return _$result;
} }
@ -1350,6 +1351,7 @@ class BaseNestedOneOfBuilder
BaseNestedOneOf build() => _build(); BaseNestedOneOf build() => _build();
_$BaseNestedOneOf _build() { _$BaseNestedOneOf _build() {
BaseNestedOneOf._validate(this);
_$BaseNestedOneOf _$result; _$BaseNestedOneOf _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -1389,12 +1391,14 @@ abstract mixin class BaseNestedAnyOf3InterfaceBuilder {
class _$BaseNestedAnyOf3 extends BaseNestedAnyOf3 { class _$BaseNestedAnyOf3 extends BaseNestedAnyOf3 {
@override @override
final String? attributeNestedAnyOf; final String attributeNestedAnyOf;
factory _$BaseNestedAnyOf3([void Function(BaseNestedAnyOf3Builder)? updates]) => factory _$BaseNestedAnyOf3([void Function(BaseNestedAnyOf3Builder)? updates]) =>
(BaseNestedAnyOf3Builder()..update(updates))._build(); (BaseNestedAnyOf3Builder()..update(updates))._build();
_$BaseNestedAnyOf3._({this.attributeNestedAnyOf}) : super._(); _$BaseNestedAnyOf3._({required this.attributeNestedAnyOf}) : super._() {
BuiltValueNullFieldError.checkNotNull(attributeNestedAnyOf, r'BaseNestedAnyOf3', 'attributeNestedAnyOf');
}
@override @override
BaseNestedAnyOf3 rebuild(void Function(BaseNestedAnyOf3Builder) updates) => (toBuilder()..update(updates)).build(); BaseNestedAnyOf3 rebuild(void Function(BaseNestedAnyOf3Builder) updates) => (toBuilder()..update(updates)).build();
@ -1458,7 +1462,10 @@ class BaseNestedAnyOf3Builder
BaseNestedAnyOf3 build() => _build(); BaseNestedAnyOf3 build() => _build();
_$BaseNestedAnyOf3 _build() { _$BaseNestedAnyOf3 _build() {
final _$result = _$v ?? _$BaseNestedAnyOf3._(attributeNestedAnyOf: attributeNestedAnyOf); final _$result = _$v ??
_$BaseNestedAnyOf3._(
attributeNestedAnyOf: BuiltValueNullFieldError.checkNotNull(
attributeNestedAnyOf, r'BaseNestedAnyOf3', 'attributeNestedAnyOf'));
replace(_$result); replace(_$result);
return _$result; return _$result;
} }
@ -1596,6 +1603,7 @@ class BaseNestedAnyOfBuilder
BaseNestedAnyOf build() => _build(); BaseNestedAnyOf build() => _build();
_$BaseNestedAnyOf _build() { _$BaseNestedAnyOf _build() {
BaseNestedAnyOf._validate(this);
_$BaseNestedAnyOf _$result; _$BaseNestedAnyOf _$result;
try { try {
_$result = _$v ?? _$result = _$v ??

21
packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.json

@ -8,6 +8,9 @@
"schemas": { "schemas": {
"Base": { "Base": {
"type": "object", "type": "object",
"required": [
"attribute"
],
"properties": { "properties": {
"attribute": { "attribute": {
"type": "string" "type": "string"
@ -21,6 +24,9 @@
}, },
{ {
"type": "object", "type": "object",
"required": [
"attribute-allOf"
],
"properties": { "properties": {
"attribute-allOf": { "attribute-allOf": {
"type": "string" "type": "string"
@ -36,6 +42,9 @@
}, },
{ {
"type": "object", "type": "object",
"required": [
"attribute-oneOf"
],
"properties": { "properties": {
"attribute-oneOf": { "attribute-oneOf": {
"type": "string" "type": "string"
@ -51,6 +60,9 @@
}, },
{ {
"type": "object", "type": "object",
"required": [
"attribute-anyOf"
],
"properties": { "properties": {
"attribute-anyOf": { "attribute-anyOf": {
"type": "string" "type": "string"
@ -72,6 +84,9 @@
}, },
{ {
"type": "object", "type": "object",
"required": [
"attribute-nested-allOf"
],
"properties": { "properties": {
"attribute-nested-allOf": { "attribute-nested-allOf": {
"type": "string" "type": "string"
@ -93,6 +108,9 @@
}, },
{ {
"type": "object", "type": "object",
"required": [
"attribute-nested-oneOf"
],
"properties": { "properties": {
"attribute-nested-oneOf": { "attribute-nested-oneOf": {
"type": "string" "type": "string"
@ -114,6 +132,9 @@
}, },
{ {
"type": "object", "type": "object",
"required": [
"attribute-nested-anyOf"
],
"properties": { "properties": {
"attribute-nested-anyOf": { "attribute-nested-anyOf": {
"type": "string" "type": "string"

1
packages/dynamite/dynamite_end_to_end_test/pubspec.yaml

@ -9,6 +9,7 @@ environment:
dependencies: dependencies:
built_collection: ^5.0.0 built_collection: ^5.0.0
built_value: ^8.0.0 built_value: ^8.0.0
collection: ^1.0.0
dynamite_runtime: dynamite_runtime:
git: git:
url: https://github.com/nextcloud/neon url: https://github.com/nextcloud/neon

77
packages/dynamite/dynamite_end_to_end_test/test/nested_ofs_test.dart

@ -1,4 +1,5 @@
import 'package:built_value/json_object.dart'; import 'package:built_value/json_object.dart';
import 'package:built_value/serializer.dart';
import 'package:dynamite_end_to_end_test/nested_ofs.openapi.dart'; import 'package:dynamite_end_to_end_test/nested_ofs.openapi.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
@ -37,48 +38,30 @@ void main() {
final object = BaseNestedOneOf( final object = BaseNestedOneOf(
(final b) => b (final b) => b
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) ..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue'])
..baseAllOf.update((final b) {})
..baseOneOf.update( ..baseOneOf.update(
(final b) => b (final b) => b
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) ..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue'])
..base.update((final b) {})
..baseOneOf1.attributeOneOf = 'baseOneOfAttributeOneOfValue', ..baseOneOf1.attributeOneOf = 'baseOneOfAttributeOneOfValue',
) ),
..baseAnyOf.update(
(final b) => b
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue'])
..base.update((final b) {})
..baseAnyOf1.update((final b) {}),
)
..baseNestedOneOf3.update((final b) {}),
); );
final json = { final json = {
'attribute-oneOf': 'baseOneOfAttributeOneOfValue', 'attribute-oneOf': 'baseOneOfAttributeOneOfValue',
}; };
expect(object.toJson(), equals(json));
expect(BaseNestedOneOf.fromJson(json), equals(object)); expect(BaseNestedOneOf.fromJson(json), equals(object));
expect(object.toJson(), equals(json));
}); });
test('BaseNestedAnyOf', () { test('BaseNestedAnyOf', () {
final object = BaseNestedAnyOf( final object = BaseNestedAnyOf(
(final b) => b (final b) => b
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) ..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue'])
..baseAllOf.update((final b) {})
..baseOneOf.update( ..baseOneOf.update(
(final b) => b (final b) => b
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) ..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue'])
..base.update((final b) {})
..baseOneOf1.attributeOneOf = 'baseOneOfAttributeOneOfValue', ..baseOneOf1.attributeOneOf = 'baseOneOfAttributeOneOfValue',
) ),
..baseAnyOf.update(
(final b) => b
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue'])
..base.update((final b) {})
..baseAnyOf1.update((final b) {}),
)
..baseNestedAnyOf3.update((final b) {}),
); );
final json = { final json = {
@ -88,4 +71,56 @@ void main() {
expect(object.toJson(), equals(json)); expect(object.toJson(), equals(json));
expect(BaseNestedAnyOf.fromJson(json), equals(object)); expect(BaseNestedAnyOf.fromJson(json), equals(object));
}); });
test('BaseOneOf', () {
final object = BaseOneOf(
(final b) => b
..data = JsonObject(['attribute-oneOf', 'attributeOneOfValue'])
..baseOneOf1.attributeOneOf = 'attributeOneOfValue',
);
var json = {'attribute-oneOf': 'attributeOneOfValue'};
expect(BaseOneOf.fromJson(json), equals(object));
expect(object.toJson(), equals(json));
final builder = BaseOneOfBuilder()
..data = JsonObject(['attribute-oneOf', 'attributeOneOfValue'])
..baseOneOf1.attributeOneOf = 'attributeOneOfValue'
..base.attribute = 'baseAttributeValue';
json = {
'attribute-oneOf': 'attributeOneOfValue',
'attribute': 'baseAttributeValue',
};
expect(builder.build, throwsA(isA<StateError>()));
expect(() => BaseOneOf.fromJson(json), throwsA(isA<DeserializationError>()));
json = {};
expect(() => BaseOneOf.fromJson(json), throwsA(isA<DeserializationError>()));
});
test('BaseAnyOf', () {
var object = BaseAnyOf(
(final b) => b
..data = JsonObject(['attribute-anyOf', 'attributeAnyOfValue'])
..baseAnyOf1.attributeAnyOf = 'attributeAnyOfValue',
);
var json = {'attribute-anyOf': 'attributeAnyOfValue'};
expect(BaseAnyOf.fromJson(json), equals(object));
expect(object.toJson(), equals(json));
object = BaseAnyOf(
(final b) => b
..data = JsonObject(['attribute-anyOf', 'attributeAnyOfValue', 'attribute', 'baseAttributeValue'])
..baseAnyOf1.attributeAnyOf = 'attributeAnyOfValue'
..base.attribute = 'baseAttributeValue',
);
json = {
'attribute-anyOf': 'attributeAnyOfValue',
'attribute': 'baseAttributeValue',
};
expect(BaseAnyOf.fromJson(json), equals(object));
expect(object.toJson(), equals(json));
json = {};
expect(() => BaseAnyOf.fromJson(json), throwsA(isA<DeserializationError>()));
});
} }

228
packages/nextcloud/lib/src/api/core.openapi.dart

@ -4795,6 +4795,18 @@ abstract class AutocompleteResult_Status
static Serializer<AutocompleteResult_Status> get serializer => _$AutocompleteResult_StatusSerializer(); static Serializer<AutocompleteResult_Status> get serializer => _$AutocompleteResult_StatusSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final AutocompleteResult_StatusBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._autocompleteResultStatus0, b._string].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of 'autocompleteResultStatus0', 'string' for ${b._data}");
}
}
} }
class _$AutocompleteResult_StatusSerializer implements PrimitiveSerializer<AutocompleteResult_Status> { class _$AutocompleteResult_StatusSerializer implements PrimitiveSerializer<AutocompleteResult_Status> {
@ -4820,19 +4832,14 @@ class _$AutocompleteResult_StatusSerializer implements PrimitiveSerializer<Autoc
}) { }) {
final result = AutocompleteResult_StatusBuilder()..data = JsonObject(data); final result = AutocompleteResult_StatusBuilder()..data = JsonObject(data);
try { try {
result._autocompleteResultStatus0 = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(AutocompleteResult_Status0))!
data, as AutocompleteResult_Status0;
specifiedType: const FullType(AutocompleteResult_Status0), result.autocompleteResultStatus0.replace(value);
)! as AutocompleteResult_Status0)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._string = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String;
result.string = value;
} catch (_) {} } catch (_) {}
assert(
[result._autocompleteResultStatus0, result._string].where((final x) => x != null).isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -5823,6 +5830,18 @@ abstract class NavigationEntry_Order
static Serializer<NavigationEntry_Order> get serializer => _$NavigationEntry_OrderSerializer(); static Serializer<NavigationEntry_Order> get serializer => _$NavigationEntry_OrderSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final NavigationEntry_OrderBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$int, b._string].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$int', 'string' for ${b._data}");
}
}
} }
class _$NavigationEntry_OrderSerializer implements PrimitiveSerializer<NavigationEntry_Order> { class _$NavigationEntry_OrderSerializer implements PrimitiveSerializer<NavigationEntry_Order> {
@ -5848,12 +5867,13 @@ class _$NavigationEntry_OrderSerializer implements PrimitiveSerializer<Navigatio
}) { }) {
final result = NavigationEntry_OrderBuilder()..data = JsonObject(data); final result = NavigationEntry_OrderBuilder()..data = JsonObject(data);
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._string = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String;
result.string = value;
} catch (_) {} } catch (_) {}
assert([result._$int, result._string].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -7616,6 +7636,34 @@ abstract class OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities
_$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesSerializer(); _$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [
b._commentsCapabilities,
b._davCapabilities,
b._filesCapabilities,
b._filesSharingCapabilities,
b._filesTrashbinCapabilities,
b._filesVersionsCapabilities,
b._notesCapabilities,
b._notificationsCapabilities,
b._provisioningApiCapabilities,
b._sharebymailCapabilities,
b._themingPublicCapabilities,
b._userStatusCapabilities,
b._weatherStatusCapabilities,
].firstWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError(
"Need at least one of 'commentsCapabilities', 'davCapabilities', 'filesCapabilities', 'filesSharingCapabilities', 'filesTrashbinCapabilities', 'filesVersionsCapabilities', 'notesCapabilities', 'notificationsCapabilities', 'provisioningApiCapabilities', 'sharebymailCapabilities', 'themingPublicCapabilities', 'userStatusCapabilities', 'weatherStatusCapabilities' for ${b._data}",
);
}
}
} }
class _$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesSerializer class _$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesSerializer
@ -7645,108 +7693,70 @@ class _$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesSerialize
}) { }) {
final result = OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesBuilder()..data = JsonObject(data); final result = OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesBuilder()..data = JsonObject(data);
try { try {
result._commentsCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(CommentsCapabilities))!
data, as CommentsCapabilities;
specifiedType: const FullType(CommentsCapabilities), result.commentsCapabilities.replace(value);
)! as CommentsCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._davCapabilities = final value =
(_jsonSerializers.deserialize(data, specifiedType: const FullType(DavCapabilities))! as DavCapabilities) _jsonSerializers.deserialize(data, specifiedType: const FullType(DavCapabilities))! as DavCapabilities;
.toBuilder(); result.davCapabilities.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._filesCapabilities = final value =
(_jsonSerializers.deserialize(data, specifiedType: const FullType(FilesCapabilities))! as FilesCapabilities) _jsonSerializers.deserialize(data, specifiedType: const FullType(FilesCapabilities))! as FilesCapabilities;
.toBuilder(); result.filesCapabilities.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._filesSharingCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(FilesSharingCapabilities))!
data, as FilesSharingCapabilities;
specifiedType: const FullType(FilesSharingCapabilities), result.filesSharingCapabilities.replace(value);
)! as FilesSharingCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._filesTrashbinCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(FilesTrashbinCapabilities))!
data, as FilesTrashbinCapabilities;
specifiedType: const FullType(FilesTrashbinCapabilities), result.filesTrashbinCapabilities.replace(value);
)! as FilesTrashbinCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._filesVersionsCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(FilesVersionsCapabilities))!
data, as FilesVersionsCapabilities;
specifiedType: const FullType(FilesVersionsCapabilities), result.filesVersionsCapabilities.replace(value);
)! as FilesVersionsCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._notesCapabilities = final value =
(_jsonSerializers.deserialize(data, specifiedType: const FullType(NotesCapabilities))! as NotesCapabilities) _jsonSerializers.deserialize(data, specifiedType: const FullType(NotesCapabilities))! as NotesCapabilities;
.toBuilder(); result.notesCapabilities.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._notificationsCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(NotificationsCapabilities))!
data, as NotificationsCapabilities;
specifiedType: const FullType(NotificationsCapabilities), result.notificationsCapabilities.replace(value);
)! as NotificationsCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._provisioningApiCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(ProvisioningApiCapabilities))!
data, as ProvisioningApiCapabilities;
specifiedType: const FullType(ProvisioningApiCapabilities), result.provisioningApiCapabilities.replace(value);
)! as ProvisioningApiCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._sharebymailCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(SharebymailCapabilities))!
data, as SharebymailCapabilities;
specifiedType: const FullType(SharebymailCapabilities), result.sharebymailCapabilities.replace(value);
)! as SharebymailCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._themingPublicCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(ThemingPublicCapabilities))!
data, as ThemingPublicCapabilities;
specifiedType: const FullType(ThemingPublicCapabilities), result.themingPublicCapabilities.replace(value);
)! as ThemingPublicCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._userStatusCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(UserStatusCapabilities))!
data, as UserStatusCapabilities;
specifiedType: const FullType(UserStatusCapabilities), result.userStatusCapabilities.replace(value);
)! as UserStatusCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
try { try {
result._weatherStatusCapabilities = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(WeatherStatusCapabilities))!
data, as WeatherStatusCapabilities;
specifiedType: const FullType(WeatherStatusCapabilities), result.weatherStatusCapabilities.replace(value);
)! as WeatherStatusCapabilities)
.toBuilder();
} catch (_) {} } catch (_) {}
assert(
[
result._commentsCapabilities,
result._davCapabilities,
result._filesCapabilities,
result._filesSharingCapabilities,
result._filesTrashbinCapabilities,
result._filesVersionsCapabilities,
result._notesCapabilities,
result._notificationsCapabilities,
result._provisioningApiCapabilities,
result._sharebymailCapabilities,
result._themingPublicCapabilities,
result._userStatusCapabilities,
result._weatherStatusCapabilities,
].where((final x) => x != null).isNotEmpty,
'Need anyOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -9271,6 +9281,18 @@ abstract class UnifiedSearchSearchCursor
static Serializer<UnifiedSearchSearchCursor> get serializer => _$UnifiedSearchSearchCursorSerializer(); static Serializer<UnifiedSearchSearchCursor> get serializer => _$UnifiedSearchSearchCursorSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UnifiedSearchSearchCursorBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$int, b._string].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$int', 'string' for ${b._data}");
}
}
} }
class _$UnifiedSearchSearchCursorSerializer implements PrimitiveSerializer<UnifiedSearchSearchCursor> { class _$UnifiedSearchSearchCursorSerializer implements PrimitiveSerializer<UnifiedSearchSearchCursor> {
@ -9296,12 +9318,13 @@ class _$UnifiedSearchSearchCursorSerializer implements PrimitiveSerializer<Unifi
}) { }) {
final result = UnifiedSearchSearchCursorBuilder()..data = JsonObject(data); final result = UnifiedSearchSearchCursorBuilder()..data = JsonObject(data);
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._string = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String;
result.string = value;
} catch (_) {} } catch (_) {}
assert([result._$int, result._string].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -9368,6 +9391,18 @@ abstract class UnifiedSearchResult_Cursor
static Serializer<UnifiedSearchResult_Cursor> get serializer => _$UnifiedSearchResult_CursorSerializer(); static Serializer<UnifiedSearchResult_Cursor> get serializer => _$UnifiedSearchResult_CursorSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UnifiedSearchResult_CursorBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$int, b._string].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$int', 'string' for ${b._data}");
}
}
} }
class _$UnifiedSearchResult_CursorSerializer implements PrimitiveSerializer<UnifiedSearchResult_Cursor> { class _$UnifiedSearchResult_CursorSerializer implements PrimitiveSerializer<UnifiedSearchResult_Cursor> {
@ -9393,12 +9428,13 @@ class _$UnifiedSearchResult_CursorSerializer implements PrimitiveSerializer<Unif
}) { }) {
final result = UnifiedSearchResult_CursorBuilder()..data = JsonObject(data); final result = UnifiedSearchResult_CursorBuilder()..data = JsonObject(data);
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._string = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String;
result.string = value;
} catch (_) {} } catch (_) {}
assert([result._$int, result._string].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }

5
packages/nextcloud/lib/src/api/core.openapi.g.dart

@ -9394,6 +9394,7 @@ class AutocompleteResult_StatusBuilder
AutocompleteResult_Status build() => _build(); AutocompleteResult_Status build() => _build();
_$AutocompleteResult_Status _build() { _$AutocompleteResult_Status _build() {
AutocompleteResult_Status._validate(this);
_$AutocompleteResult_Status _$result; _$AutocompleteResult_Status _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -13044,6 +13045,7 @@ class NavigationEntry_OrderBuilder
NavigationEntry_Order build() => _build(); NavigationEntry_Order build() => _build();
_$NavigationEntry_Order _build() { _$NavigationEntry_Order _build() {
NavigationEntry_Order._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$NavigationEntry_Order._( _$NavigationEntry_Order._(
data: BuiltValueNullFieldError.checkNotNull(data, r'NavigationEntry_Order', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'NavigationEntry_Order', 'data'),
@ -20172,6 +20174,7 @@ class OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_CapabilitiesBuilder
OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities build() => _build(); OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities build() => _build();
_$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities _build() { _$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities _build() {
OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities._validate(this);
_$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities _$result; _$OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Capabilities _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -26001,6 +26004,7 @@ class UnifiedSearchSearchCursorBuilder
UnifiedSearchSearchCursor build() => _build(); UnifiedSearchSearchCursor build() => _build();
_$UnifiedSearchSearchCursor _build() { _$UnifiedSearchSearchCursor _build() {
UnifiedSearchSearchCursor._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$UnifiedSearchSearchCursor._( _$UnifiedSearchSearchCursor._(
data: BuiltValueNullFieldError.checkNotNull(data, r'UnifiedSearchSearchCursor', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'UnifiedSearchSearchCursor', 'data'),
@ -26319,6 +26323,7 @@ class UnifiedSearchResult_CursorBuilder
UnifiedSearchResult_Cursor build() => _build(); UnifiedSearchResult_Cursor build() => _build();
_$UnifiedSearchResult_Cursor _build() { _$UnifiedSearchResult_Cursor _build() {
UnifiedSearchResult_Cursor._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$UnifiedSearchResult_Cursor._( _$UnifiedSearchResult_Cursor._(
data: BuiltValueNullFieldError.checkNotNull(data, r'UnifiedSearchResult_Cursor', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'UnifiedSearchResult_Cursor', 'data'),

92
packages/nextcloud/lib/src/api/files_sharing.openapi.dart

@ -2919,6 +2919,18 @@ abstract class ShareInfo_Size implements ShareInfo_SizeInterface, Built<ShareInf
static Serializer<ShareInfo_Size> get serializer => _$ShareInfo_SizeSerializer(); static Serializer<ShareInfo_Size> get serializer => _$ShareInfo_SizeSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final ShareInfo_SizeBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$int, b._$double].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$int', '$double' for ${b._data}");
}
}
} }
class _$ShareInfo_SizeSerializer implements PrimitiveSerializer<ShareInfo_Size> { class _$ShareInfo_SizeSerializer implements PrimitiveSerializer<ShareInfo_Size> {
@ -2944,12 +2956,13 @@ class _$ShareInfo_SizeSerializer implements PrimitiveSerializer<ShareInfo_Size>
}) { }) {
final result = ShareInfo_SizeBuilder()..data = JsonObject(data); final result = ShareInfo_SizeBuilder()..data = JsonObject(data);
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._$double = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double;
result.$double = value;
} catch (_) {} } catch (_) {}
assert([result._$int, result._$double].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -3012,6 +3025,18 @@ abstract class Share_ItemSize implements Share_ItemSizeInterface, Built<Share_It
static Serializer<Share_ItemSize> get serializer => _$Share_ItemSizeSerializer(); static Serializer<Share_ItemSize> get serializer => _$Share_ItemSizeSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final Share_ItemSizeBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$double, b._$int].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$double', '$int' for ${b._data}");
}
}
} }
class _$Share_ItemSizeSerializer implements PrimitiveSerializer<Share_ItemSize> { class _$Share_ItemSizeSerializer implements PrimitiveSerializer<Share_ItemSize> {
@ -3037,12 +3062,13 @@ class _$Share_ItemSizeSerializer implements PrimitiveSerializer<Share_ItemSize>
}) { }) {
final result = Share_ItemSizeBuilder()..data = JsonObject(data); final result = Share_ItemSizeBuilder()..data = JsonObject(data);
try { try {
result._$double = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double;
result.$double = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
assert([result._$double, result._$int].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -3697,6 +3723,18 @@ abstract class ShareesapiSearchShareType
static Serializer<ShareesapiSearchShareType> get serializer => _$ShareesapiSearchShareTypeSerializer(); static Serializer<ShareesapiSearchShareType> get serializer => _$ShareesapiSearchShareTypeSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final ShareesapiSearchShareTypeBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$int, b._builtListInt].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$int', 'builtListInt' for ${b._data}");
}
}
} }
class _$ShareesapiSearchShareTypeSerializer implements PrimitiveSerializer<ShareesapiSearchShareType> { class _$ShareesapiSearchShareTypeSerializer implements PrimitiveSerializer<ShareesapiSearchShareType> {
@ -3722,19 +3760,14 @@ class _$ShareesapiSearchShareTypeSerializer implements PrimitiveSerializer<Share
}) { }) {
final result = ShareesapiSearchShareTypeBuilder()..data = JsonObject(data); final result = ShareesapiSearchShareTypeBuilder()..data = JsonObject(data);
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._builtListInt = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BuiltList, [FullType(int)]))!
data, as BuiltList<int>;
specifiedType: const FullType(BuiltList, [FullType(int)]), result.builtListInt.replace(value);
)! as BuiltList<int>)
.toBuilder();
} catch (_) {} } catch (_) {}
assert(
[result._$int, result._builtListInt].where((final x) => x != null).isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -4394,6 +4427,18 @@ abstract class ShareesapiFindRecommendedShareType
_$ShareesapiFindRecommendedShareTypeSerializer(); _$ShareesapiFindRecommendedShareTypeSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final ShareesapiFindRecommendedShareTypeBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$int, b._builtListInt].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$int', 'builtListInt' for ${b._data}");
}
}
} }
class _$ShareesapiFindRecommendedShareTypeSerializer class _$ShareesapiFindRecommendedShareTypeSerializer
@ -4420,19 +4465,14 @@ class _$ShareesapiFindRecommendedShareTypeSerializer
}) { }) {
final result = ShareesapiFindRecommendedShareTypeBuilder()..data = JsonObject(data); final result = ShareesapiFindRecommendedShareTypeBuilder()..data = JsonObject(data);
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._builtListInt = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(BuiltList, [FullType(int)]))!
data, as BuiltList<int>;
specifiedType: const FullType(BuiltList, [FullType(int)]), result.builtListInt.replace(value);
)! as BuiltList<int>)
.toBuilder();
} catch (_) {} } catch (_) {}
assert(
[result._$int, result._builtListInt].where((final x) => x != null).isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }

4
packages/nextcloud/lib/src/api/files_sharing.openapi.g.dart

@ -7453,6 +7453,7 @@ class ShareInfo_SizeBuilder implements Builder<ShareInfo_Size, ShareInfo_SizeBui
ShareInfo_Size build() => _build(); ShareInfo_Size build() => _build();
_$ShareInfo_Size _build() { _$ShareInfo_Size _build() {
ShareInfo_Size._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$ShareInfo_Size._( _$ShareInfo_Size._(
data: BuiltValueNullFieldError.checkNotNull(data, r'ShareInfo_Size', 'data'), $int: $int, $double: $double); data: BuiltValueNullFieldError.checkNotNull(data, r'ShareInfo_Size', 'data'), $int: $int, $double: $double);
@ -7809,6 +7810,7 @@ class Share_ItemSizeBuilder implements Builder<Share_ItemSize, Share_ItemSizeBui
Share_ItemSize build() => _build(); Share_ItemSize build() => _build();
_$Share_ItemSize _build() { _$Share_ItemSize _build() {
Share_ItemSize._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$Share_ItemSize._( _$Share_ItemSize._(
data: BuiltValueNullFieldError.checkNotNull(data, r'Share_ItemSize', 'data'), $double: $double, $int: $int); data: BuiltValueNullFieldError.checkNotNull(data, r'Share_ItemSize', 'data'), $double: $double, $int: $int);
@ -10573,6 +10575,7 @@ class ShareesapiSearchShareTypeBuilder
ShareesapiSearchShareType build() => _build(); ShareesapiSearchShareType build() => _build();
_$ShareesapiSearchShareType _build() { _$ShareesapiSearchShareType _build() {
ShareesapiSearchShareType._validate(this);
_$ShareesapiSearchShareType _$result; _$ShareesapiSearchShareType _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -13812,6 +13815,7 @@ class ShareesapiFindRecommendedShareTypeBuilder
ShareesapiFindRecommendedShareType build() => _build(); ShareesapiFindRecommendedShareType build() => _build();
_$ShareesapiFindRecommendedShareType _build() { _$ShareesapiFindRecommendedShareType _build() {
ShareesapiFindRecommendedShareType._validate(this);
_$ShareesapiFindRecommendedShareType _$result; _$ShareesapiFindRecommendedShareType _$result;
try { try {
_$result = _$v ?? _$result = _$v ??

232
packages/nextcloud/lib/src/api/provisioning_api.openapi.dart

@ -5340,6 +5340,18 @@ abstract class GroupDetails_Usercount
static Serializer<GroupDetails_Usercount> get serializer => _$GroupDetails_UsercountSerializer(); static Serializer<GroupDetails_Usercount> get serializer => _$GroupDetails_UsercountSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final GroupDetails_UsercountBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$bool, b._$int].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$bool', '$int' for ${b._data}");
}
}
} }
class _$GroupDetails_UsercountSerializer implements PrimitiveSerializer<GroupDetails_Usercount> { class _$GroupDetails_UsercountSerializer implements PrimitiveSerializer<GroupDetails_Usercount> {
@ -5365,12 +5377,13 @@ class _$GroupDetails_UsercountSerializer implements PrimitiveSerializer<GroupDet
}) { }) {
final result = GroupDetails_UsercountBuilder()..data = JsonObject(data); final result = GroupDetails_UsercountBuilder()..data = JsonObject(data);
try { try {
result._$bool = _jsonSerializers.deserialize(data, specifiedType: const FullType(bool))! as bool; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(bool))! as bool;
result.$bool = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
assert([result._$bool, result._$int].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -5402,6 +5415,18 @@ abstract class GroupDetails_Disabled
static Serializer<GroupDetails_Disabled> get serializer => _$GroupDetails_DisabledSerializer(); static Serializer<GroupDetails_Disabled> get serializer => _$GroupDetails_DisabledSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final GroupDetails_DisabledBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$bool, b._$int].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$bool', '$int' for ${b._data}");
}
}
} }
class _$GroupDetails_DisabledSerializer implements PrimitiveSerializer<GroupDetails_Disabled> { class _$GroupDetails_DisabledSerializer implements PrimitiveSerializer<GroupDetails_Disabled> {
@ -5427,12 +5452,13 @@ class _$GroupDetails_DisabledSerializer implements PrimitiveSerializer<GroupDeta
}) { }) {
final result = GroupDetails_DisabledBuilder()..data = JsonObject(data); final result = GroupDetails_DisabledBuilder()..data = JsonObject(data);
try { try {
result._$bool = _jsonSerializers.deserialize(data, specifiedType: const FullType(bool))! as bool; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(bool))! as bool;
result.$bool = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
assert([result._$bool, result._$int].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -5706,6 +5732,18 @@ abstract class UserDetailsQuota_Free
static Serializer<UserDetailsQuota_Free> get serializer => _$UserDetailsQuota_FreeSerializer(); static Serializer<UserDetailsQuota_Free> get serializer => _$UserDetailsQuota_FreeSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UserDetailsQuota_FreeBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$double, b._$int].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$double', '$int' for ${b._data}");
}
}
} }
class _$UserDetailsQuota_FreeSerializer implements PrimitiveSerializer<UserDetailsQuota_Free> { class _$UserDetailsQuota_FreeSerializer implements PrimitiveSerializer<UserDetailsQuota_Free> {
@ -5731,12 +5769,13 @@ class _$UserDetailsQuota_FreeSerializer implements PrimitiveSerializer<UserDetai
}) { }) {
final result = UserDetailsQuota_FreeBuilder()..data = JsonObject(data); final result = UserDetailsQuota_FreeBuilder()..data = JsonObject(data);
try { try {
result._$double = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double;
result.$double = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
assert([result._$double, result._$int].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -5769,6 +5808,18 @@ abstract class UserDetailsQuota_Quota
static Serializer<UserDetailsQuota_Quota> get serializer => _$UserDetailsQuota_QuotaSerializer(); static Serializer<UserDetailsQuota_Quota> get serializer => _$UserDetailsQuota_QuotaSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UserDetailsQuota_QuotaBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$double, b._$int, b._string].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$double', '$int', 'string' for ${b._data}");
}
}
} }
class _$UserDetailsQuota_QuotaSerializer implements PrimitiveSerializer<UserDetailsQuota_Quota> { class _$UserDetailsQuota_QuotaSerializer implements PrimitiveSerializer<UserDetailsQuota_Quota> {
@ -5794,18 +5845,17 @@ class _$UserDetailsQuota_QuotaSerializer implements PrimitiveSerializer<UserDeta
}) { }) {
final result = UserDetailsQuota_QuotaBuilder()..data = JsonObject(data); final result = UserDetailsQuota_QuotaBuilder()..data = JsonObject(data);
try { try {
result._$double = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double;
result.$double = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._string = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(String))! as String;
result.string = value;
} catch (_) {} } catch (_) {}
assert(
[result._$double, result._$int, result._string].where((final x) => x != null).isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -5838,6 +5888,18 @@ abstract class UserDetailsQuota_Relative
static Serializer<UserDetailsQuota_Relative> get serializer => _$UserDetailsQuota_RelativeSerializer(); static Serializer<UserDetailsQuota_Relative> get serializer => _$UserDetailsQuota_RelativeSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UserDetailsQuota_RelativeBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$double, b._$int].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$double', '$int' for ${b._data}");
}
}
} }
class _$UserDetailsQuota_RelativeSerializer implements PrimitiveSerializer<UserDetailsQuota_Relative> { class _$UserDetailsQuota_RelativeSerializer implements PrimitiveSerializer<UserDetailsQuota_Relative> {
@ -5863,12 +5925,13 @@ class _$UserDetailsQuota_RelativeSerializer implements PrimitiveSerializer<UserD
}) { }) {
final result = UserDetailsQuota_RelativeBuilder()..data = JsonObject(data); final result = UserDetailsQuota_RelativeBuilder()..data = JsonObject(data);
try { try {
result._$double = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double;
result.$double = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
assert([result._$double, result._$int].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -5900,6 +5963,18 @@ abstract class UserDetailsQuota_Total
static Serializer<UserDetailsQuota_Total> get serializer => _$UserDetailsQuota_TotalSerializer(); static Serializer<UserDetailsQuota_Total> get serializer => _$UserDetailsQuota_TotalSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UserDetailsQuota_TotalBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$double, b._$int].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$double', '$int' for ${b._data}");
}
}
} }
class _$UserDetailsQuota_TotalSerializer implements PrimitiveSerializer<UserDetailsQuota_Total> { class _$UserDetailsQuota_TotalSerializer implements PrimitiveSerializer<UserDetailsQuota_Total> {
@ -5925,12 +6000,13 @@ class _$UserDetailsQuota_TotalSerializer implements PrimitiveSerializer<UserDeta
}) { }) {
final result = UserDetailsQuota_TotalBuilder()..data = JsonObject(data); final result = UserDetailsQuota_TotalBuilder()..data = JsonObject(data);
try { try {
result._$double = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double;
result.$double = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
assert([result._$double, result._$int].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -5962,6 +6038,18 @@ abstract class UserDetailsQuota_Used
static Serializer<UserDetailsQuota_Used> get serializer => _$UserDetailsQuota_UsedSerializer(); static Serializer<UserDetailsQuota_Used> get serializer => _$UserDetailsQuota_UsedSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UserDetailsQuota_UsedBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$double, b._$int].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$double', '$int' for ${b._data}");
}
}
} }
class _$UserDetailsQuota_UsedSerializer implements PrimitiveSerializer<UserDetailsQuota_Used> { class _$UserDetailsQuota_UsedSerializer implements PrimitiveSerializer<UserDetailsQuota_Used> {
@ -5987,12 +6075,13 @@ class _$UserDetailsQuota_UsedSerializer implements PrimitiveSerializer<UserDetai
}) { }) {
final result = UserDetailsQuota_UsedBuilder()..data = JsonObject(data); final result = UserDetailsQuota_UsedBuilder()..data = JsonObject(data);
try { try {
result._$double = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(double))! as double;
result.$double = value;
} catch (_) {} } catch (_) {}
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
assert([result._$double, result._$int].where((final x) => x != null).isNotEmpty, 'Need oneOf for ${result._data}');
return result.build(); return result.build();
} }
} }
@ -6159,6 +6248,21 @@ abstract class GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users
_$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer(); _$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._userDetails, b._groupsGetGroupUsersDetailsResponseApplicationJsonOcsDataUsers1]
.singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError(
"Need exactly one of 'userDetails', 'groupsGetGroupUsersDetailsResponseApplicationJsonOcsDataUsers1' for ${b._data}",
);
}
}
} }
class _$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer class _$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer
@ -6188,22 +6292,16 @@ class _$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializ
}) { }) {
final result = GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder()..data = JsonObject(data); final result = GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder()..data = JsonObject(data);
try { try {
result._userDetails = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(UserDetails))! as UserDetails;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(UserDetails))! as UserDetails).toBuilder(); result.userDetails.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._groupsGetGroupUsersDetailsResponseApplicationJsonOcsDataUsers1 = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(
data, data,
specifiedType: const FullType(GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users1), specifiedType: const FullType(GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users1),
)! as GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users1) )! as GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users1;
.toBuilder(); result.groupsGetGroupUsersDetailsResponseApplicationJsonOcsDataUsers1.replace(value);
} catch (_) {} } catch (_) {}
assert(
[result._userDetails, result._groupsGetGroupUsersDetailsResponseApplicationJsonOcsDataUsers1]
.where((final x) => x != null)
.isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -7074,6 +7172,21 @@ abstract class UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users
_$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer(); _$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._userDetails, b._usersGetUsersDetailsResponseApplicationJsonOcsDataUsers1]
.singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError(
"Need exactly one of 'userDetails', 'usersGetUsersDetailsResponseApplicationJsonOcsDataUsers1' for ${b._data}",
);
}
}
} }
class _$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer class _$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer
@ -7103,22 +7216,16 @@ class _$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer
}) { }) {
final result = UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder()..data = JsonObject(data); final result = UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder()..data = JsonObject(data);
try { try {
result._userDetails = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(UserDetails))! as UserDetails;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(UserDetails))! as UserDetails).toBuilder(); result.userDetails.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._usersGetUsersDetailsResponseApplicationJsonOcsDataUsers1 = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(
data, data,
specifiedType: const FullType(UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users1), specifiedType: const FullType(UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users1),
)! as UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users1) )! as UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users1;
.toBuilder(); result.usersGetUsersDetailsResponseApplicationJsonOcsDataUsers1.replace(value);
} catch (_) {} } catch (_) {}
assert(
[result._userDetails, result._usersGetUsersDetailsResponseApplicationJsonOcsDataUsers1]
.where((final x) => x != null)
.isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -7284,6 +7391,21 @@ abstract class UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_User
_$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer(); _$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._userDetails, b._usersGetDisabledUsersDetailsResponseApplicationJsonOcsDataUsers1]
.singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError(
"Need exactly one of 'userDetails', 'usersGetDisabledUsersDetailsResponseApplicationJsonOcsDataUsers1' for ${b._data}",
);
}
}
} }
class _$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer class _$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerializer
@ -7313,22 +7435,16 @@ class _$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersSerial
}) { }) {
final result = UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder()..data = JsonObject(data); final result = UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder()..data = JsonObject(data);
try { try {
result._userDetails = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(UserDetails))! as UserDetails;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(UserDetails))! as UserDetails).toBuilder(); result.userDetails.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._usersGetDisabledUsersDetailsResponseApplicationJsonOcsDataUsers1 = (_jsonSerializers.deserialize( final value = _jsonSerializers.deserialize(
data, data,
specifiedType: const FullType(UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users1), specifiedType: const FullType(UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users1),
)! as UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users1) )! as UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users1;
.toBuilder(); result.usersGetDisabledUsersDetailsResponseApplicationJsonOcsDataUsers1.replace(value);
} catch (_) {} } catch (_) {}
assert(
[result._userDetails, result._usersGetDisabledUsersDetailsResponseApplicationJsonOcsDataUsers1]
.where((final x) => x != null)
.isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }

10
packages/nextcloud/lib/src/api/provisioning_api.openapi.g.dart

@ -9943,6 +9943,7 @@ class GroupDetails_UsercountBuilder
GroupDetails_Usercount build() => _build(); GroupDetails_Usercount build() => _build();
_$GroupDetails_Usercount _build() { _$GroupDetails_Usercount _build() {
GroupDetails_Usercount._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$GroupDetails_Usercount._( _$GroupDetails_Usercount._(
data: BuiltValueNullFieldError.checkNotNull(data, r'GroupDetails_Usercount', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'GroupDetails_Usercount', 'data'),
@ -10055,6 +10056,7 @@ class GroupDetails_DisabledBuilder
GroupDetails_Disabled build() => _build(); GroupDetails_Disabled build() => _build();
_$GroupDetails_Disabled _build() { _$GroupDetails_Disabled _build() {
GroupDetails_Disabled._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$GroupDetails_Disabled._( _$GroupDetails_Disabled._(
data: BuiltValueNullFieldError.checkNotNull(data, r'GroupDetails_Disabled', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'GroupDetails_Disabled', 'data'),
@ -11122,6 +11124,7 @@ class UserDetailsQuota_FreeBuilder
UserDetailsQuota_Free build() => _build(); UserDetailsQuota_Free build() => _build();
_$UserDetailsQuota_Free _build() { _$UserDetailsQuota_Free _build() {
UserDetailsQuota_Free._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$UserDetailsQuota_Free._( _$UserDetailsQuota_Free._(
data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Free', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Free', 'data'),
@ -11250,6 +11253,7 @@ class UserDetailsQuota_QuotaBuilder
UserDetailsQuota_Quota build() => _build(); UserDetailsQuota_Quota build() => _build();
_$UserDetailsQuota_Quota _build() { _$UserDetailsQuota_Quota _build() {
UserDetailsQuota_Quota._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$UserDetailsQuota_Quota._( _$UserDetailsQuota_Quota._(
data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Quota', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Quota', 'data'),
@ -11365,6 +11369,7 @@ class UserDetailsQuota_RelativeBuilder
UserDetailsQuota_Relative build() => _build(); UserDetailsQuota_Relative build() => _build();
_$UserDetailsQuota_Relative _build() { _$UserDetailsQuota_Relative _build() {
UserDetailsQuota_Relative._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$UserDetailsQuota_Relative._( _$UserDetailsQuota_Relative._(
data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Relative', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Relative', 'data'),
@ -11477,6 +11482,7 @@ class UserDetailsQuota_TotalBuilder
UserDetailsQuota_Total build() => _build(); UserDetailsQuota_Total build() => _build();
_$UserDetailsQuota_Total _build() { _$UserDetailsQuota_Total _build() {
UserDetailsQuota_Total._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$UserDetailsQuota_Total._( _$UserDetailsQuota_Total._(
data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Total', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Total', 'data'),
@ -11589,6 +11595,7 @@ class UserDetailsQuota_UsedBuilder
UserDetailsQuota_Used build() => _build(); UserDetailsQuota_Used build() => _build();
_$UserDetailsQuota_Used _build() { _$UserDetailsQuota_Used _build() {
UserDetailsQuota_Used._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$UserDetailsQuota_Used._( _$UserDetailsQuota_Used._(
data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Used', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'UserDetailsQuota_Used', 'data'),
@ -12731,6 +12738,7 @@ class GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder
GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users build() => _build(); GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users build() => _build();
_$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users _build() { _$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users _build() {
GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users._validate(this);
_$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users _$result; _$GroupsGetGroupUsersDetailsResponseApplicationJson_Ocs_Data_Users _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -15895,6 +15903,7 @@ class UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder
UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users build() => _build(); UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users build() => _build();
_$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users _build() { _$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users _build() {
UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users._validate(this);
_$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users _$result; _$UsersGetUsersDetailsResponseApplicationJson_Ocs_Data_Users _$result;
try { try {
_$result = _$v ?? _$result = _$v ??
@ -16485,6 +16494,7 @@ class UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_UsersBuilder
UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users build() => _build(); UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users build() => _build();
_$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users _build() { _$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users _build() {
UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users._validate(this);
_$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users _$result; _$UsersGetDisabledUsersDetailsResponseApplicationJson_Ocs_Data_Users _$result;
try { try {
_$result = _$v ?? _$result = _$v ??

45
packages/nextcloud/lib/src/api/user_status.openapi.dart

@ -1194,6 +1194,18 @@ abstract class ClearAt_Time implements ClearAt_TimeInterface, Built<ClearAt_Time
static Serializer<ClearAt_Time> get serializer => _$ClearAt_TimeSerializer(); static Serializer<ClearAt_Time> get serializer => _$ClearAt_TimeSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final ClearAt_TimeBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._$int, b._clearAtTimeType].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of '$int', 'clearAtTimeType' for ${b._data}");
}
}
} }
class _$ClearAt_TimeSerializer implements PrimitiveSerializer<ClearAt_Time> { class _$ClearAt_TimeSerializer implements PrimitiveSerializer<ClearAt_Time> {
@ -1219,16 +1231,14 @@ class _$ClearAt_TimeSerializer implements PrimitiveSerializer<ClearAt_Time> {
}) { }) {
final result = ClearAt_TimeBuilder()..data = JsonObject(data); final result = ClearAt_TimeBuilder()..data = JsonObject(data);
try { try {
result._$int = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(int))! as int;
result.$int = value;
} catch (_) {} } catch (_) {}
try { try {
result._clearAtTimeType = final value =
_jsonSerializers.deserialize(data, specifiedType: const FullType(ClearAtTimeType))! as ClearAtTimeType; _jsonSerializers.deserialize(data, specifiedType: const FullType(ClearAtTimeType))! as ClearAtTimeType;
result.clearAtTimeType = value;
} catch (_) {} } catch (_) {}
assert(
[result._$int, result._clearAtTimeType].where((final x) => x != null).isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }
@ -1810,6 +1820,18 @@ abstract class UserStatusRevertStatusResponseApplicationJson_Ocs_Data
_$UserStatusRevertStatusResponseApplicationJson_Ocs_DataSerializer(); _$UserStatusRevertStatusResponseApplicationJson_Ocs_DataSerializer();
JsonObject get data; JsonObject get data;
@BuiltValueHook(finalizeBuilder: true)
static void _validate(final UserStatusRevertStatusResponseApplicationJson_Ocs_DataBuilder b) {
// When this is rebuild from another builder
if (b._data == null) {
return;
}
final match = [b._private, b._jsonObject].singleWhereOrNull((final x) => x != null);
if (match == null) {
throw StateError("Need exactly one of 'private', 'jsonObject' for ${b._data}");
}
}
} }
class _$UserStatusRevertStatusResponseApplicationJson_Ocs_DataSerializer class _$UserStatusRevertStatusResponseApplicationJson_Ocs_DataSerializer
@ -1839,16 +1861,13 @@ class _$UserStatusRevertStatusResponseApplicationJson_Ocs_DataSerializer
}) { }) {
final result = UserStatusRevertStatusResponseApplicationJson_Ocs_DataBuilder()..data = JsonObject(data); final result = UserStatusRevertStatusResponseApplicationJson_Ocs_DataBuilder()..data = JsonObject(data);
try { try {
result._private = final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(Private))! as Private;
(_jsonSerializers.deserialize(data, specifiedType: const FullType(Private))! as Private).toBuilder(); result.private.replace(value);
} catch (_) {} } catch (_) {}
try { try {
result._jsonObject = _jsonSerializers.deserialize(data, specifiedType: const FullType(JsonObject))! as JsonObject; final value = _jsonSerializers.deserialize(data, specifiedType: const FullType(JsonObject))! as JsonObject;
result.jsonObject = value;
} catch (_) {} } catch (_) {}
assert(
[result._private, result._jsonObject].where((final x) => x != null).isNotEmpty,
'Need oneOf for ${result._data}',
);
return result.build(); return result.build();
} }
} }

2
packages/nextcloud/lib/src/api/user_status.openapi.g.dart

@ -2308,6 +2308,7 @@ class ClearAt_TimeBuilder implements Builder<ClearAt_Time, ClearAt_TimeBuilder>,
ClearAt_Time build() => _build(); ClearAt_Time build() => _build();
_$ClearAt_Time _build() { _$ClearAt_Time _build() {
ClearAt_Time._validate(this);
final _$result = _$v ?? final _$result = _$v ??
_$ClearAt_Time._( _$ClearAt_Time._(
data: BuiltValueNullFieldError.checkNotNull(data, r'ClearAt_Time', 'data'), data: BuiltValueNullFieldError.checkNotNull(data, r'ClearAt_Time', 'data'),
@ -4498,6 +4499,7 @@ class UserStatusRevertStatusResponseApplicationJson_Ocs_DataBuilder
UserStatusRevertStatusResponseApplicationJson_Ocs_Data build() => _build(); UserStatusRevertStatusResponseApplicationJson_Ocs_Data build() => _build();
_$UserStatusRevertStatusResponseApplicationJson_Ocs_Data _build() { _$UserStatusRevertStatusResponseApplicationJson_Ocs_Data _build() {
UserStatusRevertStatusResponseApplicationJson_Ocs_Data._validate(this);
_$UserStatusRevertStatusResponseApplicationJson_Ocs_Data _$result; _$UserStatusRevertStatusResponseApplicationJson_Ocs_Data _$result;
try { try {
_$result = _$v ?? _$result = _$v ??

Loading…
Cancel
Save