-
Notifications
You must be signed in to change notification settings - Fork 921
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
Support versions in elements multi fetch #3715
base: master
Are you sure you want to change the base?
Support versions in elements multi fetch #3715
Conversation
ElementsApiController seems like a good way to maximize code reuse. However, I find things like I wouldn't mind to see a bit more code duplication here, for the sake of better code readability. |
With a proper abstract base class,
Looks like Rails still doesn't provide anything better than that to get model classes without naming them directly. But if that's really too scary, I can make a couple of methods in child controller classes that return their model classes. |
I also found Let's wait what both maintainers think about it, before doing any changes. |
How do you think the translation string would look like? I think it would be about as extreme. And again, I can do abstract method returning the message.
Why not remove ApiController too?
I'd remove around 80 lines from each. I already managed to sneak in an abstract class removing triple copy-paste, although it was in javascript. |
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.
I was wondering how on earth cgimap wound up with an API extension relative to rails and it it turns out the history is far older and more baroque than I was expecting.
The cgimap version came in with zerebubuth/openstreetmap-cgimap#129 which also added the single object versions calls which rails does have - that claims to be implementing #1189 for cgimap but actually is using a subtly different syntax.
That is probably a rather unfortunate syntax in fact because unlike #1189 it doesn't maintain the separation between main controller methods and history controller methods which then leads to the code here having to a complicated dance with the main controller accessing history objects and also to the non-deterministic uniqification where if you ask for the current version of an object in both versioned and unversioned form you don't know which one will be returned.
Now of course they should always be the same but it's an interesting wart.
I don't see any obvious problem with the code other than the rather complex nature of the abstract parent as @mmd-osm noted which is not ideal but then equally neither is duplicating everything.
Possibly it would better to add new tests rather than add lots of cases to the existing ones. I suspect @gravitystorm will think so though he'd probably also say we should split the existing one.
8e7cead
to
5fda3c2
Compare
Updates:
|
5fda3c2
to
e098c66
Compare
e098c66
to
d5f5b41
Compare
Removed |
As supported by cgimap. Related to #1189 which is a different implementation with different API entry points.