Heres the first patch at this attempt.
Can be found here. http://drupalcode.org/project/services.git/shortlog/refs/heads/feature/h... as
2 things have been added
The ability to set a default resource version. The idea is, you can change the version that is returned if no version is supplied. SO if you wanted to release a 1.0 api, the best idea is to clone your endpoint, name it endpoint 1.0 and don't ever change it, This will assure your clients won't break. Heres the documentation i wrote explaining it, hopefully someone can help me word it a little bit better.
* All functions that want to be considered for updates need to use a specific naming convetion
* WE took the same approach as the standard Drupal hook_instal and .install methods.
* For clients that want to request a specific version they need to pass a certain header
* services_RESOURCE_METHOD_version = version
* as an example, services_system_set_variable_version = 1.2
* Services by default will always use the originl resource shipped
* with services. If you wish to change this you can goto the resource page,
* and select an api version for the specific resource. The version option will
* only be enabled if version changes exists
Comments
Comment #2
kylebrowning commentedheres one patch.
Comment #4
kylebrowning commented#2: 0001-historical_resources.patch queued for re-testing.
Comment #6
kylebrowning commented#2: 0001-historical_resources.patch queued for re-testing.
Comment #8
kylebrowning commentedI guess the tests are breaking soo ill try and fix those.
Comment #9
marcingy commentedIn services_get_updates do we want a real cache as well as a static cache? - otherwise looks sensible as it does what core does with its updates :)
In services_get_update_versions I don't like the use of
bit too 'magic' I would rather we did, I haven't updated this until we discusss
Do we want to add an option at the server level to disable versioning have added - not sure the best way to deal with it when we are in _services_build_resources - I think this important so as sites aren't forced to run versioning (maybe we make the variable global which would simplify things.)
I can't think of a better way to do the actual version call because of where it needs to happen? No matter what a server is going to need to add a new call to get versioning.
Again in services_request_apply_version can we avoid extract?
In services_request_apply_version if this is true can we stop processing so throw the rest in an if statement?
New patch attached.
Comment #11
marcingy commentedcan't see a syntax issue locally.
Comment #13
marcingy commentedThis should fix all exception simplification of Kyle's change
Comment #15
marcingy commentedAnd some other notices
Comment #17
marcingy commentedCheck if we have a $method before processing.
Comment #19
marcingy commentedAdding needs tests tag because it does.
Comment #20
marcingy commentedComment #21
marcingy commentedComment #23
marcingy commentedSo the method does exist - bit wtf, lets try changing the assert which is strange in the first place as the logic is reversed.
Comment #24
marcingy commentedComment #25
boombatower commentedWill my example module work with this patch (no API changes right?)? I hope to try it out sometime this weekend.
Comment #26
kylebrowning commentedI think theres a few API changes from the services_historical method of doing things, BUT they dont conflict, your module will continue to work.
Comment #27
marcingy commentedboombatower's example module may well be the way to go as a basis for a test :) We know that it should work therefore if we have a test then we should be able to spot the bugs.
Comment #28
kylebrowning commentedHeres an updated patch with tests and some fixes that resulted from those tests :P
Comment #29
kylebrowning commentedComment #30
kylebrowning commentedIt has tests :P
Comment #31
damien tournoud commentedThis is an API change (and a significant one). It broke a couple of things in Services itself:
^ The alias feature doesn't work at all anymore.
^ I haven't tested, but I suppose it completely broke per-resource oauth settings too?
Comment #32
kylebrowning commentedWow great find. I guess we dont have test coverage for alias'
Ill write a test and a patch but I wont be able to get to it till tomorrow.
Comment #33
damien tournoud commentedThis is a revert patch, just so that I can target it in a make file.
I think this patch should be reverted until its impact in terms of API change are figured out. Changing a datastructure that can be consumed or altered by other modules inside a stable is an API change that is not welcome in a stable branch.
Comment #34
kylebrowning commentedI mean, its not THAT big of a deal, itll just go back to being called "endpoint", which makes no effin sense whatsoever.
Comment #35
marcingy commentedAfter Damien's comment I am wondering if this patch should be reverted and a 4.x branch opened with this patch applied. I am not doing anything myself as I not really active as a maintainer on the services project at the moment beyond reviewing simple patches and bug reports due to lack of time.
Comment #36
kylebrowning commentedI dont believe it requires a rollback because the specific changes I mmade hes referring to was cleanup I did to make things make more sense. I didnt realize its tehcnically an API change at the time but I totally see why it is now.
Ill fix it.
Comment #37
mradcliffeServicesWebTestCase::setUp argument handling changed in this patch as well. Darn. Now it will be a bit more difficult to sub class my sub class of that and pass in modules to enable.
Comment #38
kylebrowning commentedmradcliffe we can move it back to the old way, I did that to speed up things and I left it in there. Fuck.
Once again Ill take care of it. Sorry for the wait. Would everyone prefer that i revert this until it is better?
Comment #39
mradcliffeI can create a different issue so that it's separate from this one. I wasn't sure how critical the change to setUp was.
Comment #40
ygerasimov commentedHere is the patch that reverts
and adds test for alias functionality.
Comment #41
kylebrowning commentedygerasimov, did you verify that setting an alias in the interface works? WHen i did that exact change, I couldnt get it to work.
EDIT: these tests only cover if its perfectly set in the endpoint storage. But if you goto the ctools page, it doesnt seem able to save.
Comment #42
ygerasimov commentedkylebrowning, you are right. I also have difficulties with ui. Will check it out.
Comment #43
kylebrowning commentedHers a new patch. lets see if it passes.
This fixes aliases , and reverts it back to 'endpoint' from 'settings'
Comment #44
kylebrowning commentedWoops, heres both patches.
Comment #45
kylebrowning commentedbah, those are bad one sec.
Comment #46
kylebrowning commentedAlright one more try.
Comment #47
kylebrowning commentedAnd another to fix the tests.
Comment #48
ygerasimov commentedWell done! Here is patch from #47 with some minor code style fixes. If tests pass it is RTBC to me.
Comment #49
ygerasimov commentedComment #50
marcingy commentedMissing empty line.
Also does this patch solve the issue original brought up by damz
Comment #51
ygerasimov commentedYes, patch solves issue brought by Damien.
Here is updated patch to add empty line.
Comment #52
kylebrowning commentedComment #53
kylebrowning commentedNow the question. Do we backport?
Comment #54
ygerasimov commentedWoo-hooo! Great commit Kyle!
I don't want to volunteer to backport this patch.
Comment #55
kylebrowning commentedGoing to port this soon.
Comment #56
kylebrowning commentedIm not going to port this, its too much work for something thats going to be dropped when 8.x comes out. If someone wants to take a stab, go ahead.
Comment #57
boombatower commentedDropped completely or what do you mean by dropped?
Comment #58
kylebrowning commentedWhen 8.x comes out I don't plan on supporting 6.x
I may still back port it but it won't be anytime soon and I didn't wanted to hold up another release. This is working in 7.x though
Comment #59
kylebrowning commentedAnd historical endpoints still work with your code
Comment #60
boombatower commentedI thought you meant the historical api was going to be dropped from a 8.x services.