8000 Merge pull request #1500 from freddrake/default-fields-may-be-subset · roy-coder/json-api@1a57180 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a57180

Browse files
authored
Merge pull request json-api#1500 from freddrake/default-fields-may-be-subset
state that the server may send a subset of fields by default
2 parents a029635 + 2d9a681 commit 1a57180

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

_format/1.0/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,11 +1000,16 @@ response on a per-type basis by including a `fields[TYPE]` parameter.
10001000

10011001
The value of the `fields` parameter **MUST** be a comma-separated (U+002C
10021002
COMMA, ",") list that refers to the name(s) of the fields to be returned.
1003+
An empty value indicates that no fields should be returned.
10031004

10041005
If a client requests a restricted set of [fields] for a given resource type,
10051006
an endpoint **MUST NOT** include additional [fields] in resource objects of
10061007
that type in its response.
10071008

1009+
If a client does not specify the set of [fields] for a given resource type,
1010+
the server **MAY** send all fields, a subset of fields, or no fields for that
1011+
resource type.
1012+
10081013
```http
10091014
GET /articles?include=author&fields[articles]=title,body&fields[people]=name HTTP/1.1
10101015
Accept: application/vnd.api+json

_format/1.1/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,11 +1322,16 @@ response on a per-type basis by including a `fields[TYPE]` query parameter.
13221322

13231323
The value of any `fields[TYPE]` parameter **MUST** be a comma-separated (U+002C
13241324
COMMA, ",") list that refers to the name(s) of the fields to be returned.
1325+
An empty value indicates that no fields should be returned.
13251326

13261327
If a client requests a restricted set of [fields] for a given resource type,
13271328
an endpoint **MUST NOT** include additional [fields] in resource objects of
13281329
that type in its response.
13291330

1331+
If a client does not specify the set of [fields] for a given resource type, the
1332+
server **MAY** send all fields, a subset of fields, or no fields for that
1333+
resource type.
1334+
13301335
```http
13311336
GET /articles?include=author&fields[articles]=title,body&fields[people]=name HTTP/1.1
13321337
Accept: application/vnd.api+json

0 commit comments

Comments
 (0)
0