Skip to content

Commit 22ebf50

Browse files
authored
Finds all the derived types for a schema element (#321)
* Find all derived types for a schema element * Update release notes
1 parent f56384c commit 22ebf50

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/Microsoft.OpenApi.OData.Reader/Common/EdmModelHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal static OpenApiSchema GetDerivedTypesReferenceSchema(IEdmStructuredType
2424
Utils.CheckArgumentNull(edmModel, nameof(edmModel));
2525
if(structuredType is not IEdmSchemaElement schemaElement) throw new ArgumentException("The type is not a schema element.", nameof(structuredType));
2626

27-
IEnumerable<IEdmSchemaElement> derivedTypes = edmModel.FindDirectlyDerivedTypes(structuredType).OfType<IEdmSchemaElement>();
27+
IEnumerable<IEdmSchemaElement> derivedTypes = edmModel.FindAllDerivedTypes(structuredType).OfType<IEdmSchemaElement>();
2828

2929
if (!derivedTypes.Any())
3030
{

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<TargetFrameworks>netstandard2.0</TargetFrameworks>
1616
<PackageId>Microsoft.OpenApi.OData</PackageId>
1717
<SignAssembly>true</SignAssembly>
18-
<Version>1.2.0-preview9</Version>
18+
<Version>1.2.0-preview10</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>
@@ -31,6 +31,7 @@
3131
- Adds custom parameters to $count and ODataTypeCast paths' Get operations #207
3232
- Adds support for configuring the default value of derived types' @odata.type property #304
3333
- Adds OData query parameters to $count endpoints #313
34+
- Finds all the derived types for a schema element #84
3435
</PackageReleaseNotes>
3536
<AssemblyName>Microsoft.OpenApi.OData.Reader</AssemblyName>
3637
<AssemblyOriginatorKeyFile>..\..\tool\Microsoft.OpenApi.OData.snk</AssemblyOriginatorKeyFile>

test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ public void GetDerivedTypesReferenceSchemaReturnsDerivedTypesReferencesInSchemaI
960960

961961
// Act
962962
schema = Common.EdmModelHelper.GetDerivedTypesReferenceSchema(entityType, edmModel);
963-
int derivedTypesCount = edmModel.FindDirectlyDerivedTypes(entityType).OfType<IEdmEntityType>().Count() + 1; // + 1 the base type
963+
int derivedTypesCount = edmModel.FindAllDerivedTypes(entityType).OfType<IEdmEntityType>().Count() + 1; // + 1 the base type
964964

965965
// Assert
966966
Assert.NotNull(schema.OneOf);

0 commit comments

Comments
 (0)