Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2911, Add APIs to register custom uri functions for certain model #3149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xuzhg
Copy link
Member

@xuzhg xuzhg commented Dec 12, 2024

Fixes #2911, Add APIs to regiter custom uri functions for certain model

Avoid the global static setting
Avoid the overloads for different models
Use the Annotation to hold the custom Uri functions
Support the back-compatible

@xuzhg xuzhg changed the title Fixes #2911, Add APIs to regiter custom uri functions for certain model Fixes #2911, Add APIs to register custom uri functions for certain model Dec 12, 2024

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 5 changed files in this pull request and generated no suggestions.

Files not reviewed (1)
  • src/Microsoft.OData.Core/PublicAPI/net8.0/PublicAPI.Unshipped.txt: Language not supported
Comments skipped due to low confidence (3)

test/FunctionalTests/Microsoft.OData.Core.Tests/ScenarioTests/UriParser/CustomUriFunctionsTests.cs:701

  • Ensure that the new behavior introduced by the changes is adequately covered by tests, including scenarios where the model is null and where it is not, as well as case-sensitive and case-insensitive function name matching.
private FunctionSignatureWithReturnType[] GetCustomFunctionSignaturesOrNull(IEdmModel model, string customFunctionName)

src/Microsoft.OData.Core/UriParser/CustomUriFunctions.cs:110

  • The method SkipWhile should be replaced with Where to correctly filter out the specific function signature to remove.
FunctionSignatureWithReturnType[] customFunctionOverloadsWithoutTheOneToRemove = existingCustomFunctionOverloads.SkipWhile(funcOverload => AreFunctionsSignatureEqual(funcOverload, functionSignature)).ToArray();

src/Microsoft.OData.Core/UriParser/CustomUriFunctions.cs:75

  • [nitpick] The error message string SRResources.CustomUriFunctions_AddCustomUriFunction_BuiltInExistsFullSignature should be checked for clarity and helpfulness.
throw new ODataException(Error.Format(SRResources.CustomUriFunctions_AddCustomUriFunction_BuiltInExistsFullSignature, functionName));
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.

re: CustomUriFunctions should not be static or irreversible
1 participant