Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Tasktype endpoint should gracefully handle malformed api_constraints values

Aperta
#273 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

  • #274 di @aayush-0131 — chiusa senza merge
  • #285 di @Gokul-social — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Inizia in src/routers/openml/tasktype.py dal punto di ingresso GET /tasktype/{task_type_id} e verifica come viene analizzato api_constraints. Riproduci l’endpoint con JSON malformato, un valore simile a un dict e JSON valido senza data_type. Il lavoro è completato quando l’endpoint restituisce una risposta stabile, accetta valori di tipo string e dict e include input[].data_type solo quando disponibile.

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

Descrizione

enhancement

Describe the bug
The /tasktype/{task_type_id} endpoint is not robust to unexpected api_constraints values.
In src/routers/openml/tasktype.py, the current parsing assumes a valid JSON string containing data_type. If api_constraints is malformed JSON, already a dict, or missing data_type, the endpoint may fail or behave inconsistently.

To Reproduce
Minimal reproducible setup (data-level reproduction):

  1. Ensure a task type exists with at least one input row in the DB.
  2. Set api_constraints for that input to malformed JSON, for example:
    • "{bad json"
  3. Call:
    • GET /tasktype/<task_type_id>

Also test with:

  • api_constraints already stored as a dict/object-like value (if DB layer returns dict)
  • api_constraints valid JSON but without data_type, e.g. {"foo":"bar"}

Expected behavior

  • The endpoint should return a stable response and should not crash.
  • It should accept both legacy JSON strings and dict-like values.
  • It should include input[].data_type only when data_type is present.
  • Malformed JSON in api_constraints should be ignored gracefully for that field.

Additional context
Proposed fix is to make parsing defensive:

  • parse string values via json.loads inside try/except json.JSONDecodeError
  • accept dict values directly
  • set data_type conditionally using safe lookup
Lingua principale
Python
Stelle
17
Fork
50
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna 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.

Altre issue di openml/server-api

Tutte le issue di openml/server-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.