openapi-generators / openapi-generators/openapi-python-client

$ref in path parameters doesn't seem to work

Aperta
#605 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

🐞bug
Lingua principale
Python
Stelle
2k
Fork
293
Merge medio
34m
PR unite (30g)
1

Descrizione

Describe the bug
If a get path has a parameter using $ref to point to #/components/parameters, the generated API lacks the corresponding kwarg. If one "hoists" the indirect parameter up into the path's parameters, it works as expected.

To Reproduce
See this repo for a reproducible example.
And see this repo for the same schema without the $ref, working as expected.

Expected behavior
I expect to see the optional page kwarg in both generated APIs.

I see this in the $ref example:

def sync(
    *,
    client: Client,
) -> Optional[List[str]]:

and this in the noref example:

def sync(
    *,
    client: Client,
    page: Union[Unset, None, GetTestPage] = UNSET,
) -> Optional[List[str]]:

OpenAPI Spec File
A link to your openapi.json which produces this issue.

Desktop (please complete the following information):

  • OS: Microsoft Windows 10 Pro 10.0.19044 Build 19044
  • Python Version: 3.9.12
  • openapi-python-client version 0.11.1

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con il file test-schema.yaml collegato nel repository riproducibile openapi-ref-issue ed esegui il generatore usando la versione segnalata di openapi-python-client. Confronta il punto di ingresso sync generato con l'esempio noref, concentrandoti sulla risoluzione del parametro $ref. Il lavoro è completato quando l'API generata include il page kwarg opzionale anche nel caso del parametro referenziato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
openapi, python
Ambito
api
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.