Skip to content

UriParser should throw exception for mismatched keys count when UnqualifiedODataUriResolver is configured. #1153

Description

@biaol-odata

UriParser should throw exception for mismatched keys count (extraneous) when UnqualifiedODataUriResolver is configured.
Sample case:
With the following EDM model:

            var pet = new EdmEntityType("TestNS", "Pet");
            PetType = pet;
            model.AddElement(pet);
            var key1 = pet.AddStructuralProperty("key1", EdmCoreModel.Instance.GetInt32(false));
            var key2 = pet.AddStructuralProperty("key2", EdmCoreModel.Instance.GetString(false));
            pet.AddKeys(key1, key2);
            var petSet = container.AddEntitySet("PetSet", pet);

and the following relative uri:
"PetSet(key1=1, key2='aStr', nonExistingKey='bStr')"

ODataUriParser instance configured with UnqualifiedODataUriResolver should throw exception for mismatched key count during uri parsing.
Note the default ODataUriParser instance configured with default ODataUriResolver does throw exception as expected. Therefore, the difference is caused by the different types of Uri resolver configured.

Assemblies affected

OData .Net lib < 7.4.4.

Reproduce steps

See description above.

Expected result

ODataException thrown for mismatched keys count.

Actual result

*No exception thrown. Extraneous keys are ignored. *

Additional detail

Optional, details of the root cause if known. Delete this section if you have no additional details to add.

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions