Skip to content

Conversation

@WanjohiSammy
Copy link
Member

@WanjohiSammy WanjohiSammy commented Aug 14, 2025

Currently, the unquoted type parameter in isof and cast is bind as SingleResourceCastNode in ODL introduced by PR OData/odata.net#3117, but the BindIsOf and BindCastSingleValue methods only handle ConstantNode.

This PR

  • Adds support to handle SingleResourceCastNode in BindIsOf and BindCastSingleValue methods.
  • Update tests for isof and cast unquoted type params
  • Add tests that throws exception when types are not related in the isof and cast function calls

ODL PR: OData/odata.net#3117

@WanjohiSammy WanjohiSammy changed the title Add support to handle SingleResourceCastNode in ValidateIsOfOrCast method since the unquoted type parameter is bind as SingleResourceCastNode Support SingleResourceCastNode for unquoted type parameters in BindIsOf and BindCastSingleValue Aug 14, 2025
@WanjohiSammy
Copy link
Member Author

/AzurePipelines run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

This comment was marked as outdated.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for SingleResourceCastNode in unquoted type parameters for isof and cast functions in OData query binding. The change enables proper handling of unquoted type names in these functions, which were previously only supporting quoted type names through ConstantNode.

Key changes include:

  • Updated OData library dependency from 8.2.3 to 8.4.0
  • Enhanced BindIsOf and BindCastSingleValue methods to handle both ConstantNode and SingleResourceCastNode type parameters
  • Updated test cases to reflect the new behavior where unquoted type parameters no longer throw exceptions

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tool/builder.versions.settings.targets Updates OData library dependency version range
src/Microsoft.AspNetCore.OData/Microsoft.AspNetCore.OData.csproj Updates OData package references to version 8.4.0
sample/ODataRoutingSample/ODataRoutingSample.csproj Removes direct OData.Edm package reference
src/Microsoft.AspNetCore.OData/Query/Expressions/QueryBinder.SingleValueFunctionCall.cs Adds SingleResourceCastNode support to BindIsOf and BindCastSingleValue methods
src/Microsoft.AspNetCore.OData/Query/Expressions/ExpressionBinderBase.cs Adds SingleResourceCastNode support to BindIsOf and BindCastSingleValue methods
test/Microsoft.AspNetCore.OData.Tests/Query/Validator/FilterQueryValidatorTests.cs Updates test cases to include both quoted and unquoted type parameter scenarios
test/Microsoft.AspNetCore.OData.Tests/Query/Expressions/FilterBinderTests.cs Updates test expectations for unquoted type parameters and error messages
test/Microsoft.AspNetCore.OData.E2E.Tests/IsOfAndCast/IsOfAndCastTests.cs Adds comprehensive E2E tests for cast and isof functions with both quoted and unquoted type parameters
test/Microsoft.AspNetCore.OData.E2E.Tests/IsOfAndCast/IsOfAndCastEdmModel.cs Defines EDM model for E2E tests
test/Microsoft.AspNetCore.OData.E2E.Tests/IsOfAndCast/IsOfAndCastDataSource.cs Provides test data for E2E tests
test/Microsoft.AspNetCore.OData.E2E.Tests/IsOfAndCast/IsOfAndCastDataModel.cs Defines data models for E2E tests
test/Microsoft.AspNetCore.OData.E2E.Tests/IsOfAndCast/IsOfAndCastController.cs Implements controller for E2E tests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@WanjohiSammy WanjohiSammy marked this pull request as ready for review September 10, 2025 15:55
@WanjohiSammy WanjohiSammy merged commit 3d50b02 into main Sep 16, 2025
2 checks passed
@WanjohiSammy WanjohiSammy deleted the fix/handle-SingleResourceCastNode-isof branch September 16, 2025 08:40
gathogojr pushed a commit that referenced this pull request Sep 16, 2025
…Of and BindCastSingleValue (#1511)

* Handle SingleResourceCastNode conversion
* bump ODL version and fix failing tests
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 16, 2025
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 16, 2025
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 16, 2025
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 16, 2025
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 16, 2025
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 17, 2025
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 17, 2025
gathogojr pushed a commit to gathogojr/AspNetCoreOData that referenced this pull request Sep 18, 2025
Sign up for free to 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.

3 participants