AOSSIE-Org / AOSSIE-Org/EduAid

Backend: Standardize defensive input validation across question-generation endpoints

Aperta
#363 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
171
Fork
425
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Several backend question-generation endpoints currently accept invalid or empty payloads
(e.g., missing or empty input_text, missing JSON body, invalid list fields).

This can lead to:
- Undefined behavior in NLP pipelines
- Silent failures or 500 errors
- Inconsistent API behavior compared to /get_mcq_answer

The /get_mcq_answer endpoint already implements clear defensive validation
(returning HTTP 400 with meaningful JSON errors).

Proposal:
- Reuse the same validation pattern across generation endpoints:
- /get_mcq
- /get_boolq
- /get_shortq
- /get_problems
- related *_hard endpoints where applicable
- Do NOT change successful behavior
- Return HTTP 400 with clear JSON error messages for invalid input
- Keep changes minimal and readable

I plan to open a PR after confirmation.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.