Skip to content

Expands navigation properties of derived types only if declaring navigation property is a containment - #302

Merged
Irvine Sunday (irvinesunday) merged 6 commits into
masterfrom
fix/is/expand-derived-containment
Nov 1, 2022
Merged

Expands navigation properties of derived types only if declaring navigation property is a containment#302
Irvine Sunday (irvinesunday) merged 6 commits into
masterfrom
fix/is/expand-derived-containment

Conversation

@irvinesunday

@irvinesundayIrvine Sunday (irvinesunday) commented Oct 26, 2022

Copy link
Copy Markdown
Contributor

Fixes#269

This PR:

  • Fixes the logic of expanding the navigation properties of derived types only if the declaring navigation property is a containment. Initially, expansion covered both containment and non-containment navigation properties.
  • Adds a check to ensure we don't add a derived type that has already been added in the path when expanding the type's navigation properties.
  • Update tests and integration files to validate the above.

To fully resolve the aforementioned issue, the below convert settings need to be set to true:

  • ExpandDerivedTypesNavigationProperties
  • AppendBoundOperationsOnDerivedTypeCastSegments

With the above fix and the above settings set to true, the result, for the examples provided in the issue, will be:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@andrueastman

Copy link
Copy Markdown
Contributor

Thanks Irvine Sunday (@irvinesunday)

Comment threadsrc/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs Outdated
@irvinesunday

Copy link
Copy Markdown
ContributorAuthor

Adding more information for context:

The table below shows the number of beta paths generated when the two convert settings ExpandDerivedTypesNavigationProperties and AppendBoundOperationsOnDerivedTypeCastSegments are enabled/disabled.

Convert SettingExpandDerivedTypesNavigationProperties = trueExpandDerivedTypesNavigationProperties = false
AppendBoundOperationsOnDerivedTypeCastSegments = true21,48416,969
AppendBoundOperationsOnDerivedTypeCastSegments = false19,34214,846

Peter Ombwa (@peombwa) / Tim (@timayabi2020) we might need to verify the generated OpenAPI document with PowerShell to verify whether there are any modules that might break AutoREST due to the increase in size.

@peombwa

Copy link
Copy Markdown
Contributor

Adding more information for context:

The table below shows the number of beta paths generated when the two convert settings ExpandDerivedTypesNavigationProperties and AppendBoundOperationsOnDerivedTypeCastSegments are enabled/disabled.

Convert Setting ExpandDerivedTypesNavigationProperties = true ExpandDerivedTypesNavigationProperties = false
AppendBoundOperationsOnDerivedTypeCastSegments = true 21,484 16,969
AppendBoundOperationsOnDerivedTypeCastSegments = false 19,342 14,846
Peter Ombwa (@peombwa) / Tim (@timayabi2020) we might need to verify the generated OpenAPI document with PowerShell to verify whether there are any modules that might break AutoREST due to the increase in size.

Thanks Irvine Sunday (@irvinesunday) for the breakdown!

Since OData type cast is currently not enabled in DevX API, we may see an increase of ~4500 paths in beta. Can we have an experimental deployment of DevX API with ExpandDerivedTypesNavigationProperties and AppendBoundOperationsOnDerivedTypeCastSegments set to true to facilitate our validation?

Also, is ExpandDerivedTypesNavigationProperties and AppendBoundOperationsOnDerivedTypeCastSegments set to false by default? i.e., maintains the current nav property expansion logic?

@irvinesunday

Copy link
Copy Markdown
ContributorAuthor

Adding more information for context:
The table below shows the number of beta paths generated when the two convert settings ExpandDerivedTypesNavigationProperties and AppendBoundOperationsOnDerivedTypeCastSegments are enabled/disabled.
Convert Setting ExpandDerivedTypesNavigationProperties = true ExpandDerivedTypesNavigationProperties = false
AppendBoundOperationsOnDerivedTypeCastSegments = true 21,484 16,969
AppendBoundOperationsOnDerivedTypeCastSegments = false 19,342 14,846
Peter Ombwa (@peombwa) / Tim (@timayabi2020) we might need to verify the generated OpenAPI document with PowerShell to verify whether there are any modules that might break AutoREST due to the increase in size.

Thanks Irvine Sunday (@irvinesunday) for the breakdown!

Since OData type cast is currently not enabled in DevX API, we may see an increase of ~4500 paths in beta. Can we have an experimental deployment of DevX API with ExpandDerivedTypesNavigationProperties and AppendBoundOperationsOnDerivedTypeCastSegments set to true to facilitate our validation?

Also, is ExpandDerivedTypesNavigationProperties and AppendBoundOperationsOnDerivedTypeCastSegments set to false by default? i.e., maintains the current nav property expansion logic?

Yes Peter Ombwa (@peombwa), both settings are currently set to false in DevX API (ExpandDerivedTypesNavigationProperties explicitly; AppendBoundOperationsOnDerivedTypeCastSegments implicitly by default). We can definitely update devxapitest with the bumped up version of the conversion lib. and configure both settings to true. We can use this for our validation.

@baywetVincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried by the increase in the number of paths here, but I think we need to validate it before making a final decision. It'd be interesting to have a comparison of the newly added paths and see whether the service actually understands them. Especially for "deep" paths.

@irvinesunday
Irvine Sunday (irvinesunday) deleted the fix/is/expand-derived-containment branch November 1, 2022 13:56
@baywet

Copy link
Copy Markdown
Member

(sorry about the auto-merge)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExpandDerivedTypesNavigationProperties setting granularity support

4 participants

@irvinesunday@andrueastman@peombwa@baywet