elliotttf / jsonapi-validator

21 stars 3 forks source link

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

Open dynamiccast opened 8 years ago

dynamiccast commented 8 years ago

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 ?

elliotttf commented 8 years ago

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