Browse Source

refactor(dynamite): improve code readability

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/694/head
Nikolas Rimikis 1 year ago
parent
commit
46b275457c
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 73
      packages/dynamite/dynamite/lib/src/openapi_builder.dart

73
packages/dynamite/dynamite/lib/src/openapi_builder.dart

@ -1587,52 +1587,47 @@ TypeResult resolveType(
}
case 'object':
if (schema.properties == null) {
if (schema.additionalProperties != null) {
if (schema.additionalProperties is EmptySchema) {
result = TypeResultMap(
'BuiltMap',
TypeResultBase('JsonObject'),
nullable: nullable,
);
} else {
final subResult = resolveType(
spec,
variablePrefix,
state,
identifier,
schema.additionalProperties!,
);
result = TypeResultMap(
'BuiltMap',
subResult,
nullable: nullable,
);
}
break;
if (schema.additionalProperties == null) {
result = TypeResultBase(
'JsonObject',
nullable: nullable,
);
} else if (schema.additionalProperties is EmptySchema) {
result = TypeResultMap(
'BuiltMap',
TypeResultBase('JsonObject'),
nullable: nullable,
);
} else {
final subResult = resolveType(
spec,
variablePrefix,
state,
identifier,
schema.additionalProperties!,
);
result = TypeResultMap(
'BuiltMap',
subResult,
nullable: nullable,
);
}
result = TypeResultBase(
'JsonObject',
nullable: nullable,
);
break;
}
if (schema.properties!.isEmpty) {
} else if (schema.properties!.isEmpty) {
result = TypeResultMap(
'BuiltMap',
TypeResultBase('JsonObject'),
nullable: nullable,
);
break;
} else {
result = resolveObject(
spec,
variablePrefix,
state,
identifier,
schema,
nullable: nullable,
);
}
result = resolveObject(
spec,
variablePrefix,
state,
identifier,
schema,
nullable: nullable,
);
}
}

Loading…
Cancel
Save