jsonapi-validator icon indicating copy to clipboard operation
jsonapi-validator copied to clipboard

Id member not required when resource object represents a new resource to be created on the server

Open dynamiccast opened this issue 8 years ago • 1 comments

Hi,

jsonapi-validator requires resources to have an id https://github.com/elliotttf/jsonapi-validator/blob/master/lib/schema.json#L122

However, there is an exception to this rule in the JSON API specification (http://jsonapi.org/format/#document-resource-objects).

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.

Should jsonapi-validator be updated to take this case into account ?

dynamiccast avatar Jul 06 '16 17:07 dynamiccast

Yes! This is an issue that should be fixed in jsonapi though. You can probably just take that schema and apply it directly.

elliotttf avatar Jul 13 '16 20:07 elliotttf