You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The id field is optional in the specification. The validator has enforced id. This causes issues for POST requests, which is one of the main methods used in a RESTful api.
Documentation reference
The current spec of the JSON schema defines the "id" requirements for resource objects as follows:
“Resource objects” appear in a JSON:API document to represent resources.
A resource object MUST contain at least the following top-level members:
id
type
Exception: The id member is not required when the resource object originates at the client and represents a new resource to be created on the server.
This exception is not accounted for with a resource schema.
Overview
The
id
field is optional in the specification. The validator has enforcedid
. This causes issues forPOST
requests, which is one of the main methods used in a RESTful api.Documentation reference
The current spec of the JSON schema defines the "id" requirements for resource objects as follows:
This exception is not accounted for with a resource schema.
Steps to reproduce:
Test the following json using the validator:
This will validate as expected.
Remove the
id
element, as follows:This fails validation, with the first error being:
Data does not match any schemas from "oneOf"
Suggestions for fix
id
field optionalThe text was updated successfully, but these errors were encountered: