From 16d906e05e7b19b8b862d3d648ac05560d3cd0a6 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 27 Jan 2023 12:10:08 +0100 Subject: [PATCH] dynamite: Fix empty schemas --- packages/dynamite/lib/src/openapi_builder.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/lib/src/openapi_builder.dart index 4425c395..0b83a4c3 100644 --- a/packages/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/lib/src/openapi_builder.dart @@ -795,7 +795,11 @@ class OpenAPIBuilder implements Builder { switch (mimeType) { case 'application/json': dataType = result.name; - dataValue = result.deserialize(result.decode('utf8.decode(response.body)')); + if (result.name == 'dynamic') { + dataValue = ''; + } else { + dataValue = result.deserialize(result.decode('utf8.decode(response.body)')); + } break; case 'image/png': dataType = 'Uint8List'; @@ -1298,6 +1302,9 @@ TypeResult resolveType( final bool fromContentString = false, }) { TypeResult? result; + if (schema.ref == null && schema.ofs == null && schema.type == null) { + return TypeResultBase('dynamic'); + } if (schema.ref != null) { final name = schema.ref!.split('/').last; result = resolveType(