Browse Source

refactor(dynamite): remove unused typedef generation

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/1024/head
Nikolas Rimikis 1 year ago
parent
commit
16eb212e08
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 29
      packages/dynamite/dynamite/lib/src/builder/generate_schemas.dart

29
packages/dynamite/dynamite/lib/src/builder/generate_schemas.dart

@ -3,7 +3,6 @@ import 'package:dynamite/src/builder/resolve_type.dart';
import 'package:dynamite/src/builder/state.dart';
import 'package:dynamite/src/helpers/dart_helpers.dart';
import 'package:dynamite/src/models/openapi.dart' as openapi;
import 'package:dynamite/src/models/type_result.dart';
Iterable<Spec> generateSchemas(
final openapi.OpenAPI spec,
@ -12,27 +11,13 @@ Iterable<Spec> generateSchemas(
if (spec.components?.schemas != null) {
for (final schema in spec.components!.schemas!.entries) {
final identifier = toDartName(schema.key, uppercaseFirstCharacter: true);
if (schema.value.type == null && schema.value.ref == null && schema.value.ofs == null) {
yield TypeDef(
(final b) => b
..name = identifier
..definition = refer('dynamic'),
);
} else {
final result = resolveType(
spec,
state,
identifier,
schema.value,
);
if (result is TypeResultBase) {
yield TypeDef(
(final b) => b
..name = identifier
..definition = refer(result.name),
);
}
}
resolveType(
spec,
state,
identifier,
schema.value,
);
}
}

Loading…
Cancel
Save