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

Core Merging Plan for the API #571

@rmccue

Description

@rmccue

The key to getting the API into core is breaking the merge into steps. I've been talking these through with the rest of the team at WCSF, and we're going to break this up into a few basic steps.

Each of these steps has challenges, but the idea is to try and handle these step-by-step to chip away at the larger task.

At the end of each step, we'll stop and make sure we've completed everything we wanted to, ensure we have nothing else to do, then shepherd it into core. The next step doesn't start until the previous is fully complete.

The actual process of finalising each step will be to separate the relevant code into a separate repository, then formatting it as a core patch. These can then be reviewed separately, and merged into WP core at the behest of the core team. (The actual timing for this depends on the release cycles and such, but
this doesn't need to affect our work.)

Step 0: Reinvigorate the two-dot-oh branch      ✓
Step 1: Pushing ahead with infrastructure       ✓
Step 2: Making our core objects available       * YOU ARE HERE
Step 3: Periphery                               .

Step 0: Reinvigorate the two-dot-oh branch

We've decided internally that the resource approach taken on two-dot-oh isn't going to work. In short, the benefits we imagined didn't really turn up, however we did learn some about our approach here. We'll handle that in a later step.

There's plenty that we've done on the two-dot-oh branch that's still applicable, so we should salvage these now before they diverge any further. Ideally, this means no new code, just judicious use of cherry-picking.

  • Cherry-pick non-resource commits from two-dot-oh

    • Dropping backwards compatibility shims
    • Switching to HAL from our custom linking format
    • Switch from */*_raw to *.rendered/*.raw
    • Make the response class generic
  • Cherry-pick (or otherwise bring across) any changes to users.

    (There are some non-resource-related changes in the branch that fix bugs or add features missing on the master branch right now.)

Step 1: Pushing ahead with infrastructure

The first part up for merge is the infrastructure. This is the bare basics to run any sort of API, and will consist primarily of our plugin.php and lib/class-wp-json-server.php files.

Server Code (Routing, Serialisation, etc)

Other Infrastructure

Step 2: Making our core objects available

Once the infrastructure is in core, let's work step-by-step and evaulate our core objects. These are the Core Objects: Posts, Comments, Terms and Users. This also includes meta for each (except terms).

This does not include options or similar (plugins, themes, customiser endpoints,
etc).

(PCTU = Posts, Comments, Terms and Users)

Collections

  • Switch collections to returning objects
  • Return pagination params in response: current page, next link, prev link, total pages, total items

Posts

  • Switch Posts class to extend CPT class
  • Remove Last-Modified header

Comments

Terms

  • Check on status of term_id/term_taxonomy_id unification in core

    (Depending on this, we may need to change the way the API works with IDs.)

Users

  • Conduct extra audit for privacy and security purposes

Options

Schema

Step 3: Periphery

Now that core has the vast majority of the API in place, it's time to worry about all those extras we missed out on the way.

Post-Process

Once the process is complete and the API is merged, we can move on to new features outside our main focus. These can also happen in parallel if we have sufficient resources (i.e. people) to handle these as well.

  • W.org proxy for OAuth 2.0 and centralisation
  • WP.com implementing the API as version 2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions