Skip to content

Commit 99608e3

Browse files
authored
Merge pull request #193 from microsoft/bugfix/error-type-trimming
- fixes a bug where custom error types would trim other types from the description
2 parents 128e301 + cc4749d commit 99608e3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
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
}

src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
<TargetFrameworks>netstandard2.0</TargetFrameworks>
1616
<PackageId>Microsoft.OpenApi.OData</PackageId>
1717
<SignAssembly>true</SignAssembly>
18-
<Version>1.0.10-preview1</Version>
18+
<Version>1.0.10-preview2</Version>
1919
<Description>This package contains the codes you need to convert OData CSDL to Open API Document of Model.</Description>
2020
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
2121
<PackageTags>Microsoft OpenApi OData EDM</PackageTags>
2222
<RepositoryUrl>https://github.com/Microsoft/OpenAPI.NET.OData</RepositoryUrl>
2323
<PackageReleaseNotes>
2424
- Adds path items for properties of complex type. #176, #15
25-
- Describes errors on error response codes instead of default. #172, #165
25+
- Describes errors on error response codes instead of default. #172, #165, #193
2626
- Fixes a bug where reference objects are not created correctly. #171
2727
- Adds support for enum values descriptions. #164
2828
- Declares path parameters on path item instead of operation. #159

0 commit comments

Comments
 (0)