diff --git a/packages/dynamite/dynamite/README.md b/packages/dynamite/dynamite/README.md new file mode 100644 index 00000000..dc49e7b7 --- /dev/null +++ b/packages/dynamite/dynamite/README.md @@ -0,0 +1,29 @@ +Provides a [Dart Build System](https://github.com/dart-lang/build) builder for generating clients from an [OpenAPI specifications](https://swagger.io/specification/). + +The builder generates code if it find files with an `.openapi.json` or `.openapi.yaml` extension in the lib directory. + +# Build configuration + +You can configure code generation by setting values in the `build.yaml`. + +```yaml +targets: + $default: + builders: + dynamite: + options: + # Options configure how source code is generated. + # + # The following are sensible default values that ignores the schemas for the coverage. + analyzer_ignores: + - camel_case_types + - discarded_futures + - public_member_api_docs + - unreachable_switch_case + coverage_ignores: + - 'const .*\._\(\);' + - 'factory .*\.fromJson\(Map json\) => _jsonSerializers\.deserializeWith\(serializer, json\)!;' + - 'Map toJson\(\) => _jsonSerializers\.serializeWith\(serializer, this\)! as Map;' + - 'static BuiltSet<.*> get values => _\$.*Values;' + +``` diff --git a/packages/dynamite/dynamite/lib/builder.dart b/packages/dynamite/dynamite/lib/builder.dart index 18157106..b80f9f13 100644 --- a/packages/dynamite/dynamite/lib/builder.dart +++ b/packages/dynamite/dynamite/lib/builder.dart @@ -1,4 +1,4 @@ import 'package:build/build.dart'; import 'package:dynamite/dynamite.dart'; -Builder openAPIBuilder(final BuilderOptions options) => OpenAPIBuilder(); +Builder openAPIBuilder(final BuilderOptions options) => OpenAPIBuilder(options); diff --git a/packages/dynamite/dynamite/lib/src/builder/imports.dart b/packages/dynamite/dynamite/lib/src/builder/imports.dart index 7b7cddc2..9c8fd78a 100644 --- a/packages/dynamite/dynamite/lib/src/builder/imports.dart +++ b/packages/dynamite/dynamite/lib/src/builder/imports.dart @@ -3,29 +3,35 @@ import 'package:code_builder/code_builder.dart'; import 'package:dynamite/src/builder/state.dart'; import 'package:path/path.dart' as p; -List generateImports(final AssetId outputId, final State state) => [ - const Code('// ignore_for_file: camel_case_types'), - const Code('// ignore_for_file: discarded_futures'), - const Code('// ignore_for_file: public_member_api_docs'), - const Code('// ignore_for_file: unreachable_switch_case'), - Directive.import('dart:convert'), - Directive.import('dart:typed_data'), - const Code(''), - Directive.import('package:built_collection/built_collection.dart'), - Directive.import('package:built_value/built_value.dart'), - Directive.import('package:built_value/json_object.dart'), - Directive.import('package:built_value/serializer.dart'), - Directive.import('package:built_value/standard_json_plugin.dart'), - Directive.import('package:collection/collection.dart'), - Directive.import('package:dynamite_runtime/built_value.dart'), - Directive.import('package:dynamite_runtime/http_client.dart'), - Directive.import('package:dynamite_runtime/models.dart'), - Directive.import('package:dynamite_runtime/utils.dart'), - Directive.import('package:meta/meta.dart'), - Directive.import('package:universal_io/io.dart'), - const Code(''), - if (state.hasResolvedBuiltTypes) ...[ - Directive.part(p.basename(outputId.changeExtension('.g.dart').path)), - const Code(''), - ], - ]; +Iterable generateImports(final AssetId outputId, final State state) sync* { + final analyzerIgnores = state.buildConfig.analyzerIgnores; + if (analyzerIgnores != null) { + for (final rule in analyzerIgnores) { + yield Code('// ignore_for_file: $rule'); + } + } + + yield* [ + Directive.import('dart:convert'), + Directive.import('dart:typed_data'), + const Code(''), + Directive.import('package:built_collection/built_collection.dart'), + Directive.import('package:built_value/built_value.dart'), + Directive.import('package:built_value/json_object.dart'), + Directive.import('package:built_value/serializer.dart'), + Directive.import('package:built_value/standard_json_plugin.dart'), + Directive.import('package:collection/collection.dart'), + Directive.import('package:dynamite_runtime/built_value.dart'), + Directive.import('package:dynamite_runtime/http_client.dart'), + Directive.import('package:dynamite_runtime/models.dart'), + Directive.import('package:dynamite_runtime/utils.dart'), + Directive.import('package:meta/meta.dart'), + Directive.import('package:universal_io/io.dart'), + const Code(''), + ]; + + if (state.hasResolvedBuiltTypes) { + yield Directive.part(p.basename(outputId.changeExtension('.g.dart').path)); + yield const Code(''); + } +} diff --git a/packages/dynamite/dynamite/lib/src/builder/state.dart b/packages/dynamite/dynamite/lib/src/builder/state.dart index 13ef0eb8..f73eb3ee 100644 --- a/packages/dynamite/dynamite/lib/src/builder/state.dart +++ b/packages/dynamite/dynamite/lib/src/builder/state.dart @@ -1,8 +1,11 @@ import 'package:code_builder/code_builder.dart'; +import 'package:dynamite/src/models/dynamite_config/config.dart'; import 'package:dynamite/src/models/type_result.dart'; class State { - State(); + State(this.buildConfig); + + final DynamiteConfig buildConfig; final output = []; final resolvedTypes = {}; diff --git a/packages/dynamite/dynamite/lib/src/models/config.dart b/packages/dynamite/dynamite/lib/src/models/config.dart new file mode 100644 index 00000000..e97da966 --- /dev/null +++ b/packages/dynamite/dynamite/lib/src/models/config.dart @@ -0,0 +1 @@ +export 'dynamite_config/config.dart'; diff --git a/packages/dynamite/dynamite/lib/src/models/dynamite_config/config.dart b/packages/dynamite/dynamite/lib/src/models/dynamite_config/config.dart new file mode 100644 index 00000000..5f98f322 --- /dev/null +++ b/packages/dynamite/dynamite/lib/src/models/dynamite_config/config.dart @@ -0,0 +1,38 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_value/standard_json_plugin.dart'; + +part 'config.g.dart'; + +/// The configuration used by the dynamite builder. +abstract class DynamiteConfig implements Built { + factory DynamiteConfig([final void Function(DynamiteConfigBuilder) updates]) = _$DynamiteConfig; + + const DynamiteConfig._(); + + /// Constructs the dynamite config from a json like map. + factory DynamiteConfig.fromJson(final Map json) => _serializers.deserializeWith(serializer, json)!; + + /// Serializes this configuration to json. + Map toJson() => _serializers.serializeWith(serializer, this)! as Map; + + static Serializer get serializer => _$dynamiteConfigSerializer; + + static const String configPath = 'dynamite.yaml'; + + /// A set of lint rules to ignore for the entire generated file. + @BuiltValueField(wireName: 'analyzer_ignores') + BuiltSet? get analyzerIgnores; + + /// A set of regular expressions used to exclude parts from code coverage. + /// + /// All matches will be wrapped in `// coverage:ignore-start` and `// coverage:ignore-end` blocks. + @BuiltValueField(wireName: 'coverage_ignores') + BuiltSet? get coverageIgnores; +} + +@SerializersFor([ + DynamiteConfig, +]) +final Serializers _serializers = (_$_serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/packages/dynamite/dynamite/lib/src/models/dynamite_config/config.g.dart b/packages/dynamite/dynamite/lib/src/models/dynamite_config/config.g.dart new file mode 100644 index 00000000..0901cf81 --- /dev/null +++ b/packages/dynamite/dynamite/lib/src/models/dynamite_config/config.g.dart @@ -0,0 +1,170 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'config.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +Serializers _$_serializers = (Serializers().toBuilder() + ..add(DynamiteConfig.serializer) + ..addBuilderFactory(const FullType(BuiltSet, [FullType(String)]), () => SetBuilder()) + ..addBuilderFactory(const FullType(BuiltSet, [FullType(String)]), () => SetBuilder())) + .build(); +Serializer _$dynamiteConfigSerializer = _$DynamiteConfigSerializer(); + +class _$DynamiteConfigSerializer implements StructuredSerializer { + @override + final Iterable types = const [DynamiteConfig, _$DynamiteConfig]; + @override + final String wireName = 'DynamiteConfig'; + + @override + Iterable serialize(Serializers serializers, DynamiteConfig object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + Object? value; + value = object.analyzerIgnores; + if (value != null) { + result + ..add('analyzer_ignores') + ..add(serializers.serialize(value, specifiedType: const FullType(BuiltSet, [FullType(String)]))); + } + value = object.coverageIgnores; + if (value != null) { + result + ..add('coverage_ignores') + ..add(serializers.serialize(value, specifiedType: const FullType(BuiltSet, [FullType(String)]))); + } + return result; + } + + @override + DynamiteConfig deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = DynamiteConfigBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current! as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case 'analyzer_ignores': + result.analyzerIgnores.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltSet, [FullType(String)]))! as BuiltSet); + break; + case 'coverage_ignores': + result.coverageIgnores.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltSet, [FullType(String)]))! as BuiltSet); + break; + } + } + + return result.build(); + } +} + +class _$DynamiteConfig extends DynamiteConfig { + @override + final BuiltSet? analyzerIgnores; + @override + final BuiltSet? coverageIgnores; + + factory _$DynamiteConfig([void Function(DynamiteConfigBuilder)? updates]) => + (DynamiteConfigBuilder()..update(updates))._build(); + + _$DynamiteConfig._({this.analyzerIgnores, this.coverageIgnores}) : super._(); + + @override + DynamiteConfig rebuild(void Function(DynamiteConfigBuilder) updates) => (toBuilder()..update(updates)).build(); + + @override + DynamiteConfigBuilder toBuilder() => DynamiteConfigBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is DynamiteConfig && + analyzerIgnores == other.analyzerIgnores && + coverageIgnores == other.coverageIgnores; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, analyzerIgnores.hashCode); + _$hash = $jc(_$hash, coverageIgnores.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'DynamiteConfig') + ..add('analyzerIgnores', analyzerIgnores) + ..add('coverageIgnores', coverageIgnores)) + .toString(); + } +} + +class DynamiteConfigBuilder implements Builder { + _$DynamiteConfig? _$v; + + SetBuilder? _analyzerIgnores; + SetBuilder get analyzerIgnores => _$this._analyzerIgnores ??= SetBuilder(); + set analyzerIgnores(SetBuilder? analyzerIgnores) => _$this._analyzerIgnores = analyzerIgnores; + + SetBuilder? _coverageIgnores; + SetBuilder get coverageIgnores => _$this._coverageIgnores ??= SetBuilder(); + set coverageIgnores(SetBuilder? coverageIgnores) => _$this._coverageIgnores = coverageIgnores; + + DynamiteConfigBuilder(); + + DynamiteConfigBuilder get _$this { + final $v = _$v; + if ($v != null) { + _analyzerIgnores = $v.analyzerIgnores?.toBuilder(); + _coverageIgnores = $v.coverageIgnores?.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(DynamiteConfig other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$DynamiteConfig; + } + + @override + void update(void Function(DynamiteConfigBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + DynamiteConfig build() => _build(); + + _$DynamiteConfig _build() { + _$DynamiteConfig _$result; + try { + _$result = _$v ?? + _$DynamiteConfig._(analyzerIgnores: _analyzerIgnores?.build(), coverageIgnores: _coverageIgnores?.build()); + } catch (_) { + late String _$failedField; + try { + _$failedField = 'analyzerIgnores'; + _analyzerIgnores?.build(); + _$failedField = 'coverageIgnores'; + _coverageIgnores?.build(); + } catch (e) { + throw BuiltValueNestedFieldError(r'DynamiteConfig', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index 0c1a67c6..3a1d1c1b 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -10,10 +10,15 @@ import 'package:dynamite/src/builder/generate_schemas.dart'; import 'package:dynamite/src/builder/imports.dart'; import 'package:dynamite/src/builder/serializer.dart'; import 'package:dynamite/src/builder/state.dart'; +import 'package:dynamite/src/models/config.dart'; import 'package:dynamite/src/models/openapi.dart' as openapi; import 'package:version/version.dart'; class OpenAPIBuilder implements Builder { + OpenAPIBuilder( + final BuilderOptions options, + ) : buildConfig = DynamiteConfig.fromJson(options.config); + @override final buildExtensions = const { '.openapi.json': ['.openapi.dart'], @@ -26,6 +31,9 @@ class OpenAPIBuilder implements Builder { /// The maximum openapi version supported by this builder. static final Version maxSupportedVersion = minSupportedVersion.incrementMajor(); + /// The configuration for this builder. + final DynamiteConfig buildConfig; + @override Future build(final BuildStep buildStep) async { try { @@ -54,7 +62,7 @@ class OpenAPIBuilder implements Builder { throw Exception('Only OpenAPI between $minSupportedVersion and $maxSupportedVersion are supported.'); } - final state = State(); + final state = State(buildConfig); // Imports need to be generated after everything else so we know if we need the local part directive, // but they need to be added to the beginning of the output. @@ -64,28 +72,20 @@ class OpenAPIBuilder implements Builder { ..addAll(buildSerializer(state)) ..insertAll(0, generateImports(outputId, state)); - final patterns = [ - RegExp( - r'const .*\._\(\);', - ), - RegExp( - r'factory .*\.fromJson\(Map json\) => _jsonSerializers\.deserializeWith\(serializer, json\)!;', - ), - RegExp( - r'Map toJson\(\) => _jsonSerializers\.serializeWith\(serializer, this\)! as Map;', - ), - RegExp( - r'static BuiltSet<.*> get values => _\$.*Values;', - ), - ]; - var outputString = output.build().map((final e) => e.accept(emitter)).join('\n'); - for (final pattern in patterns) { - outputString = outputString.replaceAllMapped( - pattern, - (final match) => ' // coverage:ignore-start\n${match.group(0)}\n // coverage:ignore-end', - ); + + final coverageIgnores = state.buildConfig.coverageIgnores; + if (coverageIgnores != null) { + for (final ignore in coverageIgnores) { + final pattern = RegExp(ignore); + + outputString = outputString.replaceAllMapped( + pattern, + (final match) => ' // coverage:ignore-start\n${match.group(0)}\n // coverage:ignore-end', + ); + } } + final formatter = DartFormatter(pageWidth: 120); await buildStep.writeAsString( outputId, diff --git a/packages/dynamite/dynamite_end_to_end_test/build.yaml b/packages/dynamite/dynamite_end_to_end_test/build.yaml new file mode 100644 index 00000000..23da60c4 --- /dev/null +++ b/packages/dynamite/dynamite_end_to_end_test/build.yaml @@ -0,0 +1,12 @@ +targets: + $default: + builders: + built_value_generator|built_value: + enabled: true + dynamite: + options: + analyzer_ignores: + - camel_case_types + - discarded_futures + - public_member_api_docs + - unreachable_switch_case diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart index 366d7991..75e99b75 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/headers.openapi.dart @@ -185,17 +185,11 @@ abstract interface class GetHeadersInterface { abstract class GetHeaders implements GetHeadersInterface, Built { factory GetHeaders([final void Function(GetHeadersBuilder)? b]) = _$GetHeaders; - // coverage:ignore-start const GetHeaders._(); - // coverage:ignore-end - // coverage:ignore-start factory GetHeaders.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end @BuiltValueSerializer(custom: true) static Serializer get serializer => _$GetHeadersSerializer(); @@ -253,18 +247,12 @@ abstract class WithContentOperationIdHeaders factory WithContentOperationIdHeaders([final void Function(WithContentOperationIdHeadersBuilder)? b]) = _$WithContentOperationIdHeaders; - // coverage:ignore-start const WithContentOperationIdHeaders._(); - // coverage:ignore-end - // coverage:ignore-start factory WithContentOperationIdHeaders.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end @BuiltValueSerializer(custom: true) static Serializer get serializer => _$WithContentOperationIdHeadersSerializer(); @@ -319,18 +307,12 @@ abstract class GetWithContentHeaders implements GetWithContentHeadersInterface, Built { factory GetWithContentHeaders([final void Function(GetWithContentHeadersBuilder)? b]) = _$GetWithContentHeaders; - // coverage:ignore-start const GetWithContentHeaders._(); - // coverage:ignore-end - // coverage:ignore-start factory GetWithContentHeaders.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end @BuiltValueSerializer(custom: true) static Serializer get serializer => _$GetWithContentHeadersSerializer(); diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart index bdbfd579..b259d6d3 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/nested_ofs.openapi.dart @@ -39,17 +39,11 @@ abstract interface class BaseInterface { abstract class Base implements BaseInterface, Built { factory Base([final void Function(BaseBuilder)? b]) = _$Base; - // coverage:ignore-start const Base._(); - // coverage:ignore-end - // coverage:ignore-start factory Base.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end static Serializer get serializer => _$baseSerializer; } @@ -66,17 +60,11 @@ abstract interface class BaseAllOfInterface implements BaseInterface, BaseAllOf_ abstract class BaseAllOf implements BaseAllOfInterface, Built { factory BaseAllOf([final void Function(BaseAllOfBuilder)? b]) = _$BaseAllOf; - // coverage:ignore-start const BaseAllOf._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseAllOf.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end static Serializer get serializer => _$baseAllOfSerializer; } @@ -90,17 +78,11 @@ abstract interface class BaseOneOf1Interface { abstract class BaseOneOf1 implements BaseOneOf1Interface, Built { factory BaseOneOf1([final void Function(BaseOneOf1Builder)? b]) = _$BaseOneOf1; - // coverage:ignore-start const BaseOneOf1._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseOneOf1.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end static Serializer get serializer => _$baseOneOf1Serializer; } @@ -114,17 +96,11 @@ abstract interface class BaseOneOfInterface { abstract class BaseOneOf implements BaseOneOfInterface, Built { factory BaseOneOf([final void Function(BaseOneOfBuilder)? b]) = _$BaseOneOf; - // coverage:ignore-start const BaseOneOf._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseOneOf.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end @BuiltValueSerializer(custom: true) static Serializer get serializer => _$BaseOneOfSerializer(); @@ -178,17 +154,11 @@ abstract interface class BaseAnyOf1Interface { abstract class BaseAnyOf1 implements BaseAnyOf1Interface, Built { factory BaseAnyOf1([final void Function(BaseAnyOf1Builder)? b]) = _$BaseAnyOf1; - // coverage:ignore-start const BaseAnyOf1._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseAnyOf1.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end static Serializer get serializer => _$baseAnyOf1Serializer; } @@ -202,17 +172,11 @@ abstract interface class BaseAnyOfInterface { abstract class BaseAnyOf implements BaseAnyOfInterface, Built { factory BaseAnyOf([final void Function(BaseAnyOfBuilder)? b]) = _$BaseAnyOf; - // coverage:ignore-start const BaseAnyOf._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseAnyOf.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end @BuiltValueSerializer(custom: true) static Serializer get serializer => _$BaseAnyOfSerializer(); @@ -270,18 +234,12 @@ abstract interface class BaseNestedAllOfInterface abstract class BaseNestedAllOf implements BaseNestedAllOfInterface, Built { factory BaseNestedAllOf([final void Function(BaseNestedAllOfBuilder)? b]) = _$BaseNestedAllOf; - // coverage:ignore-start const BaseNestedAllOf._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseNestedAllOf.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end static Serializer get serializer => _$baseNestedAllOfSerializer; } @@ -295,18 +253,12 @@ abstract interface class BaseNestedOneOf3Interface { abstract class BaseNestedOneOf3 implements BaseNestedOneOf3Interface, Built { factory BaseNestedOneOf3([final void Function(BaseNestedOneOf3Builder)? b]) = _$BaseNestedOneOf3; - // coverage:ignore-start const BaseNestedOneOf3._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseNestedOneOf3.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end static Serializer get serializer => _$baseNestedOneOf3Serializer; } @@ -322,18 +274,12 @@ abstract interface class BaseNestedOneOfInterface { abstract class BaseNestedOneOf implements BaseNestedOneOfInterface, Built { factory BaseNestedOneOf([final void Function(BaseNestedOneOfBuilder)? b]) = _$BaseNestedOneOf; - // coverage:ignore-start const BaseNestedOneOf._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseNestedOneOf.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end @BuiltValueSerializer(custom: true) static Serializer get serializer => _$BaseNestedOneOfSerializer(); @@ -399,18 +345,12 @@ abstract interface class BaseNestedAnyOf3Interface { abstract class BaseNestedAnyOf3 implements BaseNestedAnyOf3Interface, Built { factory BaseNestedAnyOf3([final void Function(BaseNestedAnyOf3Builder)? b]) = _$BaseNestedAnyOf3; - // coverage:ignore-start const BaseNestedAnyOf3._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseNestedAnyOf3.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end static Serializer get serializer => _$baseNestedAnyOf3Serializer; } @@ -426,18 +366,12 @@ abstract interface class BaseNestedAnyOfInterface { abstract class BaseNestedAnyOf implements BaseNestedAnyOfInterface, Built { factory BaseNestedAnyOf([final void Function(BaseNestedAnyOfBuilder)? b]) = _$BaseNestedAnyOf; - // coverage:ignore-start const BaseNestedAnyOf._(); - // coverage:ignore-end - // coverage:ignore-start factory BaseNestedAnyOf.fromJson(final Map json) => _jsonSerializers.deserializeWith(serializer, json)!; - // coverage:ignore-end - // coverage:ignore-start Map toJson() => _jsonSerializers.serializeWith(serializer, this)! as Map; - // coverage:ignore-end @BuiltValueSerializer(custom: true) static Serializer get serializer => _$BaseNestedAnyOfSerializer(); diff --git a/packages/nextcloud/build.yaml b/packages/nextcloud/build.yaml index 3d80b246..f888255e 100644 --- a/packages/nextcloud/build.yaml +++ b/packages/nextcloud/build.yaml @@ -3,3 +3,15 @@ targets: builders: built_value_generator|built_value: enabled: true + dynamite: + options: + analyzer_ignores: + - camel_case_types + - discarded_futures + - public_member_api_docs + - unreachable_switch_case + coverage_ignores: + - 'const .*\._\(\);' + - 'factory .*\.fromJson\(Map json\) => _jsonSerializers\.deserializeWith\(serializer, json\)!;' + - 'Map toJson\(\) => _jsonSerializers\.serializeWith\(serializer, this\)! as Map;' + - 'static BuiltSet<.*> get values => _\$.*Values;'