Skip to content

Commit 5a57ba2

Browse files
committed
- fixes a bug where custom error types would trim other types from the description
1 parent d05a6d0 commit 5a57ba2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ public static IDictionary<string, OpenApiSchema> CreateSchemas(this ODataContext
5050
case EdmSchemaElementKind.TypeDefinition: // Type definition
5151
{
5252
IEdmType reference = (IEdmType)element;
53+
var fullTypeName = reference.FullTypeName();
5354
if(reference is IEdmComplexType &&
54-
reference.FullTypeName().EndsWith(context.Settings.InnerErrorComplexTypeName, StringComparison.Ordinal))
55+
fullTypeName.Split(new char[] {'.'}, StringSplitOptions.RemoveEmptyEntries)
56+
.Last()
57+
.Equals(context.Settings.InnerErrorComplexTypeName, StringComparison.Ordinal))
5558
continue;
5659

57-
schemas.Add(reference.FullTypeName(), context.CreateSchemaTypeSchema(reference));
60+
schemas.Add(fullTypeName, context.CreateSchemaTypeSchema(reference));
5861
}
5962
break;
6063
}

0 commit comments

Comments
 (0)