Skip to content

Why

Human reviewed 2026-12-01

A module should describe its data, its rules and its actions once. A form, an HTTP endpoint, a Drush command and a Tool API tool can then all come from that description, with the same checks and the same permission.

Core already works much like this for content. Field definitions carry constraints, entities and fields have access of their own, and content forms and JSON:API run the same validation. A new content type can be read and written over JSON:API with no code written for it.

Config and plugin settings have much less. Config entities have access of their own, but no action on them says what it accepts. Config schema says what is stored. Which keys an action takes, who may take it, which values it accepts and how what is entered becomes what is stored are mostly in a form, in PHP that nothing else can read or run.

What that costs today

Drush, HTTP clients, ECA and AI agents change the same data, and each writes the input, the checks and the permission again. Nothing makes the copies agree. A caller learns what is accepted by being refused, or worse, bad data is not refused at all. Config schema does not have to state every restriction, so a rule often exists only in a form's validation. Where the schema does state a constraint, it is not enforced on config save. A module that extends a form extends that form only. Most configuration has no write API at all, so a decoupled site sends an administrator back to a Drupal form or writes its own endpoint.

What one description changes

Today, for config and plugin settings Storage Form written by hand its own input, checks, permission Drush command written by hand its own input, checks, permission HTTP endpoint written by hand its own input, checks, permission Tool API tool written by hand its own input, checks, permission With a resource, every way in is generated Storage Form generated Drush command generated HTTP endpoint generated Tool API tool generated Resource written once one input, one set of checks, one permission per operation
Four ways in with rules of their own, or one resource that all four are generated from. A hand-written form keeps working beside it.

A safer site.

  • The same checks. A value refused at one way in is refused at all of them.
  • The permission is not left to each author. Today a new way in is protected only if its author remembers to check. A way in that runs an operation through the runner has its permission and access asked first, with no check of its own to write.

Clients and AI agents that can find out before they act.

  • What can be done. Every operation, with its input and its permission, is in one list, so an agent or an admin interface can find out what a site offers.
  • What will be accepted. Each operation has a schema to read before calling it.
  • What would happen. A write can be run without saving, and answers what would change and what would be refused (dry runs).

Less for a module to maintain.

  • Rules tested once. A rule in a form is tested by building and submitting the form. An operation is tested without one, and every way in uses the rules that were tested.
  • An extension that reaches everything. A module adds its key to the description once, and every way in has it, the form included once it is generated.

API-first

The API is there as soon as an operation is declared, instead of being added to a form later. A decoupled front end can place a block or save the site settings under the permission core's own page asks.

The description is served as JSON Schema, and every endpoint is in one OpenAPI document (HTTP and OpenAPI). Both are standards that tools outside Drupal already read:

  • Checks before sending. Validators exist for most languages. A client runs the rules that are keywords, such as a length, a pattern or a list of choices, and knows which ones only the server can check (how each lands). Portable Schema's PHP and JavaScript validators give the same answers, so the browser and the server agree on a rule both run.
  • Forms drawn anywhere. The types, labels, descriptions, defaults and choices are in the document, so a JavaScript application can draw the form from it.
  • Input AI agents already take. Tool calling and MCP describe a tool's input in JSON Schema, which is what an operation serves.
  • Clients and documentation. Typed clients, reference pages and mock servers can be generated from an OpenAPI document.
  • A contract that can be compared. Form arrays may change in a minor release, so code that alters a form has nothing firm to depend on. Two versions of a schema can be compared in a build, so a breaking change is found before release.

Core uses JSON Schema already, for component props and for what its normalizers output. This adds what an action accepts.

TBD

HTTP and OpenAPI are assumed. Where they live, in core or in a module, is open.

Why in core

The data most modules act on is core's: content types, fields, blocks, site settings. In a contributed module, someone other than the owner has to describe it, and two modules can describe the same thing differently. In core, each has one description, kept by the maintainers of the code it describes, that contributed modules can extend.

It also has to be there to rely on. A module can drop a hand-written form or a Tool API tool only if the description that replaces it is on every site.

What it asks

Little at the start, and nothing of a module that does not want it. A module adds a resource class beside the code it has, and for simple config a storage class. Its forms, routes, config schema and stored data do not change, and each later step is its own choice (Adopting it). Core takes a small foundation first, then one kind of data at a time, each useful without the next (The path into core).

Questions readers bring

  • Why not Tool API? Tool API has a role in this. Surface takes its idea one step further.
  • Why not forms from config schema? Why one more description is the way to stop writing the others by hand.
  • What it builds on. Constraint plugins, JSON Schema, Form API and the rest, as they are, and what could be written once in place of several times.