microsoft / microsoft/OpenAPI.NET.OData
Action and Operation do not expose $select and $expand over entity types
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 240
- Forks
- 70
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 13
Description
Action and Operation do not expose $select and $expand over entity types while this is possible for /entity/propertyOfComplexType
Assemblies affected
Microsoft.OpenApi.OData 1.7.5
Steps to reproduce
Register additional function for entity set:
var fax = builder.EntityType<XFax>();
fax.Collection.Function(nameof("GetByNumber"))
.ReturnsFromEntitySet<XFax>("Fax")
.NonNullable()
.Parameter<string>("number").NonNullable();
Expected result
GetByNumber should have both $select and $expand operations because XFax is Entity type
Actual result
No operations available
Additional detail
I see that ComplexPropertyGetOperationHandler has the following logic:
- Expose $top, $skip, $search, $filter $count for a collection
- Try to expose $select and $expand
On the contrary EdmOperationImportOperationHandler has the following logic:
- Expose $top, $skip, $search, $filter $count for a collection
- Expose $select and $expand if 1. is true
Therefore I can't get $select and $expand for Function or Operation. Is it something explicitly prohibited by OData?
How can I do this in a different way?
P.S. I think as a workaround I can make alternate key. But I don't see any examples for OData 8
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
Start with ComplexPropertyGetOperationHandler and EdmOperationImportOperationHandler, then reproduce the additional function registered on the XFax entity set. Compare the generated operations for entity-returning functions with the expected $select and $expand behavior. Done means confirming and correcting the handler behavior, with coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100