Skip to main content

API Normalizer Module

API Normalizer Module

** MIGRATED**: This content has been moved to the api-normalizer project wiki.

For project-specific documentation: See api-normalizer.wiki

Separation of Duties: See Separation of Duties - Drupal modules are responsible for Drupal-specific functionality. They do NOT own agent manifests, execution, or OSSA spec.

This module documentation has been migrated to the api-normalizer project wiki to follow separation of duties.

Module Information

  • Name: API Normalizer
  • Machine Name: api_normalization
  • Package: API Development
  • Version: 0.1.1
  • Drupal Compatibility: ^10.5 || ^11
  • PHP: >=8.1
  • OSSA Compliant: Yes
  • Source: $LLM_ROOT/all_drupal_custom/modules/api_normalization/

Features

Core API Features

  • Request Normalization: Standardize incoming API requests
  • Response Transformation: Transform responses to internal schema
  • Schema Validation: Validate against defined schemas
  • Cross-Platform Compatibility: Support for multiple API standards

Performance Features

  • Intelligent Caching: Cache normalized responses
  • Lazy Loading: Load normalizers on demand
  • Request Optimization: Optimize API calls
  • Conditional Services: Load services only when needed

Security Features

  • Input Validation: Comprehensive input sanitization
  • Output Sanitization: Secure output transformation
  • Authentication Integration: JWT, OAuth, API keys

Installation

composer require drupal/api-normalizer drush en api_normalization -y

Dependencies

Core Required

  • drupal:system (>=10.3)
  • drupal:user (>=10.3)
  • drupal:field (>=10.3)
  • drupal:serialization
  • drupal:rest
  • drupal:jsonapi
  • drupal:key

API Modules

  • graphql:graphql
  • graphql_compose:graphql_compose
  • openapi_ui_redoc:openapi_ui_redoc
  • openapi_jsonapi:openapi_jsonapi

Optional

  • drupal:eck
  • drupal:field_group
  • drupal:field_permissions
  • views_bulk_operations:views_bulk_operations
  • jwt:jwt
  • redis:redis
  • advancedqueue:advancedqueue
  • drupal:ai
  • drupal:ai_automators
  • gov_compliance:gov_compliance
  • llm:llm
  • ai_agents_orchestra:ai_agents_orchestra

Configuration

Navigate to: /admin/config/api-normalizer

# config/api_normalization.settings.yml normalization: cache_enabled: true cache_ttl: 3600 validation_strict: true schema_format: 'json-schema'

Usage

Normalize API Request

<?php $normalizer = \Drupal::service('api_normalization.request'); $normalized = $normalizer->normalize($request_data, [ 'source_format' => 'third_party_api', 'target_schema' => 'internal_schema', ]);

Transform API Response

<?php $transformer = \Drupal::service('api_normalization.response'); $transformed = $transformer->transform($response_data, [ 'target_format' => 'json:api', 'include_meta' => true, ]);

Schema Validation

<?php $validator = \Drupal::service('api_normalization.validator'); $result = $validator->validate($data, 'schema_name'); if (!$result->isValid()) { foreach ($result->getErrors() as $error) { // Handle validation error } }

API Documentation

Access at:

  • ReDoc: /admin/api/redoc
  • GraphQL: /graphql/explorer

Resources

See Also