Enable "v4" API namespace
It enables the v4
namespace for our API. Doing this, every call to a /v4
endpoint shall behave the same as /v3
, unless we change this behavior on v4
.
It's covering #25183 (closed) as a way to discuss the best approach for growing v4
changes without affecting existing v3
endpoints.
API changes
- Remove
iid
filter onprojects/x/issues
- Rename
iid
filter onprojects/x/issues
toiids
- Remove
projects/x/merge_request/y
endpoint
-
Changelog entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #27180 (closed), #25183 (closed)
Merge request reports
Activity
@smcgivern Still unfinished, but could you give a quick look?
Still couldn't figure out how we'll make the conditional "fall up" from
v3 -> v4
with Grape, though with this approach we can work with v3 and v4 separately, and on demand.This seems OK to me. Just to clarify, does only code that is different in v4 end up in
lib/api/v4
? Other than that, do we just havelib/api
mean v4, andlib/api/v3
mean v3-specific stuff?Falling up is a nice-to-have. If we have to literally copy the code and specs, I can deal with that, it's just more work.
@smcgivern @oswaldo Ideally this is what would be my ideal solution:
- Copy the code & specs that will change in
v4
tov3
subdirectory - Modify existing code & specs to work according
v4
- Avoid splitting up code (e.g. the
IssuesHelpers
) for temporary double use
I don't mind duplicating code (only for this purpose), because the code will be deleted at some point. I think it is more important to make it easy (and without risk) to delete
v3
when we want, and to have a clean codebase afterward.I've also made an attempt to implement the parallel
v3
andv4
namespaces in tc-v4-api-namespace.- Copy the code & specs that will change in
@smcgivern That's the idea. Clarifying:
- V3 namespace: Only v3 specific
- V4 namespace: Only v4 specific
- Common namespace (e.g.:
lib/api/issues.rb
), used by both
But I'm also OK on duplicating that, as @to1ne said, it will be a smooth v3 removal after all.
Changed following @to1ne idea. What we've got here so far:
- "Fall up" from v3 to v4 when endpoint not found on v3
- V4 namespace stays the same and we can work on breaking change there (always copying all v3 endpoints to the new namespace, keeping it unchanged)
- All tests run's on v4 by default
One thing we could decide here is, or we literally also copy v3 tests to a new file, or we just separate the v3 old behavior on a new context/describe.
cc: @razer6 @smcgivern
Edited by Oswaldo Ferreir@oswaldo I think I'd like to not have a v4 namespace at all, but that may not be possible. If it's not, I can live with this.
(I think that is what @to1ne was suggesting, but please correct me if I'm wrong.)
Sorry, I wasn't clear enough, by v4 namespace I mean the current "global" namespace.
cc @smcgivern @to1ne
marked the task Changelog entry added as completed
marked the task Conform by the merge request performance guides as completed
marked the task Squashed related commits together as completed
marked the task Conform by the style guides as completed
added 2 commits
marked the task Documentation created/updated as completed