loopbackio / loopbackio/loopback-next

lb4 openapi doesn't work with openapi specs generated by loopback itself

Offen
#9,328 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug OpenAPI
Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

Describe the bug

The lb4 openapi command fails to generate working code in case the specification provided is generated by loopback itself. This shouldn't be the case as the specification is generated by LoopBack and the framework uses that same spec.

To reproduce this, generate specs from any lb4-based project. Then use that same specification to generate openapi artifacts with lb4 openapi. The resulting app creates buggy code.

The reproduction app is built based on openapi specs of this application.

Logs
src/models/index.ts:2:1 - error TS2308: Module './account-with-relations.model' has already exported a member named 'AccountWithRelations'. Consider explicitly re-exporting to resolve the ambiguity.

2 export * from './account.model';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/models/index.ts:6:1 - error TS2308: Module './customer-with-relations.model' has already exported a member named 'CustomerWithRelations'. Consider explicitly re-exporting to resolve the ambiguity.

6 export * from './customer.model';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Additional information

I tried removing duplicate entries which have been causing the problems. The resulting code still was not working and causing another issue. The request passed to swagger-client had filter=undefined in the URL which was making swagger-client fail to fetch any data.

Reproduction

https://github.com/aaqilniz/lb4-ex-openapi

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

Reproduziere den Fehler mit der Anwendung lb4-ex-openapi unter Verwendung einer von der verknüpften LoopBack-App generierten Spezifikation. Beginne mit dem lb4-OpenAPI-Generierungsablauf und prüfe die Exporte der generierten src/models/index.ts sowie die an swagger-client übergebene Anfrage. Die Aufgabe ist abgeschlossen, wenn die generierte Anwendung ohne doppelte Modellexporte erstellt wird und Anfragen kein filter=undefined enthalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
openapi, typescript
Bereich
api
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.