From 944e841fd48413ea907acbe998e4af1ed7225938 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 22 Dec 2022 11:37:15 +0100 Subject: [PATCH] dynamite: Fix mappings with $ref name --- packages/dynamite/lib/src/openapi_builder.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/lib/src/openapi_builder.dart index 83aa04d6..cad80e5c 100644 --- a/packages/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/lib/src/openapi_builder.dart @@ -1379,7 +1379,7 @@ TypeResult resolveType( ], for (final result in results) ...[ if (schema.discriminator != null) ...[ - "if (data['${schema.discriminator!.propertyName}'] == '${result.name}'", + "if (data['${schema.discriminator!.propertyName}'] == '${result.name.replaceFirst(state.prefix, '')}'", if (schema.discriminator!.mapping != null && schema.discriminator!.mapping!.isNotEmpty) ...[ for (final key in schema.discriminator!.mapping!.entries