logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

api-spec-gateway

A mechanism for interacting with external APIs by leveraging OpenAPI/Swagger definitions. It enforces specification compliance during requests, incorporates API key based authorization, and utilizes response caching to optimize interaction overhead.

Author

api-spec-gateway logo

andersmandersen

No License

Quick Info

GitHub GitHub Stars 0
NPM Weekly Downloads 301
Tools 1
Last Updated 2026-02-19

Tags

swaggerapiopenapiswagger openapiaccess swaggerswagger access

API Specification Interaction Gateway

This server component facilitates controlled engagement with external services by strictly adhering to provided Swagger/OpenAPI schemas. It enables the execution of remote operations while ensuring transactional integrity via specification validation.

Core Capabilities

  • Ingests OpenAPI documentation from a specified remote locator.
  • Executes outbound service calls parameterized by the loaded specification.
  • Supports credential injection for authenticated endpoints (API Key scheme).
  • Implements result and metadata caching to accelerate repeated calls.
  • Validates request payloads and structure against the OpenAPI contract.

Deployment Prerequisites

  1. Install necessary Node packages: bash npm install

  2. Compile source code: bash npm run build

Execution Modes

Development environment activation: bash npm run dev

Production runtime command: bash npm run start

Operational Environment Variables

The gateway requires the following configuration inputs:

  • SWAGGER_URL: The absolute URI pointing to the schema document (mandatory).
  • AUTH_KEY: A secret token for API authentication purposes (optional).

Accessible Interfaces

Interface Resource: spec-definition

  • Identifier: schema://contract
  • Function: Retrieve the complete, currently loaded OpenAPI contract details.

Operation Tool: invokeEndpoint

Execute an operation defined within the specification.

Arguments: - targetPath: The specific resource path being addressed. - httpVerb: The corresponding HTTP method (e.g., GET, POST, PUT). - requestArgs: Map containing dynamic query or path substitution values. - payload: The message body content for non-idempotent requests.

Usage Example: typescript const response = await gateway.tools.invokeEndpoint({ targetPath: "/data/records", httpVerb: "POST", payload: { data: "new_entry" } });

Smithery.ai Deployment Instructions

To containerize and deploy this service onto the Smithery platform, ensure the following artifacts are present:

  1. A Dockerfile defining the execution environment.
  2. A deployment manifest file named smithery.yaml.
  3. A complete and functional TypeScript compilation pipeline.

Smithery Configuration Structure

Configuration mapping within the Smithery deployment context:

{ "swaggerUrl": "https://service.corp.com/v3/api-docs.json", "authKey": "secure-token-here" // Optional credential }

Local Container Validation

  1. Build the service image: bash docker build -t api-gateway-service .

  2. Launch the container, providing necessary secrets: bash docker run -d -e SWAGGER_URL=your-spec-location -e AUTH_KEY=secret-value api-gateway-service

Development Lifecycle

Execution Scripts

  • npm run build: Compiles TypeScript source into executable JavaScript.
  • npm run start: Initiates the server in its optimized, live configuration.
  • npm run dev: Starts the server with live code reloading for rapid iteration.

See Also

`