-
Notifications
You must be signed in to change notification settings - Fork 651
Send schema in OPTIONS requests and index #1415
Conversation
What about collection params? |
Not sure on what to do on that, so still reading the spec to see if they deal with that. Technically, the data we're returning doesn't match the schema, since it's a list of it, and will actually be further different when we change the collection format. |
This allows internal use of OPTIONS requests.
|
Added the schema to the collection OPTIONS responses as well; although the returned data doesn't exactly match the schema (since it's wrapped in a list), the convenience of having the schema available without needing an ID equals it out. @WP-API/amigos #reviewmerge |
|
Discussed briefly with @rmccue about the fact now an |
Send schema in OPTIONS requests and index
Fixes #1222, fixes #1305.
This adds the schema to the body of the OPTIONS request in the following format:
{ "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "post", ... } }Wrapped it here, because we should return argument data at some point as well.
It's also available in both the main index and namespace indexes by setting the
contexttohelp. I picked this pretty arbitrarily, so we can pick something else if anyone has strong feelings:{ "routes": { "/wp/v2/posts/{id}": { "namespace": "wp/v2", "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "post, ... } } } }