plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

Add portal_type title

Open razvanMiu opened this issue 3 years ago • 4 comments

This adds a new field type to content response which contains the title of portal_type.

Example of why this is needed: Let's say I have a content-type named Topic page with the id topic_page. Fetching a page of this content-type will respond with:

{
   '@type': 'topic_page',
   ...
}

There is no way to get the human readable title of the content-type so this pr will add a new field and the response will look like:

{
   '@type': 'topic_page',
   'type': 'Topic page',
   ...
}

razvanMiu avatar Apr 05 '22 13:04 razvanMiu

@razvanMiu thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

mister-roboto avatar Apr 05 '22 13:04 mister-roboto

Fixes partially #1322

erral avatar Apr 05 '22 13:04 erral

Deploy Preview for plone-restapi canceled.

Name Link
Latest commit 9f84b0d902d94b2eeaed044d7800d17146a2a229
Latest deploy log https://app.netlify.com/sites/plone-restapi/deploys/6465495a32eeef0008d3ffce

netlify[bot] avatar May 25 '22 12:05 netlify[bot]

@jenkins-plone-org please run jobs

avoinea avatar Jun 21 '22 08:06 avoinea

@jenkins-plone-org please run jobs

nileshgulia1 avatar Mar 31 '23 13:03 nileshgulia1

Assuming this is for Volto: A mapping from fti id to fti title can be received from state.types. No need to extend the serializers.

ksuess avatar Mar 31 '23 14:03 ksuess

@ksuess Can you detail a little. Is it available for anonymous users?

avoinea avatar Mar 31 '23 14:03 avoinea

@ksuess Can you detail a little. Is it available for anonymous users?

So issue description has to be read as "There is no way to get the human readable title of the content-type as long the user is Anonymous"

ksuess avatar Mar 31 '23 14:03 ksuess

@jensens @tisto What's preventing this for being merged?

avoinea avatar May 04 '23 12:05 avoinea

I think it is okay to get the FTI title property delivered as well.

To overcome the processing overhead I suggest to use the dexterity FTI cache and its lookup_fti method.

As @davisagli mentioned, the naming is confusing and needs some love.

Also, I do not see any documentation added.

jensens avatar May 10 '23 09:05 jensens

I would also suggest that the dozens of changes in this PR that remove a blank line be reverted and put into a separate PR. That should be handled by code quality tools.

stevepiercy avatar May 10 '23 11:05 stevepiercy

I would also suggest that the dozens of changes in this PR that remove a blank line be reverted and put into a separate PR. That should be handled by code quality tools.

Indeed. I just ran make black and make zpretty and saw a lot of files formatted. This happens even if you do it in a fresh clone in master 🤔 .

nileshgulia1 avatar May 10 '23 11:05 nileshgulia1

That should be handled by code quality tools.

This package lacks of plone/meta so, this will solve it once applied here.

jensens avatar May 10 '23 14:05 jensens

@jenkins-plone-org please run jobs

nileshgulia1 avatar May 11 '23 05:05 nileshgulia1

One thing I don't get is where to put the documentation about this extra field? Isn't it self-explanatory with being just added in http-examples?

nileshgulia1 avatar May 11 '23 07:05 nileshgulia1

One thing I don't get is where to put the documentation about this extra field? Isn't it self-explanatory with being just added in http-examples?

@stevepiercy may I head this one over to you?

jensens avatar May 16 '23 23:05 jensens

@jensens, I agree with @nileshgulia1. What do you think is needed in the way of documentation?

I found no place where the REST API authors have documented the keys in a response. Do they want to start?

stevepiercy avatar May 17 '23 00:05 stevepiercy

@jenkins-plone-org please run jobs

nileshgulia1 avatar May 17 '23 07:05 nileshgulia1

@jenkins-plone-org please run jobs

nileshgulia1 avatar May 17 '23 09:05 nileshgulia1

@jenkins-plone-org please run jobs

nileshgulia1 avatar May 17 '23 11:05 nileshgulia1

@jensens okay now from your point of view?

davisagli avatar May 17 '23 11:05 davisagli

@jenkins-plone-org please run jobs

avoinea avatar May 17 '23 15:05 avoinea

@jenkins-plone-org please run jobs

avoinea avatar May 17 '23 21:05 avoinea