Part of the API ecosystem · 22 projects
This module allows you to manage external APIs directly within Drupal by importing their OpenAPI schemas. It automatically creates Drupal entities for API endpoints and provides admin interfaces for data management, workflow automation, and automatic provider failover without requiring custom code.
Note that some parts of this module were generated via AI assisted coding, but under strict human supervision.
What It Does
Turn any OpenAPI described API into Tool API definitions Drupal can reason about.
Import an OpenAPI 3 document once, and every path and method in it becomes a normalized operation carrying its parameters, request and response schemas, security requirements, and a governance level (read, mutation or higher) derived from the HTTP method. The Tool API submodule turns those operations into tool definitions, so an API described by a spec becomes available to Drupal AI agents without hand writing an integration per endpoint.
Example: import an OpenAPI document and each of its operations is derived as a Tool API definition, named and typed from the spec.
The module describes APIs. It does not call them.
Who It's For
- Site builders exposing an external API to Drupal AI without custom code
- Module developers who need normalized OpenAPI operations as plain PHP value objects instead of parsing specs themselves
- Integrators mapping a spec's JSON Schema onto Drupal Typed Data
Tool API Integration
The key integration. api_normalization_toolapi provides:
OpenApiToolApiAdapter(openapi_operation): converts a normalized operation into a Tool API definition array.OpenApiSchemaToolDeriver: derives one Tool API definition per operation from theapi_normalization.operation_collectorservice.ToolApiAdapterManager: other modules register their own adapters with the#[ToolApiAdapter]attribute and reuse the same normalized operations for a different target format.
Scope: this produces the definitions. Executing an operation against a live API is not part of this module.
Architecture
Drupal core plus one optional contrib dependency. Nothing is reimplemented:
- Configuration entities: each imported document is stored as an
openapi_schemaconfig entity. api_normalization.operation_collector: reads those entities and returns the normalized operations.api_normalization.openapi_parser: decodes YAML and JSON through Drupal core's serialization.api_normalization.schema_normalizer_manager: resolves local$refpointers under explicit limits.- Tool: required only by the Tool API submodule.
Features
OpenAPI Import
- Import OpenAPI 3 documents from an
httporhttpsURL, or from a readable local file, using Drush. - Each document is stored as an
openapi_schemaconfiguration entity. Importing the same name again updates it. - Local
$refpointers are resolved to a nesting depth of 8, within a budget on the total schema copied. Only paths and what operations read (security, security schemes, servers, info) consume budget, so unused components do not. - A document that needs more keeps its remaining references unresolved, sets
refBudgetExhausted, logs a warning, and still imports. External references are left as they are.
Normalized Operations
- One operation per path and HTTP method, as a plain PHP value object.
- Parameters, request schema, response schemas and security requirements per operation.
- A read, mutation or higher governance level derived from the method.
Security
- Rejects a schema source that embeds credentials, including
https://user:pass@host/path, the same with surrounding whitespace, and the scheme relative form//user:pass@host/path. - Fails when a fetched schema declares a server URL carrying credentials, in root, path item or operation
servers, including server variable defaults, because the whole schema is stored. - Failures report a fixed classification only: unreadable source, fetch failed, parse failed, or save failed. Neither the source nor the exception text is logged or printed, because an HTTP client error repeats the full URL a token.
Submodules
- api_normalization_toolapi: exposes normalized OpenAPI operations as Tool API definitions. Requires Tool.
- api_normalization_schemata: maps normalized JSON Schema nodes to Drupal Typed Data types. It describes fields, it does not create them.
Quick Start
composer require drupal/api_normalization drush en api_normalization api_normalization_toolapi drush api-normalization:import petstore https://example.com/openapi.json
The import command takes a name and a source: an http or https URL, or a readable local file. api:import is an alias. The normalized operations are then available through the api_normalization.operation_collector service and as Tool API definitions.
Requirements
- Drupal 11.1 or later, or Drupal 12
- PHP 8.3 or later (Drupal 12 itself requires PHP 8.5)
- Drush, to run the import command
- Tool, for the
api_normalization_toolapisubmodule
The base module depends on Drupal core only. No other contributed modules are required.
Ask your assistant about API Normalization
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the API ecosystem
Most installed first
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0-alpha4 | Pre-release | 10โ11 | Mar 26, 2026 | ||
| 1.0.0-alpha3 | Pre-release | 10โ11 | Feb 17, 2026 | ||
| 1.0.0-alpha2 | Pre-release | 10โ11 | Jan 30, 2026 | ||
| 1.0.0-alpha1 | Pre-release | 10โ11 | Jan 25, 2026 |