Open pnicolli opened 4 years ago
@pnicolli I wrote a quick test trying to reproduce the problem. Though, the test passes and looks fine:
https://github.com/plone/plone.restapi/pull/854
Could you have a look and maybe try to amend the test setup to trigger the problem? It looks like you are using Collections (which we at kitconcept completely stopped using since we have the listing block).
@tisto I replicated your test but using Collections and I got it to break, I pushed it in your PR and I am now waiting for CI, but it breaks locally and I expect it to break on CI.
We are not using Collections on Volto sites, actually. I found this while using a Volto site on a fresh Plone site, where we have the two default Collections (News and Events) and I still feel like plone.restapi should support Collections, at least for now, for possible use cases that don't involve Volto. Otherwise it would be weird to call it a Plone restapi
EDIT: Since I don't know when the CI will run, this is how it fails locally:
Failure in test test_querystringsearch_fullobjects_complex_collection (plone.restapi.tests.test_services_querystringsearch.TestQuerystringSearchEndpoint)
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor
yield
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 628, in run
testMethod()
File "/Users/pieronicolli/Lab/plone52/src/plone.restapi/src/plone/restapi/tests/test_services_querystringsearch.py", line 251, in test_querystringsearch_fullobjects_complex_collection
response.json()["items"][4]["@id"], u"{}/testcollection9".format(self.portal_url))
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 1351, in deprecated_func
return original_func(*args, **kwargs)
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 852, in assertEqual
assertion_func(first, second, msg=msg)
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 1233, in assertMultiLineEqual
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 693, in fail
raise self.failureException(msg)
AssertionError: 'http://localhost:55001/plone/@querystring-search' != 'http://localhost:55001/plone/testcollection9'
- http://localhost:55001/plone/@querystring-search
+ http://localhost:55001/plone/testcollection9
@pnicolli fair enough. I have no intention to rip out Collections from plone.restapi. It is just something that is low on my personal priorities list.
While querying for items in the site, I ended up with duplicate
@id
s. I found out that apparently the global querystring endpoint is returned as the@id
for Collections, instead of the url. Here is the api query i tried. I sent a POST to http://localhost:8080/Plone2/@querystring-search with the following body:And this is the response I got:
Both results have the same
@id
. If I removefullobjects
the response contains the actual collection url in the@id
field.This is a fresh Plone site with just restapi installed, running on the latest Plone 5.2.1-pending with plone.restapi 6.1.0.