Skip to content

Commit e75bb6f

Browse files
committed
state that the server may send a subset of fields by default
- the subset may be empty - fields[type]= can be used to request no fields - see json-api#1499
1 parent 619d936 commit e75bb6f

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 a subset of the set of fields defined for the resource
1011+
type; an empty set is acceptable.
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
@@ -1151,11 +1151,16 @@ response on a per-type basis by including a `fields[TYPE]` query parameter.
11511151

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

11551156
If a client requests a restricted set of [fields] for a given resource type,
11561157
an endpoint **MUST NOT** include additional [fields] in resource objects of
11571158
that type in its response.
11581159

1160+
If a client does not specify the set of [fields] for a given resource type,
1161+
the server **MAY** send a subset of the set of fields defined for the resource
1162+
type; an empty set is acceptable.
1163+
11591164
```http
11601165
GET /articles?include=author&fields[articles]=title,body&fields[people]=name HTTP/1.1
11611166
Accept: application/vnd.api+json

0 commit comments

Comments
 (0)