Skip to content

Sending an empty fields parameter results in error #996

Closed
@bart-degreed

Description

@bart-degreed

From the spec at https://jsonapi.org/format/1.1/#fetching-sparse-fieldsets:

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

But when sending the next request:

GET /blogPosts?fields[blogPosts]= HTTP/1.1

An error message is returned:

{
  "id": "fc58e77d-b09c-4cbb-a9a7-2f20370cbf82",
  "status": "400",
  "title": "Missing query string parameter value.",
  "detail": "Missing value for 'fields[blogPosts]' query string parameter.",
  "source": {
    "parameter": "fields[blogPosts]"
  }

This is easily worked around by instead sending:

GET /blogPosts?fields[blogPosts]=id HTTP/1.1

But for correctness, we should allow it.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions