API Normalizer Module
Core API normalization, transformation, and standardization for modern web applications with AI/MCP compatibility.
Module Information
- Name: API Normalizer
- Machine Name:
api_normalizer - Package: API Development
- Version: 0.1.1
- Drupal Compatibility: ^10.5 || ^11
- PHP: >=8.1
- OSSA Compliant: Yes
- Source:
/Users/flux423/Sites/LLM/all_drupal_custom/modules/api_normalizer/
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_normalizer -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_normalizer.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_normalizer.request');
$normalized = $normalizer->normalize($request_data, [
'source_format' => 'third_party_api',
'target_schema' => 'internal_schema',
]);
Transform API Response
<?php
$transformer = \Drupal::service('api_normalizer.response');
$transformed = $transformer->transform($response_data, [
'target_format' => 'json:api',
'include_meta' => true,
]);
Schema Validation
<?php
$validator = \Drupal::service('api_normalizer.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
- Project: https://gitlab.bluefly.io/llm/drupal/api-normalizer
- OSSA: https://gitlab.bluefly.io/llm/ossa