-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add partial response collection type #10
Open
sberserker
wants to merge
7
commits into
Edgio:gh-pages
Choose a base branch
from
sberserker:partial_response
base: gh-pages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c646d6f
Add partial response collection type
cc80887
Fix typos
8d068be
Change fields request to json poiters
3f22a03
Update partial response structure
f2d4616
Remove confusing statement
c1ff807
Change PartialCollection to Sparse Field Sets
18a8708
Add hyperlink to json pointers
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,6 +354,36 @@ A `Collection` **MAY** have the following: | |
} | ||
``` | ||
|
||
## <a href="#document-components-collection" id="document-components-collection" class="headerlink"></a> Partial Collection (Optional) | ||
Server **MAY** support an ability to return only specific fields requested by client. | ||
A `PartialCollection` is a type of [node](#document-components-node) used to represent a specific resource fields based on query string parameter | ||
* `fields`: query string parameter comma delimited list of fields. May include nested json fields using json pointers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest "json pointers" is a link to https://tools.ietf.org/html/rfc6901 |
||
Has the same attributes as Collection type except resource items are limited to only requested fields. | ||
```json | ||
{ | ||
"@id": "/users?fields=/given_name,/address/zip", | ||
"@type": "PartialCollection", | ||
"items": [ | ||
{ | ||
"given_name": "Hubert", | ||
"address": { | ||
"zip": "90094" | ||
} | ||
}, | ||
{ | ||
"given_name": "Philip", | ||
"address":{ | ||
"zip": "90094" | ||
} | ||
}, | ||
... | ||
], | ||
"total_items": 20 | ||
} | ||
``` | ||
|
||
|
||
|
||
## <a href="#document-entry-point" id="document-entry-point" class="headerlink"></a> Entry Point | ||
|
||
An `EntryPoint` is a type of [node](#document-components-node) used to represent a resource that clients can use to get more information about an API and provide [links](#document-components-link-collection) to traverse. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our discussion, i think this should become its own section called
Sparse Fields
or something along those lines, instead of creating a PartialCollection. This will allow clients to filter resources by attributes while still maintaining what resource they are filtering.ex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way jsonapi does this is similar: https://jsonapi.org/format/#fetching-includes, though a difference here is that
includes
is additional data that would be fetched if the param was present. Just another example to look at.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like they've added sparse fieldsets to jsonapi now too: https://jsonapi.org/format/#fetching-sparse-fieldsets