This repository was archived by the owner on May 7, 2026. It is now read-only.
Remove unions in params and delete request body#13
Merged
Conversation
garryod
reviewed
Aug 18, 2022
Contributor
garryod
left a comment
There was a problem hiding this comment.
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.