
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
github.com/patricksimonian/k8s-mock-server-generator/openapi-ir-processor
This Go program, openapi-ir-processor
, transforms a fully dereferenced OpenAPI (Swagger 2.0) specification into an intermediate representation (IR) suitable for further processing by other tools, such as code generators.
{id}
) to Express-style variables (e.g., :id
).swagger-spec-dereferencer
to prepare your specification.Clone the Repository:
git clone <repository_url>
cd openapi-ir-processor
Build the Program:
go build
Prepare Your OpenAPI Specification:
Ensure you have a fully dereferenced OpenAPI specification file (e.g., dereferenced_swagger.json
).
Run the Program: Provide the path to your dereferenced OpenAPI specification as a command-line argument.
./openapi-ir-processor dereferenced_swagger.json
Output: The program will output the extracted endpoint information to the console, including method, path, operation ID, summary, description, tags, parameters, and responses. Optionally it will also output the full IR as JSON.
Example output:
Endpoint: GET /api/v1/pets/:id (OperationID: get_api_v1_pets_{id})
Summary: Get a pet by ID
Description: Retrieves a pet based on the ID supplied
Tags: [pets]
Parameters:
- "id" (path) required: true
Responses:
200: Successful operation, Schema: &{...}
--- Full IR ---
{
"Title": "Petstore API",
"Version": "1.0.0",
"BasePath": "/api/v1",
"Endpoints": [
{
"OperationID": "get_api_v1_pets_{id}",
"Method": "get",
"Path": "/api/v1/pets/:id",
"Summary": "Get a pet by ID",
"Description": "Retrieves a pet based on the ID supplied",
"Tags": [
"pets"
],
"Parameters": [
{
"Name": "id",
"In": "path",
"Required": true,
"Type": "",
"Description": "",
"Schema": null
}
],
"Responses": {
"200": {
"StatusCode": "200",
"Description": "Successful operation",
"Schema": {...}
}
}
},
...
],
"Models": {
"Pet": {...}
}
}
Contributions, improvements, and bug reports are welcome. Please open an issue or submit a pull request with your changes.
This project is licensed under the MIT License.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.