Reputation: 330
i have a hypermedia/restful service that exposes collections as (page-able) endpoints. these are serialized as json arrays.
i have a(n automatically generated) json schema for each endpoint and wish to communicate the location of these schemas to the client, but because the endpoints are json arrays, i cannot include a '$schema' property that contains a link to the corresponding schema.
there are a few options i can think of:
wrap the array in a json object that contains the json array alongside the schema link (and any other properties specific to the collection)
provide the schema link as a custom http header parameter
assume the client just 'knows' how to get the schema for an endpoint, without needing to be explicitly told
provide to the client the general format of the schema url at the root level which the client then remembers and uses to generate all the schema links itself
what is the best way to provide json schema links to the client?
Upvotes: 0
Views: 447
Reputation: 330
the json schema core spec recommends the use of the "Content-Type" or "Link" headers, so i'm going to go with that for now.
Upvotes: 3