openapi-analyzer
Validates MikoPBX API compliance by analyzing OpenAPI 3.1.0 specs against implementation.
Install
mkdir -p .claude/skills/openapi-analyzer && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6422" && unzip -o skill.zip -d .claude/skills/openapi-analyzer && rm skill.zipInstalls to .claude/skills/openapi-analyzer
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Извлечение и анализ OpenAPI 3.1.0 спецификации из MikoPBX для валидации эндпоинтов. Использовать при проверке соответствия API, генерации тестов, проверке схем эндпоинтов или интеграции с навыками endpoint-validator и api-test-generator.Key capabilities
- →Fetch OpenAPI 3.1.0 specification from MikoPBX
- →Extract endpoint parameters, request, and response schemas
- →Validate compliance with OpenAPI 3.1.0 standard
- →Compare code implementations against the OpenAPI definition
- →Generate test data from schema examples and types
- →Provide a Python or CLI interface for automation
How it works
The skill fetches the OpenAPI specification, then analyzes it using a Python analyzer or CLI commands to extract details, validate compliance, compare with code, or generate test data.
Inputs & outputs
When to use openapi-analyzer
- →Validate API endpoint compliance
- →Generate test data from schemas
- →Check documentation completeness
About this skill
MikoPBX OpenAPI Analyzing
Extract and analyze OpenAPI specification to validate endpoints, generate tests, and ensure API compliance.
What This Skill Does
- Fetches OpenAPI 3.1.0 specification from MikoPBX (~9MB, 259 endpoints)
- Extracts endpoint details: parameters, request/response schemas
- Validates compliance with OpenAPI 3.1.0 standard
- Compares code with spec: finds missing parameters and discrepancies
- Generates test data: from schema examples and types
- Provides Python/CLI interface: for automation and integration
When to Use This Skill
This is a helper skill used by other skills and in specific scenarios:
Use automatically with:
mikopbx-endpoint-validator- validates against OpenAPI specmikopbx-api-test-generator- generates tests from spec
Use manually when:
- Validating API compliance before releases
- Checking endpoint documentation completeness
- Generating test data from schemas
- Comparing code implementation with OpenAPI definition
- Creating API documentation
How It Works
- Fetch OpenAPI spec from MikoPBX (internal or external URL)
- Analyze using Python analyzer or CLI commands
- Extract endpoint details (parameters, schemas, responses)
- Validate compliance with OpenAPI 3.1.0 standard
- Compare with code to find discrepancies
- Generate test data or documentation
Quick Start
Step 1: Fetch OpenAPI Specification
The OpenAPI spec is available at two endpoints:
- Internal (no auth):
http://mikopbx-php83.localhost:8081/pbxcore/api/v3/openapi:getSpecification - External (auth required):
https://mikopbx-php83.localhost:8445/pbxcore/api/v3/openapi:getSpecification
Fetch from inside container (recommended):
# Get container ID
CONTAINER_ID=$(docker ps -q -f name=mikopbx)
# Fetch spec
docker exec $CONTAINER_ID curl -s http://mikopbx-php83.localhost:8081/pbxcore/api/v3/openapi:getSpecification > /tmp/mikopbx_openapi.json
# Verify
wc -l /tmp/mikopbx_openapi.json # ~116K lines
ls -lh /tmp/mikopbx_openapi.json # ~9MB
Fetch from outside container (requires Bearer token):
curl -H "Authorization: Bearer $TOKEN" \
https://mikopbx-php83.localhost:8445/pbxcore/api/v3/openapi:getSpecification \
-k > /tmp/mikopbx_openapi.json
Step 2: Use Python Analyzer
The analyzer is located at scripts/openapi_analyzer.py.
Basic usage:
# Get API info
python3 scripts/openapi_analyzer.py info
# List all endpoints
python3 scripts/openapi_analyzer.py list
# Filter endpoints
python3 scripts/openapi_analyzer.py list extensions
# Get endpoint details
python3 scripts/openapi_analyzer.py get "/pbxcore/api/v3/extensions" POST
# Validate endpoint
python3 scripts/openapi_analyzer.py validate "/pbxcore/api/v3/extensions" POST
Python API:
import sys
sys.path.insert(0, 'scripts')
from openapi_analyzer import MikoPBXOpenAPIAnalyzer
# Load analyzer
analyzer = MikoPBXOpenAPIAnalyzer('/tmp/mikopbx_openapi.json')
# Get endpoint
endpoint = analyzer.get_endpoint('/pbxcore/api/v3/extensions', 'POST')
print(endpoint['summary'])
print(endpoint['requestBody']['required'])
# Validate compliance
result = analyzer.validate_endpoint_compliance('/pbxcore/api/v3/extensions', 'POST')
print(f"Valid: {result['valid']}, Score: {result['score']}/100")
# Generate test data
test_data = analyzer.generate_test_data(endpoint)
print(test_data)
Top 5 Use Cases
Use Case 1: Validate Endpoint Compliance
Check if endpoint meets OpenAPI 3.1.0 standards.
# Validate single endpoint
python3 scripts/openapi_analyzer.py validate "/pbxcore/api/v3/extensions" POST
Output:
{
"valid": true,
"issues": [],
"warnings": [],
"score": 100
}
What it checks:
- ✓ Has
summaryandoperationId - ✓ POST/PUT/PATCH has
requestBody - ✓ Has
responsesdefined - ✓ Has expected response codes (200, 400, 404, etc.)
Use Case 2: Compare OpenAPI with Code
Find discrepancies between spec and DataStructure implementation.
import sys
sys.path.insert(0, 'scripts')
from openapi_analyzer import MikoPBXOpenAPIAnalyzer
analyzer = MikoPBXOpenAPIAnalyzer()
endpoint = analyzer.get_endpoint('/pbxcore/api/v3/extensions', 'POST')
# Parameters from your DataStructure.php
code_params = ['number', 'type', 'callerid', 'userid', 'internal_id']
# Compare
comparison = analyzer.compare_with_code(endpoint, code_params)
print(f"Compliance: {comparison['compliance'] * 100:.1f}%")
print(f"In spec only: {comparison['in_spec_only']}")
print(f"In code only: {comparison['in_code_only']}")
print(f"In both: {comparison['in_both']}")
Output:
Compliance: 92.3%
In spec only: {'mobile_number', 'email'}
In code only: {'internal_id'}
In both: {'number', 'type', 'callerid', 'userid'}
Action: Add missing parameters to code or update OpenAPI spec.
Use Case 3: Generate Test Data
Create test data from OpenAPI examples.
analyzer = MikoPBXOpenAPIAnalyzer()
endpoint = analyzer.get_endpoint('/pbxcore/api/v3/extensions', 'POST')
# Generate test data
test_data = analyzer.generate_test_data(endpoint)
print(test_data)
Output:
{
"number": "201", # from example
"type": "SIP", # from enum
"callerid": "Test User", # from example
"userid": "1" # from example
}
Use in tests:
response = requests.post(
f"{BASE_URL}/pbxcore/api/v3/extensions",
json=test_data,
headers=headers
)
assert response.status_code == 201
Use Case 4: Find Endpoints by Pattern
Discover all endpoints related to a resource.
# Find all extension endpoints
python3 scripts/openapi_analyzer.py list extensions
Output:
/pbxcore/api/v3/extensions
/pbxcore/api/v3/extensions/{id}
/pbxcore/api/v3/extensions/{id}:copy
/pbxcore/api/v3/extensions:getDefault
/pbxcore/api/v3/extensions:getForSelect
Use to:
- Explore API structure
- Find custom actions (with
:) - Plan test coverage
- Generate documentation
Use Case 5: Extract Schema Details
Get component schema for data modeling.
# Get Extension schema
python3 scripts/openapi_analyzer.py schema Extension
Output:
{
"type": "object",
"properties": {
"id": {"type": "string"},
"number": {"type": "string", "example": "201"},
"type": {"type": "string", "enum": ["SIP", "IAX", "QUEUE"]},
"callerid": {"type": "string"}
},
"required": ["number", "type"]
}
Extract required fields:
python3 scripts/openapi_analyzer.py schema Extension | jq -r '.required[]'
Use to:
- Validate data models
- Generate TypeScript/PHP interfaces
- Create mock data
- Document data structures
OpenAPI Specification Details
Metadata
- OpenAPI Version: 3.1.0
- API Version: 3.0.0
- Total Endpoints: 259
- Total Schemas: 96
- File Size: ~9MB, 116K lines JSON
Structure
{
"openapi": "3.1.0",
"info": {
"title": "MikoPBX REST API",
"version": "3.0.0"
},
"paths": {
"/pbxcore/api/v3/extensions": {
"get": {...},
"post": {...}
}
},
"components": {
"schemas": {
"Extension": {...},
"ExtensionListItem": {...}
}
}
}
Integration Patterns
With mikopbx-endpoint-validator
# 1. Fetch OpenAPI spec
docker exec $CONTAINER_ID curl -s http://mikopbx-php83.localhost:8081/pbxcore/api/v3/openapi:getSpecification > /tmp/openapi.json
# 2. Get endpoint from OpenAPI
python3 scripts/openapi_analyzer.py get "/pbxcore/api/v3/extensions" POST > /tmp/endpoint.json
# 3. Compare with DataStructure.php
# (Extract params from code, then compare)
# 4. Validate compliance
python3 scripts/openapi_analyzer.py validate "/pbxcore/api/v3/extensions" POST
See integration-examples.md for complete workflows.
With mikopbx-api-test-generator
# Generate pytest test from OpenAPI
analyzer = MikoPBXOpenAPIAnalyzer()
endpoint = analyzer.get_endpoint('/pbxcore/api/v3/extensions', 'POST')
test_data = analyzer.generate_test_data(endpoint)
# Use test_data in generated pytest...
See integration-examples.md for test generation.
Cache Strategy
OpenAPI spec is large (9MB), so cache it:
SPEC_FILE="/tmp/mikopbx_openapi.json"
CACHE_TTL=3600 # 1 hour
# Check cache age
if [ ! -f "$SPEC_FILE" ] || [ $(($(date +%s) - $(stat -f %m "$SPEC_FILE"))) -gt $CACHE_TTL ]; then
echo "Fetching fresh spec..."
docker exec $CONTAINER_ID curl -s http://mikopbx-php83.localhost:8081/pbxcore/api/v3/openapi:getSpecification > "$SPEC_FILE"
else
echo "Using cached spec"
fi
Python caching:
# Good: Create once, reuse
analyzer = MikoPBXOpenAPIAnalyzer()
for path in paths:
endpoint = analyzer.get_endpoint(path, 'GET')
# Bad: Recreates analyzer each time
for path in paths:
analyzer = MikoPBXOpenAPIAnalyzer() # Reloads 9MB file!
Common Patterns
Pattern 1: Batch Validation
Validate all endpoints and find issues:
python3 scripts/openapi_analyzer.py list | while read path; do
for method in GET POST PUT DELETE; do
python3 scripts/openapi_analyzer.py validate "$path" "$method" 2>/dev/null
done
done | jq -s 'map(select(.valid == false))'
Pattern 2: Generate Compliance Report
#!/bin/bash
total=0
valid=0
total_score=0
while read path; do
result=$(python3 scripts/openapi_analyzer.py validate "$path" "POST" 2>/dev/null)
if [ $? -eq 0 ]; then
total=$((total + 1))
[ "$(echo "$result" | jq -r '.valid')" == "true" ] && valid=$((valid + 1))
total_score=$((total_score + $(echo "$result" | jq -r '.score')))
fi
done < <(python3 scripts/openapi_analyzer.py list)
echo "Valid: $valid/$total ($((valid * 100 / total))%)"
echo "Average score: $((total_score / total))/
---
*Content truncated.*
How it compares
This skill provides specific tools to interact with MikoPBX's OpenAPI specification, offering structured analysis and test data generation rather than general API interaction.
Compared to similar skills
openapi-analyzer side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| openapi-analyzer (this skill) | 2 | 9mo | Review | Intermediate |
| swapper-integration | 6 | 5mo | Caution | Intermediate |
| run-api-e2e-tests | 7 | 6mo | Review | Beginner |
| langfuse-ci-integration | 2 | 25d | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by mikopbx
View all by mikopbx →You might also like
swapper-integration
shapeshift
Integrate new DEX aggregators, swappers, or bridge protocols (like Bebop, Portals, Jupiter, 0x, 1inch, etc.) into ShapeShift Web. Activates when user wants to add, integrate, or implement support for a new swapper. Guides through research, implementation, and testing following established patterns.
run-api-e2e-tests
novuhq
Run e2e tests for the API service. Use when the user wants to run API E2E tests.
langfuse-ci-integration
jeremylongshore
Configure Langfuse CI/CD integration with GitHub Actions and automated testing. Use when setting up automated testing, configuring CI pipelines, or integrating Langfuse tests into your build process. Trigger with phrases like "langfuse CI", "langfuse GitHub Actions", "langfuse automated tests", "CI langfuse", "langfuse pipeline".
api-test-generator
mikopbx
Генерация полных Python pytest тестов для REST API эндпоинтов с валидацией схемы. Использовать при создании тестов для новых эндпоинтов, добавлении покрытия для CRUD операций или валидации соответствия API с OpenAPI схемами.
http-generate
spring-ai-alibaba
Generates HTTP request examples for Spring Boot Web interfaces according to task specification and saves them as .http files in module-generate.md directories
twinmind-local-dev-loop
jeremylongshore
Set up local development workflow with TwinMind API integration. Use when building applications that integrate TwinMind transcription, testing API calls locally, or developing meeting automation tools. Trigger with phrases like "twinmind dev setup", "twinmind local development", "twinmind API testing", "build with twinmind".