Skip to content

Support partial responses #2210

Closed
Closed
@raderio

Description

Will be very useful to document that API support partial responses.
This will give a strong point when comparing with GraphQL.

Like GET /api/blogposts?fields=author{name,avatar},title,detail

https://www.leliam.com/make-rest-api-to-partial-response-just-like-graphql-@bRyL6nWufIxFXIdNWRdAwN
https://apigee.com/about/blog/technology/restful-api-design-can-your-api-give-developers-just-information-they-need

To achieve this we need a way to check if a string like "author{name,avatar},title,detail" is a valid path in some class. Something like

class User {
    String name;
    String avatar;
    int age;
    // ...
}
class Post {
    User author;
    String title;
    String detail;
    int rating;
    // ...
}

class Request {
    String data;
    @JsonPath(Post.class)
    String fields;
    // ...
}

So, @JsonPath(Post.class) will check if string value is a valid path in Post class.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions