Nikolas Rimikis
1 year ago
committed by
GitHub
12 changed files with 2447 additions and 0 deletions
@ -0,0 +1,4 @@
|
||||
# Dynamite end to end test |
||||
|
||||
This package contains OpenAPI specs to test the [dynamite](../dynamite) generator. |
||||
This package is not meant for publishing. |
@ -0,0 +1 @@
|
||||
include: package:neon_lints/dart.yaml |
@ -0,0 +1,8 @@
|
||||
#!/bin/bash |
||||
set -euxo pipefail |
||||
|
||||
( |
||||
fvm dart pub run build_runner build --delete-conflicting-outputs |
||||
fvm dart fix --apply lib/ |
||||
melos run format |
||||
) |
@ -0,0 +1,527 @@
|
||||
// ignore_for_file: camel_case_types |
||||
// ignore_for_file: discarded_futures |
||||
// ignore_for_file: public_member_api_docs |
||||
// ignore_for_file: unreachable_switch_case |
||||
|
||||
import 'package:built_value/built_value.dart'; |
||||
import 'package:built_value/json_object.dart'; |
||||
import 'package:built_value/serializer.dart'; |
||||
import 'package:built_value/standard_json_plugin.dart'; |
||||
import 'package:dynamite_runtime/content_string.dart'; |
||||
import 'package:dynamite_runtime/http_client.dart'; |
||||
|
||||
part 'nested_ofs.openapi.g.dart'; |
||||
|
||||
class Client extends DynamiteClient { |
||||
Client( |
||||
super.baseURL, { |
||||
super.baseHeaders, |
||||
super.userAgent, |
||||
super.httpClient, |
||||
super.cookieJar, |
||||
}); |
||||
|
||||
Client.fromClient(final DynamiteClient client) |
||||
: super( |
||||
client.baseURL, |
||||
baseHeaders: client.baseHeaders, |
||||
httpClient: client.httpClient, |
||||
cookieJar: client.cookieJar, |
||||
authentications: client.authentications, |
||||
); |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseInterface { |
||||
String? get attribute; |
||||
} |
||||
|
||||
abstract class Base implements BaseInterface, Built<Base, BaseBuilder> { |
||||
factory Base([final void Function(BaseBuilder)? b]) = _$Base; |
||||
|
||||
// coverage:ignore-start |
||||
const Base._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory Base.fromJson(final Map<String, dynamic> json) => _jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
static Serializer<Base> get serializer => _$baseSerializer; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseAllOf_1Interface { |
||||
@BuiltValueField(wireName: 'attribute-allOf') |
||||
String? get attributeAllOf; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseAllOfInterface implements BaseInterface, BaseAllOf_1Interface {} |
||||
|
||||
abstract class BaseAllOf implements BaseAllOfInterface, Built<BaseAllOf, BaseAllOfBuilder> { |
||||
factory BaseAllOf([final void Function(BaseAllOfBuilder)? b]) = _$BaseAllOf; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseAllOf._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseAllOf.fromJson(final Map<String, dynamic> json) => _jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
static Serializer<BaseAllOf> get serializer => _$baseAllOfSerializer; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseOneOf1Interface { |
||||
@BuiltValueField(wireName: 'attribute-oneOf') |
||||
String? get attributeOneOf; |
||||
} |
||||
|
||||
abstract class BaseOneOf1 implements BaseOneOf1Interface, Built<BaseOneOf1, BaseOneOf1Builder> { |
||||
factory BaseOneOf1([final void Function(BaseOneOf1Builder)? b]) = _$BaseOneOf1; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseOneOf1._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseOneOf1.fromJson(final Map<String, dynamic> json) => _jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
static Serializer<BaseOneOf1> get serializer => _$baseOneOf1Serializer; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseOneOfInterface { |
||||
Base? get base; |
||||
BaseOneOf1? get baseOneOf1; |
||||
} |
||||
|
||||
abstract class BaseOneOf implements BaseOneOfInterface, Built<BaseOneOf, BaseOneOfBuilder> { |
||||
factory BaseOneOf([final void Function(BaseOneOfBuilder)? b]) = _$BaseOneOf; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseOneOf._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseOneOf.fromJson(final Map<String, dynamic> json) => _jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
@BuiltValueSerializer(custom: true) |
||||
static Serializer<BaseOneOf> get serializer => _$BaseOneOfSerializer(); |
||||
|
||||
JsonObject get data; |
||||
} |
||||
|
||||
class _$BaseOneOfSerializer implements PrimitiveSerializer<BaseOneOf> { |
||||
@override |
||||
final Iterable<Type> types = const [BaseOneOf, _$BaseOneOf]; |
||||
|
||||
@override |
||||
final String wireName = 'BaseOneOf'; |
||||
|
||||
@override |
||||
Object serialize( |
||||
final Serializers serializers, |
||||
final BaseOneOf object, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) => |
||||
object.data.value; |
||||
|
||||
@override |
||||
BaseOneOf deserialize( |
||||
final Serializers serializers, |
||||
final Object data, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) { |
||||
final result = BaseOneOfBuilder()..data = JsonObject(data); |
||||
try { |
||||
result._base = (_jsonSerializers.deserialize(data, specifiedType: const FullType(Base))! as Base).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseOneOf1 = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf1))! as BaseOneOf1).toBuilder(); |
||||
} catch (_) {} |
||||
assert( |
||||
[result._base, result._baseOneOf1].where((final x) => x != null).isNotEmpty, |
||||
'Need oneOf for ${result._data}', |
||||
); |
||||
return result.build(); |
||||
} |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseAnyOf1Interface { |
||||
@BuiltValueField(wireName: 'attribute-anyOf') |
||||
String? get attributeAnyOf; |
||||
} |
||||
|
||||
abstract class BaseAnyOf1 implements BaseAnyOf1Interface, Built<BaseAnyOf1, BaseAnyOf1Builder> { |
||||
factory BaseAnyOf1([final void Function(BaseAnyOf1Builder)? b]) = _$BaseAnyOf1; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseAnyOf1._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseAnyOf1.fromJson(final Map<String, dynamic> json) => _jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
static Serializer<BaseAnyOf1> get serializer => _$baseAnyOf1Serializer; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseAnyOfInterface { |
||||
Base? get base; |
||||
BaseAnyOf1? get baseAnyOf1; |
||||
} |
||||
|
||||
abstract class BaseAnyOf implements BaseAnyOfInterface, Built<BaseAnyOf, BaseAnyOfBuilder> { |
||||
factory BaseAnyOf([final void Function(BaseAnyOfBuilder)? b]) = _$BaseAnyOf; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseAnyOf._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseAnyOf.fromJson(final Map<String, dynamic> json) => _jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
@BuiltValueSerializer(custom: true) |
||||
static Serializer<BaseAnyOf> get serializer => _$BaseAnyOfSerializer(); |
||||
|
||||
JsonObject get data; |
||||
} |
||||
|
||||
class _$BaseAnyOfSerializer implements PrimitiveSerializer<BaseAnyOf> { |
||||
@override |
||||
final Iterable<Type> types = const [BaseAnyOf, _$BaseAnyOf]; |
||||
|
||||
@override |
||||
final String wireName = 'BaseAnyOf'; |
||||
|
||||
@override |
||||
Object serialize( |
||||
final Serializers serializers, |
||||
final BaseAnyOf object, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) => |
||||
object.data.value; |
||||
|
||||
@override |
||||
BaseAnyOf deserialize( |
||||
final Serializers serializers, |
||||
final Object data, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) { |
||||
final result = BaseAnyOfBuilder()..data = JsonObject(data); |
||||
try { |
||||
result._base = (_jsonSerializers.deserialize(data, specifiedType: const FullType(Base))! as Base).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseAnyOf1 = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf1))! as BaseAnyOf1).toBuilder(); |
||||
} catch (_) {} |
||||
assert( |
||||
[result._base, result._baseAnyOf1].where((final x) => x != null).isNotEmpty, |
||||
'Need anyOf for ${result._data}', |
||||
); |
||||
return result.build(); |
||||
} |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseNestedAllOf_3Interface { |
||||
@BuiltValueField(wireName: 'attribute-nested-allOf') |
||||
String? get attributeNestedAllOf; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseNestedAllOfInterface |
||||
implements BaseAllOfInterface, BaseOneOfInterface, BaseAnyOfInterface, BaseNestedAllOf_3Interface {} |
||||
|
||||
abstract class BaseNestedAllOf implements BaseNestedAllOfInterface, Built<BaseNestedAllOf, BaseNestedAllOfBuilder> { |
||||
factory BaseNestedAllOf([final void Function(BaseNestedAllOfBuilder)? b]) = _$BaseNestedAllOf; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseNestedAllOf._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseNestedAllOf.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
static Serializer<BaseNestedAllOf> get serializer => _$baseNestedAllOfSerializer; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseNestedOneOf3Interface { |
||||
@BuiltValueField(wireName: 'attribute-nested-oneOf') |
||||
String? get attributeNestedOneOf; |
||||
} |
||||
|
||||
abstract class BaseNestedOneOf3 implements BaseNestedOneOf3Interface, Built<BaseNestedOneOf3, BaseNestedOneOf3Builder> { |
||||
factory BaseNestedOneOf3([final void Function(BaseNestedOneOf3Builder)? b]) = _$BaseNestedOneOf3; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseNestedOneOf3._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseNestedOneOf3.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
static Serializer<BaseNestedOneOf3> get serializer => _$baseNestedOneOf3Serializer; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseNestedOneOfInterface { |
||||
BaseAllOf? get baseAllOf; |
||||
BaseOneOf? get baseOneOf; |
||||
BaseAnyOf? get baseAnyOf; |
||||
BaseNestedOneOf3? get baseNestedOneOf3; |
||||
} |
||||
|
||||
abstract class BaseNestedOneOf implements BaseNestedOneOfInterface, Built<BaseNestedOneOf, BaseNestedOneOfBuilder> { |
||||
factory BaseNestedOneOf([final void Function(BaseNestedOneOfBuilder)? b]) = _$BaseNestedOneOf; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseNestedOneOf._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseNestedOneOf.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
@BuiltValueSerializer(custom: true) |
||||
static Serializer<BaseNestedOneOf> get serializer => _$BaseNestedOneOfSerializer(); |
||||
|
||||
JsonObject get data; |
||||
} |
||||
|
||||
class _$BaseNestedOneOfSerializer implements PrimitiveSerializer<BaseNestedOneOf> { |
||||
@override |
||||
final Iterable<Type> types = const [BaseNestedOneOf, _$BaseNestedOneOf]; |
||||
|
||||
@override |
||||
final String wireName = 'BaseNestedOneOf'; |
||||
|
||||
@override |
||||
Object serialize( |
||||
final Serializers serializers, |
||||
final BaseNestedOneOf object, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) => |
||||
object.data.value; |
||||
|
||||
@override |
||||
BaseNestedOneOf deserialize( |
||||
final Serializers serializers, |
||||
final Object data, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) { |
||||
final result = BaseNestedOneOfBuilder()..data = JsonObject(data); |
||||
try { |
||||
result._baseAllOf = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAllOf))! as BaseAllOf).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseOneOf = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf))! as BaseOneOf).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseAnyOf = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf))! as BaseAnyOf).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseNestedOneOf3 = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseNestedOneOf3))! as BaseNestedOneOf3) |
||||
.toBuilder(); |
||||
} catch (_) {} |
||||
assert( |
||||
[result._baseAllOf, result._baseOneOf, result._baseAnyOf, result._baseNestedOneOf3] |
||||
.where((final x) => x != null) |
||||
.isNotEmpty, |
||||
'Need oneOf for ${result._data}', |
||||
); |
||||
return result.build(); |
||||
} |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseNestedAnyOf3Interface { |
||||
@BuiltValueField(wireName: 'attribute-nested-anyOf') |
||||
String? get attributeNestedAnyOf; |
||||
} |
||||
|
||||
abstract class BaseNestedAnyOf3 implements BaseNestedAnyOf3Interface, Built<BaseNestedAnyOf3, BaseNestedAnyOf3Builder> { |
||||
factory BaseNestedAnyOf3([final void Function(BaseNestedAnyOf3Builder)? b]) = _$BaseNestedAnyOf3; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseNestedAnyOf3._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseNestedAnyOf3.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
static Serializer<BaseNestedAnyOf3> get serializer => _$baseNestedAnyOf3Serializer; |
||||
} |
||||
|
||||
@BuiltValue(instantiable: false) |
||||
abstract interface class BaseNestedAnyOfInterface { |
||||
BaseAllOf? get baseAllOf; |
||||
BaseOneOf? get baseOneOf; |
||||
BaseAnyOf? get baseAnyOf; |
||||
BaseNestedAnyOf3? get baseNestedAnyOf3; |
||||
} |
||||
|
||||
abstract class BaseNestedAnyOf implements BaseNestedAnyOfInterface, Built<BaseNestedAnyOf, BaseNestedAnyOfBuilder> { |
||||
factory BaseNestedAnyOf([final void Function(BaseNestedAnyOfBuilder)? b]) = _$BaseNestedAnyOf; |
||||
|
||||
// coverage:ignore-start |
||||
const BaseNestedAnyOf._(); |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
factory BaseNestedAnyOf.fromJson(final Map<String, dynamic> json) => |
||||
_jsonSerializers.deserializeWith(serializer, json)!; |
||||
// coverage:ignore-end |
||||
|
||||
// coverage:ignore-start |
||||
Map<String, dynamic> toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>; |
||||
// coverage:ignore-end |
||||
|
||||
@BuiltValueSerializer(custom: true) |
||||
static Serializer<BaseNestedAnyOf> get serializer => _$BaseNestedAnyOfSerializer(); |
||||
|
||||
JsonObject get data; |
||||
} |
||||
|
||||
class _$BaseNestedAnyOfSerializer implements PrimitiveSerializer<BaseNestedAnyOf> { |
||||
@override |
||||
final Iterable<Type> types = const [BaseNestedAnyOf, _$BaseNestedAnyOf]; |
||||
|
||||
@override |
||||
final String wireName = 'BaseNestedAnyOf'; |
||||
|
||||
@override |
||||
Object serialize( |
||||
final Serializers serializers, |
||||
final BaseNestedAnyOf object, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) => |
||||
object.data.value; |
||||
|
||||
@override |
||||
BaseNestedAnyOf deserialize( |
||||
final Serializers serializers, |
||||
final Object data, { |
||||
final FullType specifiedType = FullType.unspecified, |
||||
}) { |
||||
final result = BaseNestedAnyOfBuilder()..data = JsonObject(data); |
||||
try { |
||||
result._baseAllOf = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAllOf))! as BaseAllOf).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseOneOf = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseOneOf))! as BaseOneOf).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseAnyOf = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseAnyOf))! as BaseAnyOf).toBuilder(); |
||||
} catch (_) {} |
||||
try { |
||||
result._baseNestedAnyOf3 = |
||||
(_jsonSerializers.deserialize(data, specifiedType: const FullType(BaseNestedAnyOf3))! as BaseNestedAnyOf3) |
||||
.toBuilder(); |
||||
} catch (_) {} |
||||
assert( |
||||
[result._baseAllOf, result._baseOneOf, result._baseAnyOf, result._baseNestedAnyOf3] |
||||
.where((final x) => x != null) |
||||
.isNotEmpty, |
||||
'Need anyOf for ${result._data}', |
||||
); |
||||
return result.build(); |
||||
} |
||||
} |
||||
|
||||
// coverage:ignore-start |
||||
final Serializers _serializers = (Serializers().toBuilder() |
||||
..addBuilderFactory(const FullType(Base), Base.new) |
||||
..add(Base.serializer) |
||||
..addBuilderFactory(const FullType(BaseAllOf), BaseAllOf.new) |
||||
..add(BaseAllOf.serializer) |
||||
..addBuilderFactory(const FullType(BaseOneOf), BaseOneOf.new) |
||||
..add(BaseOneOf.serializer) |
||||
..addBuilderFactory(const FullType(BaseOneOf1), BaseOneOf1.new) |
||||
..add(BaseOneOf1.serializer) |
||||
..addBuilderFactory(const FullType(BaseAnyOf), BaseAnyOf.new) |
||||
..add(BaseAnyOf.serializer) |
||||
..addBuilderFactory(const FullType(BaseAnyOf1), BaseAnyOf1.new) |
||||
..add(BaseAnyOf1.serializer) |
||||
..addBuilderFactory(const FullType(BaseNestedAllOf), BaseNestedAllOf.new) |
||||
..add(BaseNestedAllOf.serializer) |
||||
..addBuilderFactory(const FullType(BaseNestedOneOf), BaseNestedOneOf.new) |
||||
..add(BaseNestedOneOf.serializer) |
||||
..addBuilderFactory(const FullType(BaseNestedOneOf3), BaseNestedOneOf3.new) |
||||
..add(BaseNestedOneOf3.serializer) |
||||
..addBuilderFactory(const FullType(BaseNestedAnyOf), BaseNestedAnyOf.new) |
||||
..add(BaseNestedAnyOf.serializer) |
||||
..addBuilderFactory(const FullType(BaseNestedAnyOf3), BaseNestedAnyOf3.new) |
||||
..add(BaseNestedAnyOf3.serializer)) |
||||
.build(); |
||||
|
||||
final Serializers _jsonSerializers = (_serializers.toBuilder() |
||||
..addPlugin(StandardJsonPlugin()) |
||||
..addPlugin(const ContentStringPlugin())) |
||||
.build(); |
||||
// coverage:ignore-end |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,129 @@
|
||||
{ |
||||
"openapi": "3.1.0", |
||||
"info": { |
||||
"title": "nested ofs test", |
||||
"version": "0.0.1" |
||||
}, |
||||
"components": { |
||||
"schemas": { |
||||
"Base": { |
||||
"type": "object", |
||||
"properties": { |
||||
"attribute": { |
||||
"type": "string" |
||||
} |
||||
} |
||||
}, |
||||
"BaseAllOf": { |
||||
"allOf": [ |
||||
{ |
||||
"$ref": "#/components/schemas/Base" |
||||
}, |
||||
{ |
||||
"type": "object", |
||||
"properties": { |
||||
"attribute-allOf": { |
||||
"type": "string" |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
"BaseOneOf": { |
||||
"oneOf": [ |
||||
{ |
||||
"$ref": "#/components/schemas/Base" |
||||
}, |
||||
{ |
||||
"type": "object", |
||||
"properties": { |
||||
"attribute-oneOf": { |
||||
"type": "string" |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
"BaseAnyOf": { |
||||
"anyOf": [ |
||||
{ |
||||
"$ref": "#/components/schemas/Base" |
||||
}, |
||||
{ |
||||
"type": "object", |
||||
"properties": { |
||||
"attribute-anyOf": { |
||||
"type": "string" |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
"BaseNestedAllOf": { |
||||
"allOf": [ |
||||
{ |
||||
"$ref": "#/components/schemas/BaseAllOf" |
||||
}, |
||||
{ |
||||
"$ref": "#/components/schemas/BaseOneOf" |
||||
}, |
||||
{ |
||||
"$ref": "#/components/schemas/BaseAnyOf" |
||||
}, |
||||
{ |
||||
"type": "object", |
||||
"properties": { |
||||
"attribute-nested-allOf": { |
||||
"type": "string" |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
"BaseNestedOneOf": { |
||||
"oneOf": [ |
||||
{ |
||||
"$ref": "#/components/schemas/BaseAllOf" |
||||
}, |
||||
{ |
||||
"$ref": "#/components/schemas/BaseOneOf" |
||||
}, |
||||
{ |
||||
"$ref": "#/components/schemas/BaseAnyOf" |
||||
}, |
||||
{ |
||||
"type": "object", |
||||
"properties": { |
||||
"attribute-nested-oneOf": { |
||||
"type": "string" |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
"BaseNestedAnyOf": { |
||||
"anyOf": [ |
||||
{ |
||||
"$ref": "#/components/schemas/BaseAllOf" |
||||
}, |
||||
{ |
||||
"$ref": "#/components/schemas/BaseOneOf" |
||||
}, |
||||
{ |
||||
"$ref": "#/components/schemas/BaseAnyOf" |
||||
}, |
||||
{ |
||||
"type": "object", |
||||
"properties": { |
||||
"attribute-nested-anyOf": { |
||||
"type": "string" |
||||
} |
||||
} |
||||
} |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
"paths": {}, |
||||
"tags": [] |
||||
} |
@ -0,0 +1,27 @@
|
||||
name: dynamite_end_to_end_test |
||||
publish_to: none |
||||
description: Tests for dynamite. Not meant for publishing. |
||||
version: 1.0.0 |
||||
|
||||
environment: |
||||
sdk: '>=3.1.1 <4.0.0' |
||||
|
||||
dependencies: |
||||
built_value: ^8.6.2 |
||||
dynamite_runtime: |
||||
git: |
||||
url: https://github.com/nextcloud/neon |
||||
path: packages/dynamite/dynamite_runtime |
||||
dev_dependencies: |
||||
build_runner: ^2.4.6 |
||||
build_verify: ^3.1.0 |
||||
built_value_generator: ^8.6.2 |
||||
dynamite: |
||||
git: |
||||
url: https://github.com/nextcloud/neon |
||||
path: packages/dynamite/dynamite |
||||
neon_lints: |
||||
git: |
||||
url: https://github.com/nextcloud/neon |
||||
path: packages/neon_lints |
||||
test: ^1.24.8 |
@ -0,0 +1,8 @@
|
||||
# melos_managed_dependency_overrides: dynamite,dynamite_runtime,neon_lints |
||||
dependency_overrides: |
||||
dynamite: |
||||
path: ../dynamite |
||||
dynamite_runtime: |
||||
path: ../dynamite_runtime |
||||
neon_lints: |
||||
path: ../../neon_lints |
@ -0,0 +1,13 @@
|
||||
import 'package:build_verify/build_verify.dart'; |
||||
import 'package:test/test.dart'; |
||||
|
||||
void main() { |
||||
test( |
||||
'ensure_build', |
||||
() async => expectBuildClean( |
||||
packageRelativeDirectory: 'packages/dynamite/dynamite_end_to_end_test', |
||||
customCommand: ['bash', 'generate.sh'], |
||||
), |
||||
timeout: const Timeout.factor(2), |
||||
); |
||||
} |
@ -0,0 +1,91 @@
|
||||
import 'package:built_value/json_object.dart'; |
||||
import 'package:dynamite_end_to_end_test/nested_ofs.openapi.dart'; |
||||
import 'package:test/test.dart'; |
||||
|
||||
void main() { |
||||
test('BaseNestedAllOf', () { |
||||
final object = BaseNestedAllOf( |
||||
(final b) => b |
||||
..attribute = 'attributeValue' |
||||
..attributeAllOf = 'attributeAllOfValue' |
||||
..attributeNestedAllOf = 'attributeNestedAllOf' |
||||
..base.update( |
||||
(final b) => b..attribute = 'baseAttributeValue', |
||||
) |
||||
..baseAnyOf1.update( |
||||
(final b) => b..attributeAnyOf = 'baseAnyOfAttributeAnyOfValue', |
||||
) |
||||
..baseOneOf1.update( |
||||
(final b) => b..attributeOneOf = 'baseAnyOfAttributeOneOfValue', |
||||
), |
||||
); |
||||
|
||||
final json = { |
||||
'attribute': 'attributeValue', |
||||
'attribute-allOf': 'attributeAllOfValue', |
||||
'base': {'attribute': 'baseAttributeValue'}, |
||||
'baseOneOf1': {'attribute-oneOf': 'baseAnyOfAttributeOneOfValue'}, |
||||
'baseAnyOf1': {'attribute-anyOf': 'baseAnyOfAttributeAnyOfValue'}, |
||||
'attribute-nested-allOf': 'attributeNestedAllOf', |
||||
}; |
||||
|
||||
expect(object.toJson(), equals(json)); |
||||
expect(BaseNestedAllOf.fromJson(json), equals(object)); |
||||
}); |
||||
|
||||
test('BaseNestedOneOf', () { |
||||
final object = BaseNestedOneOf( |
||||
(final b) => b |
||||
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) |
||||
..baseAllOf.update((final b) {}) |
||||
..baseOneOf.update( |
||||
(final b) => b |
||||
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) |
||||
..base.update((final b) {}) |
||||
..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 = { |
||||
'attribute-oneOf': 'baseOneOfAttributeOneOfValue', |
||||
}; |
||||
|
||||
expect(object.toJson(), equals(json)); |
||||
expect(BaseNestedOneOf.fromJson(json), equals(object)); |
||||
}); |
||||
|
||||
test('BaseNestedAnyOf', () { |
||||
final object = BaseNestedAnyOf( |
||||
(final b) => b |
||||
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) |
||||
..baseAllOf.update((final b) {}) |
||||
..baseOneOf.update( |
||||
(final b) => b |
||||
..data = JsonObject(['attribute-oneOf', 'baseOneOfAttributeOneOfValue']) |
||||
..base.update((final b) {}) |
||||
..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 = { |
||||
'attribute-oneOf': 'baseOneOfAttributeOneOfValue', |
||||
}; |
||||
|
||||
expect(object.toJson(), equals(json)); |
||||
expect(BaseNestedAnyOf.fromJson(json), equals(object)); |
||||
}); |
||||
} |
Loading…
Reference in new issue