Skip to content

Commit

Permalink
refactor(dynamite): remove unused typedef generation
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
  • Loading branch information
Leptopoda committed Oct 27, 2023
1 parent 3b6cbd9 commit 16eb212
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions packages/dynamite/dynamite/lib/src/builder/generate_schemas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
);
}
}

Expand Down

0 comments on commit 16eb212

Please sign in to comment.