Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@rmccue
Copy link
Member

@rmccue rmccue commented Jul 22, 2015

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 context to help. 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,
                ...
            }
        }
    }
}

@rmccue rmccue self-assigned this Jul 22, 2015
@rmccue rmccue added this to the 2.0 Beta 4 milestone Jul 22, 2015
@danielbachhuber
Copy link
Member

This adds the schema to the body of the OPTIONS request in the following format:

What about collection params?

@rmccue
Copy link
Member Author

rmccue commented Jul 22, 2015

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.

@rmccue
Copy link
Member Author

rmccue commented Aug 7, 2015

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

@rmccue rmccue added the Review label Aug 7, 2015
@joehoyle
Copy link
Member

joehoyle commented Aug 7, 2015

Discussed briefly with @rmccue about the fact now an OPTIONS request was used to determine Allowed Methods, which it still does - however using that method now will also give the client a (potentially wanted) larger payload.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add schema data to the index(es) Return schema and endpoint args in body of OPTIONS request

4 participants