Skip to content

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

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

2 participants