loopbackio / loopbackio/loopback-next
lb4 openapi doesn't work with openapi specs generated by loopback itself
Personne n'a encore pris cette issue.
- Langage dominant
- TypeScript
- Étoiles
- 5.1k
- Forks
- 1.1k
- Merge moyen
- 2 j 21 h
- PR mergées (30 j)
- 27
Description
### 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](https://github.com/aaqilniz/lb4-ex-ref-many) application.
### Logs
```shell
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez l’échec avec l’application lb4-ex-openapi en utilisant une spécification générée par l’application LoopBack liée. Commencez par le flux de génération OpenAPI de lb4 et examinez les exports de src/models/index.ts généré ainsi que la requête transmise à swagger-client. C’est terminé lorsque l’application générée se compile sans exports de modèles en double et que les requêtes ne contiennent pas filter=undefined.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- openapi, typescript
- Domaine
- api
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100