make sure OpenAPI contract says there is a 422 return exception and i… - #666
make sure OpenAPI contract says there is a 422 return exception and i…#666ramonavic wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the “answer additional question” API endpoint contract/behavior so request validation errors are represented as standard FastAPI/Pydantic 422s in the OpenAPI spec, and adjusts tests around invalid “time” answers.
Changes:
- Removes the dynamic request-body dependency that injected
typebased onquestion_id, letting FastAPI validateAnswerInputUniondirectly. - Updates the OpenAPI
responsesfor the answer-question endpoint (removing thedefault_responseentry). - Expands and tightens the time-answer validation tests (adds
Noneas an invalid input and asserts additional error details).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
tests/api/v1/endpoints/test_melding.py |
Extends invalid time input cases and adds assertions on the returned validation error shape. |
meldingen/api/v1/endpoints/melding.py |
Simplifies the answer-question endpoint input handling to rely on direct AnswerInputUnion body parsing and adjusts documented responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| (1000, "Input should be a valid string"), | ||
| (10.00, "Input should be a valid string"), | ||
| (None, "Input should be a valid string"), | ||
| ], |
There was a problem hiding this comment.
This parametrization now includes None, but the test function annotates time_value as str | int a few lines below. With mypy --strict enabled in pre-commit, this will likely introduce a new type error; please widen the annotation to include None (or use a broader type) to keep the test type-checking clean.
b29ec8e to
0a39098
Compare
93256d5 to
3af6e84
Compare
3af6e84 to
d1d28d5
Compare
…mprove tests
Meldingen
Ticket: SIG-1234
Before opening a pull request, please ensure your branch is based on
mainand targetsmain.Check requirements when they are met (strikethrough when not applicable):
Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)