microsoft / microsoft/OpenAPI.NET.OData

Provide a way to not generate navigation paths with key

Offen
#723 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

status:needs-more-information
Vorherrschende Sprache
C#
Sterne
239
Forks
70
Ø Merge
7 Std. 59 Min.
Gemergte PRs (30 T.)
13

Beschreibung

I am new to implementing my first OData service. I am using OData for .NET 8+ with the ODataConventionModelBuilder to generate my model.

When a navigation property references an entity that is indexable, a path is generated of the form
Entity({ID})/NavEntity({ID1}) or Entity/{ID}/NavEntity/{ID1}.

The routing conventions don't include this path. They only support navigation to the NavEntity level. It would be helpful if there were a way to configure the conversion not to generate navigation paths with the key, even though the entity has one. As a practical matter, I'm not sure when I would need to query the navigation property by key, especially if the navigation property is available as a root entity.

As a workaround, I have added code to remove the unsupported paths from the OpenApiDocument before serializing it. As the OData service evolves, this code has to also evolve. If the conversion didn't generate the path with multiple keys, this workaround code would be unnecessary.

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

Verfolgen Sie die Konvertierung von ODataConventionModelBuilder durch die Generierung von OpenApiDocument und die Routing-Konventionen. Identifizieren Sie, wo Navigationpfade mit Schlüssel hinzugefügt werden, bestimmen Sie anschließend, wie die Konfiguration sie unterdrücken könnte, und überprüfen Sie, dass generierte Dokumente diese nicht unterstützten Pfade auslassen, ohne gültige Navigationsrouten zu entfernen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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