Scenario bundle PATCH accepts ?expand=labels but ignores it

Aperta Adatta ai principianti
#2,580 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
django, python
Ambito
api, backend

Direzione di ricerca

Inizia in oekg/api_views.py, in OekgAPIView.initial e nel return bundle_response(...) alla fine di patch. Confronta bundle GET e gli altri endpoint di scrittura che risolvono le labels, quindi aggiungi un test di regressione che mostri che PATCH gestisce ?expand=labels o lo rifiuta in modo coerente; il lavoro è completo quando la risposta corrisponde al comportamento scelto.

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

Descrizione

API bug

PATCH /api/v0/scenario-bundles/<uid>/ accepts ?expand=labels (the parameter is validated for every view in OekgAPIView.initial) but does not act on it: the response is built without the expansion set (oekg/api_views.py, the return bundle_response(...) at the end of patch, which passes no expand=). Every other write below a bundle (scenario and study report writes, dataset link writes, replace/) resolves labels when asked, and the bundle GET does too.

So a client asking for labels on a bundle patch silently gets none. Either honour it (pass expand=self.expand, one line, plus a test) or refuse it with the same 400 an unknown expansion gets, by not offering labels on that method.

Found while annotating the endpoints for the OpenAPI reference (#2480); the documentation deliberately does not claim the parameter works there.

Lingua principale
Python
Stelle
65
Fork
28
Merge medio
4g 7h
PR unite (30g)
25

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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.

Altre issue di OpenEnergyPlatform/oeplatform

Tutte le issue di OpenEnergyPlatform/oeplatform

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.