microsoft / microsoft/OpenAPI.NET.OData

Action and Operation do not expose $select and $expand over entity types

Offen
#710 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
240
Forks
70
Ø Merge
7 Std. 59 Min.
Gemergte PRs (30 T.)
13

Beschreibung

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:

  1. Expose $top, $skip, $search, $filter $count for a collection
  2. Try to expose $select and $expand

On the contrary EdmOperationImportOperationHandler has the following logic:

  1. Expose $top, $skip, $search, $filter $count for a collection
  2. 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit ComplexPropertyGetOperationHandler und EdmOperationImportOperationHandler und bilde anschließend die zusätzlich für das XFax-EntitySet registrierte Funktion nach. Vergleiche die generierten Operationen für Funktionen, die Entitäten zurückgeben, mit dem erwarteten Verhalten von $select und $expand. Als abgeschlossen gilt die Bestätigung und Korrektur des Handler-Verhaltens mit einer Abdeckung für den gemeldeten Fall.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
api, backend-api-design
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.