[xwiki-devs] Inconsistency in page REST resource: raw vs. display title
Hi devs, While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL: /xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction * The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty * The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post. The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO. WDYT? I'll fix the REST integration tests by using a page that doesn't have a sheet. Thanks, Marius
On Fri, May 11, 2012 at 11:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
See https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwik... .
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat. Thanks -Vincent
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius
I opened http://jira.xwiki.org/browse/XWIKI-7815 . On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides: * adding a compatibility flag to control if the value of the "title" property is the rendered document title or the raw document title. * adding a new page resource property, "renderedTitle" (or "displayTitle", to be decided) * use "renderedTitle" in XWiki platform where the rendered title is needed, until we have XWIKI-5820. Deprecate "renderedTitle" property afterwards. * provide the document raw title by default and document in the release notes the flag that can be used to get back the previous behaviour (rendered title) WDYT? Thanks, Marius
Thanks -Vincent
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ? Is the raw title really useful outside of an editor ?
* adding a compatibility flag to control if the value of the "title" property is the rendered document title or the raw document title. * adding a new page resource property, "renderedTitle" (or "displayTitle", to be decided) * use "renderedTitle" in XWiki platform where the rendered title is needed, until we have XWIKI-5820. Deprecate "renderedTitle" property afterwards. * provide the document raw title by default and document in the release notes the flag that can be used to get back the previous behaviour (rendered title)
WDYT?
Thanks, Marius
Thanks -Vincent
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Jean-Vincent Drean, XWiki.
On Fri, May 11, 2012 at 3:52 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ?
No. If you need only the rendered version of a page you request directly the rendered version, which includes all the document meta data (parent, child, etc.). The only difference is that fields like title and content which are "renderable" are rendered. At least that's what I understood from http://jira.xwiki.org/browse/XWIKI-5820 . Now, if you need both raw and rendered data you have to make indeed 2 requests.
Is the raw title really useful outside of an editor ?
As I said before, I believe the data is more important than the presentation of the data and REST should focus on the data first, i.e. it should expose XWiki data. Right now you can't access the raw document title through REST and this is a serious limitation. I don't know if there are more use cases for the rendered title versus raw title, but I know that you can get the rendered title from the raw title, but not the other way around. Someone might want to use his own renderer for the title (although that's a bit far fetched :) ). Thanks, Marius
* adding a compatibility flag to control if the value of the "title" property is the rendered document title or the raw document title. * adding a new page resource property, "renderedTitle" (or "displayTitle", to be decided) * use "renderedTitle" in XWiki platform where the rendered title is needed, until we have XWIKI-5820. Deprecate "renderedTitle" property afterwards. * provide the document raw title by default and document in the release notes the flag that can be used to get back the previous behaviour (rendered title)
WDYT?
Thanks, Marius
Thanks -Vincent
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Jean-Vincent Drean, XWiki. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Fri, May 11, 2012 at 3:08 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 3:52 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ?
No. If you need only the rendered version of a page you request directly the rendered version, which includes all the document meta data (parent, child, etc.). The only difference is that fields like title and content which are "renderable" are rendered. At least that's what I understood from http://jira.xwiki.org/browse/XWIKI-5820 . Now, if you need both raw and rendered data you have to make indeed 2 requests.
Is the raw title really useful outside of an editor ?
As I said before, I believe the data is more important than the presentation of the data and REST should focus on the data first, i.e. it should expose XWiki data. Right now you can't access the raw document title through REST and this is a serious limitation.
We render the title field in order to display data (from an object field for example) or in order to get a translation. I see what you mean but we're only talking about velocity evaluation here, which is not exactly "presentation".
I don't know if there are more use cases for the rendered title versus raw title, but I know that you can get the rendered title from the raw title, but not the other way around. Someone might want to use his own renderer for the title (although that's a bit far fetched :) ).
You can get the rendered title from the raw title only of you're using the API from XWiki itself (and on the server side). -- Jean-Vincent Drean, XWiki.
On Fri, May 11, 2012 at 4:20 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 3:08 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 3:52 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote: > Hi devs, > > While debugging the failing REST integration tests I discovered an > inconsistency in the page REST resource. Take for instance the > response returned for this URL: > > /xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction > > * The returned content is the raw (not rendered) content. In this > particular case, since the blog post content is saved in the blog post > object, and also because the blog uses the new sheet system, the raw > content of Blog.BlogIntroduction page is empty > > * The returned title is the display title (i.e. the rendered title). > In this particular case, since the raw title is empty, but the blog > post sheet, which controls how the title is displayed, renders the > 'title' property of the blog post. > > The inconsistency is that the content is raw while the title is > rendered. I think the page REST resource should provide data in the > first place, so raw title. It could provide the rendered title or > content additionally, but that is secondary IMO. > > WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ?
No. If you need only the rendered version of a page you request directly the rendered version, which includes all the document meta data (parent, child, etc.). The only difference is that fields like title and content which are "renderable" are rendered. At least that's what I understood from http://jira.xwiki.org/browse/XWIKI-5820 . Now, if you need both raw and rendered data you have to make indeed 2 requests.
Is the raw title really useful outside of an editor ?
As I said before, I believe the data is more important than the presentation of the data and REST should focus on the data first, i.e. it should expose XWiki data. Right now you can't access the raw document title through REST and this is a serious limitation.
We render the title field in order to display data (from an object field for example) or in order to get a translation. I see what you mean but we're only talking about velocity evaluation here, which is not exactly "presentation".
Hmm, indeed, evaluating the Velocity code from the document title outside of the XWiki context is tricky. More info: * we didn't provide the rendered title from the start. Here's the commit that introduced it https://github.com/xwiki/xwiki-platform/commit/2f47139e21bc0ea1d7210d6bc9cf4... * there are resources that return the raw title. I found /xwiki/rest/wikis/xwiki/pages so there's clearly an inconsistency. Thanks, Marius
I don't know if there are more use cases for the rendered title versus raw title, but I know that you can get the rendered title from the raw title, but not the other way around. Someone might want to use his own renderer for the title (although that's a bit far fetched :) ).
You can get the rendered title from the raw title only of you're using the API from XWiki itself (and on the server side).
-- Jean-Vincent Drean, XWiki. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Fri, May 11, 2012 at 3:32 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 4:20 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 3:08 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 3:52 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
> On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea > <[email protected]> wrote: >> Hi devs, >> >> While debugging the failing REST integration tests I discovered an >> inconsistency in the page REST resource. Take for instance the >> response returned for this URL: >> >> /xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction >> >> * The returned content is the raw (not rendered) content. In this >> particular case, since the blog post content is saved in the blog post >> object, and also because the blog uses the new sheet system, the raw >> content of Blog.BlogIntroduction page is empty >> >> * The returned title is the display title (i.e. the rendered title). >> In this particular case, since the raw title is empty, but the blog >> post sheet, which controls how the title is displayed, renders the >> 'title' property of the blog post. >> >> The inconsistency is that the content is raw while the title is >> rendered. I think the page REST resource should provide data in the >> first place, so raw title. It could provide the rendered title or >> content additionally, but that is secondary IMO. >> >> WDYT? > > I agree. The default behavior of REST should be to return data. > Especially since thee is nothing here to indicate in which syntax to > output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ?
No. If you need only the rendered version of a page you request directly the rendered version, which includes all the document meta data (parent, child, etc.). The only difference is that fields like title and content which are "renderable" are rendered. At least that's what I understood from http://jira.xwiki.org/browse/XWIKI-5820 . Now, if you need both raw and rendered data you have to make indeed 2 requests.
Is the raw title really useful outside of an editor ?
As I said before, I believe the data is more important than the presentation of the data and REST should focus on the data first, i.e. it should expose XWiki data. Right now you can't access the raw document title through REST and this is a serious limitation.
We render the title field in order to display data (from an object field for example) or in order to get a translation. I see what you mean but we're only talking about velocity evaluation here, which is not exactly "presentation".
Hmm, indeed, evaluating the Velocity code from the document title outside of the XWiki context is tricky.
More info:
* we didn't provide the rendered title from the start. Here's the commit that introduced it https://github.com/xwiki/xwiki-platform/commit/2f47139e21bc0ea1d7210d6bc9cf4... * there are resources that return the raw title. I found /xwiki/rest/wikis/xwiki/pages so there's clearly an inconsistency.
Why not returning both under different keys ? Ultimately, maybe such case should probably be addressed using a sort of "aspect" API parameter for all rest APIs, that would allow the consumer to precise what kind of response they expect : row value, data for human presentation, etc. Jerome
Thanks, Marius
I don't know if there are more use cases for the rendered title versus raw title, but I know that you can get the rendered title from the raw title, but not the other way around. Someone might want to use his own renderer for the title (although that's a bit far fetched :) ).
You can get the rendered title from the raw title only of you're using the API from XWiki itself (and on the server side).
-- Jean-Vincent Drean, XWiki. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Jérôme Velociter Winesquare http://www.winesquare.net/
On Fri, May 11, 2012 at 3:32 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 4:20 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 3:08 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 3:52 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
> On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea > <[email protected]> wrote: >> Hi devs, >> >> While debugging the failing REST integration tests I discovered an >> inconsistency in the page REST resource. Take for instance the >> response returned for this URL: >> >> /xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction >> >> * The returned content is the raw (not rendered) content. In this >> particular case, since the blog post content is saved in the blog post >> object, and also because the blog uses the new sheet system, the raw >> content of Blog.BlogIntroduction page is empty >> >> * The returned title is the display title (i.e. the rendered title). >> In this particular case, since the raw title is empty, but the blog >> post sheet, which controls how the title is displayed, renders the >> 'title' property of the blog post. >> >> The inconsistency is that the content is raw while the title is >> rendered. I think the page REST resource should provide data in the >> first place, so raw title. It could provide the rendered title or >> content additionally, but that is secondary IMO. >> >> WDYT? > > I agree. The default behavior of REST should be to return data. > Especially since thee is nothing here to indicate in which syntax to > output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ?
No. If you need only the rendered version of a page you request directly the rendered version, which includes all the document meta data (parent, child, etc.). The only difference is that fields like title and content which are "renderable" are rendered. At least that's what I understood from http://jira.xwiki.org/browse/XWIKI-5820 . Now, if you need both raw and rendered data you have to make indeed 2 requests.
Is the raw title really useful outside of an editor ?
As I said before, I believe the data is more important than the presentation of the data and REST should focus on the data first, i.e. it should expose XWiki data. Right now you can't access the raw document title through REST and this is a serious limitation.
We render the title field in order to display data (from an object field for example) or in order to get a translation. I see what you mean but we're only talking about velocity evaluation here, which is not exactly "presentation".
Hmm, indeed, evaluating the Velocity code from the document title outside of the XWiki context is tricky.
More info:
* we didn't provide the rendered title from the start. Here's the commit that introduced it https://github.com/xwiki/xwiki-platform/commit/2f47139e21bc0ea1d7210d6bc9cf4... * there are resources that return the raw title. I found /xwiki/rest/wikis/xwiki/pages so there's clearly an inconsistency.
Thanks, Marius
I think I did that commit because before titles were not "velocitizable". The reason is that clients, e.g. XEclipse, need the rendered title in order to display meaningful information about the page. Otherwise a pageId like xwiki:Main.WebHome or, worse, a snippet of velocity code would be unreadable in these context. Note that this is needed even in "not rendered version" for presentation purposes. So XWIKI-5820 would not really solve the issue. I agree that there is an inconsistency which should be solved. To preserve backward compatibility we could just add a "rawTitle" property and put there the not rendered title. -Fabio
I don't know if there are more use cases for the rendered title versus raw title, but I know that you can get the rendered title from the raw title, but not the other way around. Someone might want to use his own renderer for the title (although that's a bit far fetched :) ).
You can get the rendered title from the raw title only of you're using the API from XWiki itself (and on the server side).
-- Jean-Vincent Drean, XWiki. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Fri, May 11, 2012 at 3:08 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 3:52 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ?
No. If you need only the rendered version of a page you request directly the rendered version, which includes all the document meta data (parent, child, etc.). The only difference is that fields like title and content which are "renderable" are rendered. At least that's what I understood from http://jira.xwiki.org/browse/XWIKI-5820 . Now, if you need both raw and rendered data you have to make indeed 2 requests.
As a side note about XWIKI-5820... What I meant with that improvement is that when you send an accept header (or a query parameter) with a particular format, you will receive data in *that* format. So there is no XML here. When you ask for HTML, you will retrieve the html equivalent of the rendered page (which possibly contains also the title) When you ask for a PDF, you will retrieve the PDF When you ask for Markdown, you will retrieve a txt file with the markdown rendered page (which possibly contains also the title) So this resource will not send the same XML as the page resource with the renderable fields rendered, but sends a totally different media type, depending on the accept header (or query parameter) -Fabio
Is the raw title really useful outside of an editor ?
As I said before, I believe the data is more important than the presentation of the data and REST should focus on the data first, i.e. it should expose XWiki data. Right now you can't access the raw document title through REST and this is a serious limitation.
I don't know if there are more use cases for the rendered title versus raw title, but I know that you can get the rendered title from the raw title, but not the other way around. Someone might want to use his own renderer for the title (although that's a bit far fetched :) ).
Thanks, Marius
* adding a compatibility flag to control if the value of the "title" property is the rendered document title or the raw document title. * adding a new page resource property, "renderedTitle" (or "displayTitle", to be decided) * use "renderedTitle" in XWiki platform where the rendered title is needed, until we have XWIKI-5820. Deprecate "renderedTitle" property afterwards. * provide the document raw title by default and document in the release notes the flag that can be used to get back the previous behaviour (rendered title)
WDYT?
Thanks, Marius
Thanks -Vincent
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Jean-Vincent Drean, XWiki. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Tue, May 15, 2012 at 1:18 PM, Fabio Mancinelli <[email protected]> wrote:
On Fri, May 11, 2012 at 3:08 PM, Marius Dumitru Florea <[email protected]> wrote:
On Fri, May 11, 2012 at 3:52 PM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 2:31 PM, Marius Dumitru Florea <[email protected]> wrote:
I opened http://jira.xwiki.org/browse/XWIKI-7815 .
On Fri, May 11, 2012 at 11:47 AM, Vincent Massol <[email protected]> wrote:
On May 11, 2012, at 10:35 AM, Thomas Mortagne wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote: > Hi devs, > > While debugging the failing REST integration tests I discovered an > inconsistency in the page REST resource. Take for instance the > response returned for this URL: > > /xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction > > * The returned content is the raw (not rendered) content. In this > particular case, since the blog post content is saved in the blog post > object, and also because the blog uses the new sheet system, the raw > content of Blog.BlogIntroduction page is empty > > * The returned title is the display title (i.e. the rendered title). > In this particular case, since the raw title is empty, but the blog > post sheet, which controls how the title is displayed, renders the > 'title' property of the blog post. > > The inconsistency is that the content is raw while the title is > rendered. I think the page REST resource should provide data in the > first place, so raw title. It could provide the rendered title or > content additionally, but that is secondary IMO. > > WDYT?
I agree. The default behavior of REST should be to return data. Especially since thee is nothing here to indicate in which syntax to output the title.
I agree too. We need to decide how to handle this change though since it's going to break backward compat.
I think the "title" page REST resource property should provide the raw document title on the long run, and the rendered title could be obtained through http://jira.xwiki.org/browse/XWIKI-5820 . So I don't see other solution besides:
But this means that in order to get technical info about a page (parent, children, etc) and the rendered title you'll need to make 2 requests right ?
No. If you need only the rendered version of a page you request directly the rendered version, which includes all the document meta data (parent, child, etc.). The only difference is that fields like title and content which are "renderable" are rendered. At least that's what I understood from http://jira.xwiki.org/browse/XWIKI-5820 . Now, if you need both raw and rendered data you have to make indeed 2 requests.
As a side note about XWIKI-5820...
What I meant with that improvement is that when you send an accept header (or a query parameter) with a particular format, you will receive data in *that* format. So there is no XML here.
When you ask for HTML, you will retrieve the html equivalent of the rendered page (which possibly contains also the title) When you ask for a PDF, you will retrieve the PDF When you ask for Markdown, you will retrieve a txt file with the markdown rendered page (which possibly contains also the title)
So this resource will not send the same XML as the page resource with the renderable fields rendered, but sends a totally different media type, depending on the accept header (or query parameter)
Thanks for the clarification, Marius
-Fabio
Is the raw title really useful outside of an editor ?
As I said before, I believe the data is more important than the presentation of the data and REST should focus on the data first, i.e. it should expose XWiki data. Right now you can't access the raw document title through REST and this is a serious limitation.
I don't know if there are more use cases for the rendered title versus raw title, but I know that you can get the rendered title from the raw title, but not the other way around. Someone might want to use his own renderer for the title (although that's a bit far fetched :) ).
Thanks, Marius
* adding a compatibility flag to control if the value of the "title" property is the rendered document title or the raw document title. * adding a new page resource property, "renderedTitle" (or "displayTitle", to be decided) * use "renderedTitle" in XWiki platform where the rendered title is needed, until we have XWIKI-5820. Deprecate "renderedTitle" property afterwards. * provide the document raw title by default and document in the release notes the flag that can be used to get back the previous behaviour (rendered title)
WDYT?
Thanks, Marius
Thanks -Vincent
> I'll fix the REST integration tests by using a page that doesn't have a sheet. > > Thanks, > Marius
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Jean-Vincent Drean, XWiki. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I think it should provide both the raw and rendered title. I also think we should provide both raw and rendered content, being able to get the raw content is nice when you want to write an editor but I think there are a lot of use cases where you'd like to be able to get the rendered html. Note: the rendered title is used for example in the AllDocs tree.
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Jean-Vincent Drean, XWiki.
On Fri, May 11, 2012 at 10:54 AM, Jean-Vincent Drean <[email protected]> wrote:
On Fri, May 11, 2012 at 10:25 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi devs,
While debugging the failing REST integration tests I discovered an inconsistency in the page REST resource. Take for instance the response returned for this URL:
/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction
* The returned content is the raw (not rendered) content. In this particular case, since the blog post content is saved in the blog post object, and also because the blog uses the new sheet system, the raw content of Blog.BlogIntroduction page is empty
* The returned title is the display title (i.e. the rendered title). In this particular case, since the raw title is empty, but the blog post sheet, which controls how the title is displayed, renders the 'title' property of the blog post.
The inconsistency is that the content is raw while the title is rendered. I think the page REST resource should provide data in the first place, so raw title. It could provide the rendered title or content additionally, but that is secondary IMO.
WDYT?
I think it should provide both the raw and rendered title. I also think we should provide both raw and rendered content, being able to get the raw content is nice when you want to write an editor but I think there are a lot of use cases where you'd like to be able to get the rendered html.
Sure we want to be able to get renderer result in REST but we are talking about default behavior here only. You might get the rendered/content using URL parameters.
Note: the rendered title is used for example in the AllDocs tree.
I'll fix the REST integration tests by using a page that doesn't have a sheet.
Thanks, Marius _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Jean-Vincent Drean, XWiki. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (6)
-
Fabio Mancinelli -
Jean-Vincent Drean -
Jerome Velociter -
Marius Dumitru Florea -
Thomas Mortagne -
Vincent Massol