openapi-parser
Parse OpenAPI 3.x / Swagger 2.x specs and extract endpoint information
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Parse OpenAPI 3.x / Swagger 2.x specs and extract endpoint information
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | openapi-parser |
| description | Parse OpenAPI 3.x / Swagger 2.x specs and extract endpoint information |
Parse OpenAPI specifications and extract structured endpoint information for code generation.
When this skill is invoked, Claude MUST perform these steps in order:
Determine source type:
http:// or https:// โ Remote URLFor Remote URL:
WebFetch tool to fetch the contentโ Spec not found at URLโ Failed to fetch: <error>For Local File:
Read tool to read the file.yaml or .yml extension โ Parse as YAML.json extension or no extension โ Parse as JSONโ File not found: <path>โ Invalid format: <error>Check for valid OpenAPI/Swagger structure:
Version Check:
openapi field (e.g., "3.0.0", "3.1.0") โ OpenAPI 3.xswagger field (e.g., "2.0") โ Swagger 2.0โ Not a valid OpenAPI/Swagger specRequired Fields:
info object with title and versionpaths objectโ Missing required field: <field>Report:
๐ OpenAPI: <title> v<version>
Spec version: <openapi/swagger version>
Endpoints: <count>
If Swagger 2.0, convert to OpenAPI 3.0 format internally:
| Swagger 2.0 | OpenAPI 3.0 |
|---|---|
definitions | components.schemas |
parameters (body) | requestBody |
produces/consumes | content with media types |
securityDefinitions | components.securitySchemes |
Extract and store:
{
"title": "<info.title>",
"version": "<info.version>",
"description": "<info.description or null>",
"servers": ["<server urls>"],
"specVersion": "<openapi or swagger version>"
}
For each path in paths object:
Parse each method (GET, POST, PUT, PATCH, DELETE)
Extract:
path: The URL pathmethod: HTTP methodoperationId: Unique identifier (generate if missing)tags: Array of tags (use ["default"] if none)summary: Brief descriptiondescription: Full descriptionparameters: Path, query, header parametersrequestBody: Request body schemaresponses: Response schemas by status codesecurity: Required security schemesGenerate hash for each endpoint (for change detection)
Resolve all $ref references:
$ref strings in the speccomponents.schemas// Circular reference to <TypeName>Organize endpoints by their primary tag:
{
"users": {
"description": "<tag description>",
"endpoints": [
{ "method": "GET", "path": "/users", "operationId": "listUsers" },
{ "method": "POST", "path": "/users", "operationId": "createUser" }
],
"schemas": ["User", "CreateUserRequest"]
}
}
For each schema in components.schemas:
For full error code reference, see ../../docs/ERROR-CODES.md.
Error: "[E201/E202] โ Failed to parse spec: <parse error message>"
Cause: Malformed JSON/YAML syntax
Fix: Validate at jsonlint.com or yamlint.com
Action: Abort and show line number if available
Error: "[E203] โ Not a valid OpenAPI/Swagger specification"
Cause: Missing 'openapi' or 'swagger' field
Fix: Verify file is OpenAPI 3.x or Swagger 2.0 format
Action: Abort operation
Warning: "[E205] โ ๏ธ Unresolved reference: <$ref path>"
Cause: Reference points to non-existent definition
Fix: Check $ref path is correct
Recovery: Use `unknown` type, continue processing
Info: "[E206] โน๏ธ Circular reference detected in <schema name>"
Cause: Self-referencing data structure
Recovery: Use type reference instead of inline expansion
Warning: "[E207] โ ๏ธ Unsupported feature: <feature name> (skipping)"
Features: callbacks, links, webhooks
Recovery: Skip feature, continue processing
Info: "[E405] โน๏ธ Missing operationId for <method> <path>"
Recovery: Generate from method + path (e.g., `get_users_id`)
| OpenAPI Type | TypeScript Type |
|---|---|
string | string |
string (format: date, date-time) | string |
string (format: uuid) | string |
string (format: email) | string |
string (format: binary) | Blob | File |
string (enum) | 'value1' | 'value2' |
integer | number |
integer (format: int64) | number |
number | number |
boolean | boolean |
array | T[] |
object | { [key: string]: unknown } |
object (with properties) | { prop1: T1; prop2?: T2 } |
null | null |
oneOf | T1 | T2 |
anyOf | T1 | T2 |
allOf | T1 & T2 |
$ref | ReferencedTypeName |
required array โ propName: Typerequired โ propName?: Typenullable: true โ propName: Type \| nullFor comprehensive edge case handling (circular references, Swagger 2.0 conversion, large specs, etc.), see ../../docs/EDGE-CASES.md.
Return this structure to the calling command:
{
"meta": {
"title": "My API",
"version": "2.0.0",
"specVersion": "3.0.3",
"servers": ["https://api.example.com"]
},
"hash": {
"spec": "sha256:abc123...",
"fetchedAt": "2024-01-13T12:00:00Z",
"source": "https://api.example.com/openapi.json"
},
"tags": {
"users": {
"description": "User management",
"endpoints": [
{
"method": "GET",
"path": "/users/{id}",
"operationId": "getUser",
"hash": "a1b2c3d4",
"parameters": [...],
"responses": {...}
}
],
"schemas": ["User", "GetUserRequest"]
}
},
"schemas": {
"User": {
"hash": "x1y2z3",
"definition": {
"type": "object",
"properties": {...},
"required": [...]
}
}
},
"stats": {
"endpointCount": 25,
"tagCount": 5,
"schemaCount": 18
}
}
Check and install OpenAPI Sync MCP server dependency
Best practice templates for API layer scaffolding
Detect and analyze FSD layer structure in a project
Generate FSD-compliant slice boilerplate with pattern matching
Check FSD import boundary rules and detect violations
Manage analysis cache for incremental FSD validation