Coder Social home page Coder Social logo

Support for relation fields about plone.restapi HOT 5 CLOSED

plone avatar plone commented on July 18, 2024
Support for relation fields

from plone.restapi.

Comments (5)

tisto avatar tisto commented on July 18, 2024

What about a URL to the referenced object (that can be expanded)? We should also add a "parent" pointer (I think I already did that in a branch somewhere). Children are already covered by the JSON-LD "member" list, right?

from plone.restapi.

jone avatar jone commented on July 18, 2024

Yes, sure. I just think we should use the same format (and thus the same code) for such references, e.g.:

{
"@id": "http://nohost/plone/foo/very-important-news",
"title": "Very important news"
}

It would be great if all those pointers look the same.

from plone.restapi.

lukasgraf avatar lukasgraf commented on July 18, 2024

It would be great if all those pointers look the same.

Agreed, as long as we can work with a loose enough definition of "the same" 😀 I'd say "the same" in the sense that it should always be a dictionary with an @id where the complete resource can be found, and 0 - n metadata fields, depending on context (and possibly a client-supplied parameter like field_list).

Because in some contexts, the 95% will be just rendering a link - so the target URL and title might be enough. In other contexts, you'll need more of the metadata of referenced objects (search results for example must already include things like portal type and author to be useful).

from plone.restapi.

tisto avatar tisto commented on July 18, 2024

If you need a different representation of the relations we might want to create another frame to render the JSON differently.

from plone.restapi.

lukasgraf avatar lukasgraf commented on July 18, 2024

Summary representations have been unified in #71.

Relation fields are now serialized to a summary like this, same as parent pointers, children, search results and collection items:

{"@id": "http://nohost/plone/doc1",
 "@type": "Document",
 "title": "Referenceable Document",
 "description": "Lorem Ipsum"
 }

from plone.restapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.