Browse Source

Merge pull request #187 from provokateurin/fix/empty-schema

dynamite: Fix empty schemas
pull/191/head
Kate 2 years ago committed by GitHub
parent
commit
4cc98fb06b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/dynamite/lib/src/openapi_builder.dart

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

@ -795,7 +795,11 @@ class OpenAPIBuilder implements Builder {
switch (mimeType) { switch (mimeType) {
case 'application/json': case 'application/json':
dataType = result.name; dataType = result.name;
if (result.name == 'dynamic') {
dataValue = '';
} else {
dataValue = result.deserialize(result.decode('utf8.decode(response.body)')); dataValue = result.deserialize(result.decode('utf8.decode(response.body)'));
}
break; break;
case 'image/png': case 'image/png':
dataType = 'Uint8List'; dataType = 'Uint8List';
@ -1298,6 +1302,9 @@ TypeResult resolveType(
final bool fromContentString = false, final bool fromContentString = false,
}) { }) {
TypeResult? result; TypeResult? result;
if (schema.ref == null && schema.ofs == null && schema.type == null) {
return TypeResultBase('dynamic');
}
if (schema.ref != null) { if (schema.ref != null) {
final name = schema.ref!.split('/').last; final name = schema.ref!.split('/').last;
result = resolveType( result = resolveType(

Loading…
Cancel
Save