bluefly / api_normalizer
API standardization and normalization layer for multi-provider AI services
dev-drupal-api-normalizer-20250728-2008
2025-07-29 19:17 UTC
Requires
- php: >=8.1
- drupal/core: ^10.3 || ^11
- drupal/openapi: ^2.3
- drupal/openapi_jsonapi: ^3.0
- drupal/simple_oauth: ^6.0
Requires (Dev)
- drupal/coder: ^8.3
- drupal/core-dev: ^10.3 || ^11
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.7
Suggests
- drupal/ai: AI framework for Drupal
- drupal/encrypt: Field encryption for sensitive data
- drupal/field_group: Group fields in forms and displays
- drupal/health_check: Health check endpoints for services
- drupal/jsonapi_extras: Enhanced JSON:API functionality
- drupal/key: Secure API key storage
- drupal/migrate_plus: Advanced migration capabilities
- drupal/migrate_tools: Migration tools for data import
- drupal/monitoring: Advanced monitoring and alerting
- drupal/openapi_ui: OpenAPI UI for API documentation
- drupal/queue_ui: Queue management interface
- drupal/redis: Redis caching backend for performance
- drupal/views_bulk_operations: Bulk operations on entities
This package is auto-updated.
Last update: 2025-08-25 12:22:11 UTC
README
"navtitle": "api_normalizer" "shortdesc": "Part of the LLM Platform ecosystem" "source": "Last updated: 2025-08-01"
"outputclass": "concept"
API Normalizer - NO BULLSHIT
What it actually does: Smart API routing and provider management with real business logic.
- Multi-provider API normalization (OpenAI, Anthropic, Ollama) with consistent response format
- Automatic provider detection and capability analysis
- Rate limiting, cost optimization, and failover management
- Schema validation and OpenAPI integration with auto-documentation
- Performance monitoring and intelligent routing decisions
- Real API management, not configuration wrappers
Features {#topic-features-2}
- Enterprise-grade architecture
- Comprehensive test coverage
- Security hardened
- Accessibility compliant (WCAG AA)
- Performance optimized
- Full API documentation
- GraphQL integration (merged from graphql_integration)
- AI-powered schema mapping
- OpenAPI schema management
Repository Information {#topic-repository-information-3}
- Type: Drupal Module (Git Submodule)
- GitLab URL: https://gitlab.bluefly.io/llm/api_normalizer
- Submodule Path: web/modules/custom/api_normalizer
- Local Path: ${LLM_WORKSPACE_PATH:-../../../}llm-platform/web/modules/custom/api_normalizer
Integration Steps {#topic-integration-steps-4}
Navigate to Individual Repository
# This module is a git submodule, work in its individual repo cd /path/to/individual/api_normalizer/repository
Copy OpenAPI Specification
cp openapi.yaml ./
Create Contract Testing Structure
mkdir -p tests/src/Functional mkdir -p tests/features
Add PHPUnit Configuration
<!-- phpunit.xml --> <testsuite name="api_normalizer API Contract Tests"> <directory>tests/src/Functional</directory> <file>tests/src/Functional/*ApiContractTest.php</file> </testsuite>
Configure JSON:API Entities
# JSON:API is built into Drupal 10 core, just needs configuration drush en rest restui serialization hal -y drush cr
Update GitLab CI
include: - component: gitlab.bluefly.io/llm/gitlab_components/components/ci-cd/drupal/template@latest - component: gitlab.bluefly.io/llm/gitlab_components/components/testing/comprehensive-testing@latest drupal_api_validation: extends: .drupal_base script: - drush en rest restui serialization hal -y - drush cr - vendor/bin/phpunit tests/src/Functional/*ApiContractTest.php
Commit Changes
git add . git commit -m "feat: implement API-first architecture for Drupal module - Add OpenAPI 3.1 specification with JSON:API endpoints - Implement PHPUnit contract tests - Configure REST and JSON:API endpoints - Enable API-first development workflow 🤖 Generated with API-First Transformation Co-Authored-By: Claude <noreply@anthropic.com>" git push origin main
JSON:API Endpoints {#topic-json-api-endpoints-5}
- Entities: /jsonapi/api_normalizer/api_normalizer
- Custom API: /api/v1/api_normalizer/*
- Health Check: /api/v1/api_normalizer/health
Production Deployment {#topic-production-deployment-6}
- Main Platform: https://llm.llm.bluefly.io/api/v1/api_normalizer
- JSON:API: https://llm.llm.bluefly.io/jsonapi/api_normalizer
- Documentation: https://docs.llm.bluefly.io/api-docs/api_normalizer
Local Development {#topic-local-development-7}
- Main Platform: https://llm.local.bluefly.io/api/v1/api_normalizer
- JSON:API: https://llm.local.bluefly.io/jsonapi/api_normalizer
- Port Access: http://llm.local.bluefly.io:33000/api/v1/api_normalizer
API-First TDD Development Workflow {#topic-api-first-tdd-development-workflow-8}
This module follows the LLM Platform's API-first, test-driven development approach using TDDAI.
Development Commands {#topic-development-commands-9}
# Comprehensive Drupal module analysis (includes UI/UX assessment)
cd web/modules/custom/api_normalizer
node ${LLM_COMMON_NPM_PATH:-../../common_npm}/tddai/dist/cli.js drupal audit . --comprehensive \
--analyze-ui-components \
--check-entity-definitions \
--review-views-displays \
--assess-admin-interfaces \
--identify-missing-frontend \
--create-ux-improvement-plan
# Alternative: Use analyze command with Drupal-specific prompts
node ${LLM_COMMON_NPM_PATH:-../../common_npm}/tddai/dist/cli.js analyze . --context drupal-contrib \
--prompts "ui-components,entity-configs,views-displays,admin-forms,frontend-gaps,ux-plan"
# Start TDD cycle for this module
node ${LLM_COMMON_NPM_PATH:-../../common_npm}/tddai/dist/cli.js tdd cycle --context drupal-module
# Write failing tests first (RED)
node ${LLM_COMMON_NPM_PATH:-../../common_npm}/tddai/dist/cli.js test-gen --module api_normalizer
../../../vendor/bin/phpunit tests/src/Unit/
# Implement minimal code (GREEN)
node ${LLM_COMMON_NPM_PATH:-../../common_npm}/tddai/dist/cli.js generate service <ServiceName> --module api_normalizer --tdd
# Refactor and optimize (REFACTOR)
node ${LLM_COMMON_NPM_PATH:-../../common_npm}/tddai/dist/cli.js improve fix --all --module api_normalizer
# Full contrib-ready assessment (all quality gates)
node ${LLM_COMMON_NPM_PATH:-../../common_npm}/tddai/dist/cli.js drupal ultra-strict . \
--contrib-ready \
--ui-analysis \
--performance-check \
--accessibility-audit
# Standards and quality checks
../../../vendor/bin/phpcs --standard=Drupal,DrupalPractice src/
../../../vendor/bin/phpstan analyse src/
API Standards {#topic-api-standards-10}
- ✅ REST API endpoints with OpenAPI 3.1 specification
- ✅ GraphQL schema extensions where applicable
- ✅ 95% test coverage requirement
- ✅ Drupal 10/11 best practices compliance
- ✅ Service-based architecture with dependency injection
See main project README for complete workflow documentation.