json-api-client
json-api-client copied to clipboard
Check Client-Generated IDs on creating resource
As stated in the spec a client-generated ID along with a request to create a rescource MUST SHOULD be an UUID.
Source: http://jsonapi.org/format/1.0/#crud-creating-client-ids
Client-Generated IDs
A server MAY accept a client-generated ID along with a request to create a resource. An ID MUST be specified with an id key, the value of which MUST be a universally unique identifier. The client SHOULD use a properly generated and formatted UUID as described in RFC 4122 [RFC4122].
The default ID checker should check for UUIDs, but it should be possible to inject a custom checker.
Hi, in some cases it doesn't MUST be an UUID:
NOTE: In some use-cases, such as importing data from another source, it may be possible to use something other than a UUID that is still guaranteed to be globally unique. Do not use anything other than a UUID unless you are 100% confident that the strategy you are using indeed generates globally unique identifiers.
@nebur81 Thanks, I've updated the issue description.