Capabilities vocabulary ignored when using composite key
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 22
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
[Capabilities vocabulary support(https://learn.microsoft.com/en-us/odata/webapi/capabilities-vocabulary-support) is working well for an entity until we use Key value binding
Assemblies affected
- OData ModelBuilder 1.0.9
Reproduce steps
public class MyEntity
{
public Guid Id { get; set; }
[Required]
[NotSortable]
[NotFilterable]
public required string SomeStringKey { get; set; }
}
private IEdmModel BuildModel()
{
var builder = new ODataConventionModelBuilder();
var entitySetConfiguration = builder.EntitySet<MyEntity>(nameof(MyEntity));
// If this line is present FilterRestrictions and SortRestrictions are removed from metadata.xml
entitySetConfiguration.EntityType.HasKey(e => new { e.SomeStringKey, e.Id });
return builder.GetEdmModel();
}
Expected result
Capabilities annotations should be declared whatever the entity key definition
Actual result
Capabilities annotations are ignored if the entity declare a composite
Additional detail
This may be related to #10, but I'm not sure if #10 is just obsolete or not
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with ODataConventionModelBuilder, EntitySet, and the composite HasKey definition shown in the report. Trace how the EDM metadata is generated and where FilterRestrictions and SortRestrictions are omitted, then add a regression test. Done means capabilities annotations remain in the metadata for composite keys.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100