Skip to content

Support SingleResourceCastNode for unquoted type parameters in BindIsOf and BindCastSingleValue#1511

Merged
WanjohiSammy merged 13 commits intomainfrom
fix/handle-SingleResourceCastNode-isof
Sep 16, 2025
Merged

Support SingleResourceCastNode for unquoted type parameters in BindIsOf and BindCastSingleValue#1511
WanjohiSammy merged 13 commits intomainfrom
fix/handle-SingleResourceCastNode-isof

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
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.

2 participants