-
Notifications
You must be signed in to change notification settings - Fork 0
Remove unions in params and delete request body #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
garryod
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks really good, a few little comments on style and readability here and there, but nothing of real significance
I would say they should be part of the query itself as they're the primary thing which is being indexed by, any supplementary data can be included in the body. Though @callumforrester may disagree
…ters instead of body. Passed the responsibility of dealing with this to the service. Removed old comments.
This PR addresses two related issues:
For the first task, the request body used to have a 'tag_or_idx' parameter which was a union of int or str. Now, I've changed my delete paths to require at least one query parameter, tag or idx. That is /a/path?tag=foo or /a/path?idx=0, which will dictate what is deleted.
Then, I decided to decouple my tag_or_idx parameters in general, mostly in the parameters of request bodies. As a result, my pydantic models for editing orientations/reflections now have separate 'tag' and 'idx' fields.
However, I have one major question about this change - is it best to include these 'tag' and 'idx' fields, which are currently in my EditOrientationParams and EditReflectionParams pydantic models for the request body, to be query parameters? This would be more in line with the new style for deleting orientations/reflections, however to me it also makes more sense for everything to be neatly bundled in the request body where appropriate.