odata.net
odata.net copied to clipboard
Update ODL to use configurable alternate key vocabulary
The AlternateKeysODataUriResolver relies on the GetAlternateKeysAnnotation extension method, which uses a hard-coded value here to find the alternate keys that can be resolved. The hard-coded value refers to the community vocabulary, and cannot be configured by the AlternateKeysODataUriResolver. This should be configurable so that customers can specify the core vocabulary (or any other vocabulary) if they want.
Please create an issue for AGS to support the core vocabulary when this is fixed, and please create an issue to get the guidance updated once AGS support the core vocabulary.
I'd love to see the fix in ODL because that's also a "blocker" at https://github.com/OData/AspNetCoreOData/blob/main/test/Microsoft.AspNetCore.OData.E2E.Tests/AlternateKeys/AlternateKeysEdmModel.cs#L141-L142
Still need AGS follow-ups, I'll close it as soon as those items are created.
The implementation in #2470 breaks the spec requirements defined in the Community vocabularies: https://github.com/OData/vocabularies/blob/master/OData.Community.Keys.V1.md#216key-declaration-uniqueness
Services SHOULD NOT return multiple alternate key definitions for the same entity type that are composed of the exact same set of properties.
The Alternate keys may be serialized under 2 distinct namespaces (Community or Core), but ultimately they point to the same concept in the Edm type, and unicity rules SHOULD be upheld.