Skip to content

Commit

Permalink
Add new convert setting and deprecate current one doing similar task
Browse files Browse the repository at this point in the history
  • Loading branch information
irvinesunday committed Oct 25, 2023
1 parent 1793dac commit d358e01
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
13 changes: 12 additions & 1 deletion src/Microsoft.OpenApi.OData.Reader/OpenApiConvertSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,18 @@ public string PathPrefix
/// <summary>
/// Gets/Sets a value indicating whether or not to expand derived types to retrieve their declared navigation properties.
/// </summary>
public bool ExpandDerivedTypesNavigationProperties { get; set; } = true;
[Obsolete("Use RetrieveDerivedTypesProperties to Get or Set the value.")]
public bool ExpandDerivedTypesNavigationProperties
{
get => RetrieveDerivedTypesProperties;
set => RetrieveDerivedTypesProperties = value;
}

/// <summary>
/// Gets/Sets a value indicating whether or not to retrieve complex or navigation properties declared in derived types.
/// </summary>
public bool RetrieveDerivedTypesProperties { get; set; } = true;

/// <summary>
/// Gets/sets a value indicating whether or not to set the deprecated tag for the operation when a revision is present as well as the "x-ms-deprecation" extension with additional information.
/// </summary>
Expand Down Expand Up @@ -387,6 +397,7 @@ internal OpenApiConvertSettings Clone()
InnerErrorComplexTypeName = this.InnerErrorComplexTypeName,
RequireRestrictionAnnotationsToGenerateComplexPropertyPaths = this.RequireRestrictionAnnotationsToGenerateComplexPropertyPaths,
ExpandDerivedTypesNavigationProperties = this.ExpandDerivedTypesNavigationProperties,

Check warning on line 399 in src/Microsoft.OpenApi.OData.Reader/OpenApiConvertSettings.cs

View workflow job for this annotation

GitHub Actions / Continuous Integration

'OpenApiConvertSettings.ExpandDerivedTypesNavigationProperties' is obsolete: 'Use RetrieveDerivedTypesProperties to Get or Set the value.'

Check warning on line 399 in src/Microsoft.OpenApi.OData.Reader/OpenApiConvertSettings.cs

View workflow job for this annotation

GitHub Actions / Continuous Integration

'OpenApiConvertSettings.ExpandDerivedTypesNavigationProperties' is obsolete: 'Use RetrieveDerivedTypesProperties to Get or Set the value.'

Check warning on line 399 in src/Microsoft.OpenApi.OData.Reader/OpenApiConvertSettings.cs

View workflow job for this annotation

GitHub Actions / Continuous Integration

'OpenApiConvertSettings.ExpandDerivedTypesNavigationProperties' is obsolete: 'Use RetrieveDerivedTypesProperties to Get or Set the value.'

Check warning on line 399 in src/Microsoft.OpenApi.OData.Reader/OpenApiConvertSettings.cs

View workflow job for this annotation

GitHub Actions / Continuous Integration

'OpenApiConvertSettings.ExpandDerivedTypesNavigationProperties' is obsolete: 'Use RetrieveDerivedTypesProperties to Get or Set the value.'
RetrieveDerivedTypesProperties = this.RetrieveDerivedTypesProperties,
CustomXMLAttributesMapping = this.CustomXMLAttributesMapping,
CustomHttpMethodLinkRelMapping = this.CustomHttpMethodLinkRelMapping,
AppendBoundOperationsOnDerivedTypeCastSegments = this.AppendBoundOperationsOnDerivedTypeCastSegments,
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.OpenApi.OData.Reader/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Microsoft.OpenApi.OData.OpenApiConvertSettings.NamespacePrefixToStripForInMethod
Microsoft.OpenApi.OData.OpenApiConvertSettings.RefBaseCollectionPaginationCountResponse.get -> bool
Microsoft.OpenApi.OData.OpenApiConvertSettings.RequireRestrictionAnnotationsToGenerateComplexPropertyPaths.get -> bool
Microsoft.OpenApi.OData.OpenApiConvertSettings.RequireRestrictionAnnotationsToGenerateComplexPropertyPaths.set -> void
Microsoft.OpenApi.OData.OpenApiConvertSettings.RetrieveDerivedTypesProperties.get -> bool
Microsoft.OpenApi.OData.OpenApiConvertSettings.RetrieveDerivedTypesProperties.set -> void
Microsoft.OpenApi.OData.OpenApiConvertSettings.SemVerVersion.get -> string
Microsoft.OpenApi.OData.OpenApiConvertSettings.SemVerVersion.set -> void
Microsoft.OpenApi.OData.OpenApiConvertSettings.ShowExternalDocs.get -> bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void CreateLinksForSingleValuedNavigationProperties()
OpenApiConvertSettings settings = new()
{
ShowLinks = true,
ExpandDerivedTypesNavigationProperties = false
RetrieveDerivedTypesProperties = false
};
ODataContext context = new(model, settings);
IEdmSingleton admin = model.EntityContainer.FindSingleton("admin");
Expand Down Expand Up @@ -72,7 +72,7 @@ public void CreateLinksForCollectionValuedNavigationProperties()
OpenApiConvertSettings settings = new()
{
ShowLinks = true,
ExpandDerivedTypesNavigationProperties = false
RetrieveDerivedTypesProperties = false
};
ODataContext context = new(model, settings);
IEdmSingleton singleton = model.EntityContainer.FindSingleton("admin");
Expand Down Expand Up @@ -140,7 +140,7 @@ public void CreateLinksForSingletons()
OpenApiConvertSettings settings = new()
{
ShowLinks = true,
ExpandDerivedTypesNavigationProperties = false
RetrieveDerivedTypesProperties = false
};
ODataContext context = new(model, settings);
IEdmSingleton singleton = model.EntityContainer.FindSingleton("admin");
Expand Down Expand Up @@ -195,7 +195,7 @@ public void CreateLinksForEntities()
OpenApiConvertSettings settings = new()
{
ShowLinks = true,
ExpandDerivedTypesNavigationProperties = false
RetrieveDerivedTypesProperties = false
};
ODataContext context = new(model, settings);
IEdmEntitySet entityset = model.EntityContainer.FindEntitySet("agreements");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public void CreatePathItemForNavigationPropertyWithRestrictionAnnotationsDefined
IEdmModel model = EdmModelHelper.GraphBetaModel;
OpenApiConvertSettings settings = new()
{
ExpandDerivedTypesNavigationProperties = false
RetrieveDerivedTypesProperties = false
};
ODataContext context = new(model, settings);
IEdmSingleton ipSingleton = model.EntityContainer.FindSingleton("informationProtection");
Expand Down Expand Up @@ -543,7 +543,7 @@ public void CreatePathItemForNavigationPropertyWithOutOfLineRestrictionAnnotatio
IEdmModel model = EdmModelHelper.GraphBetaModel;
OpenApiConvertSettings settings = new()
{
ExpandDerivedTypesNavigationProperties = false
RetrieveDerivedTypesProperties = false
};
ODataContext context = new(model, settings);
IEdmEntitySet users = model.EntityContainer.FindEntitySet("users");
Expand Down

0 comments on commit d358e01

Please sign in to comment.