Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@contractkit/plugin-openapi

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contractkit/plugin-openapi

ContractKit built-in plugin: OpenAPI 3.0 YAML generation

latest
Source
npmnpm
Version
0.8.11
Version published
Maintainers
1
Created
Source

@contractkit/contractkit-plugin-openapi

ContractKit plugin that generates an OpenAPI 3.0 YAML specification from .ck contract and operation files.

Installation

pnpm add @contractkit/contractkit-plugin-openapi

Configuration

{
  "plugins": {
    "@contractkit/contractkit-plugin-openapi": {
      "output": "openapi.yaml",
      "info": {
        "title": "Acme API",
        "version": "1.0.0",
        "description": "Public API for Acme services"
      },
      "servers": [
        { "url": "https://api.acme.com", "description": "Production" },
        { "url": "https://api.staging.acme.com", "description": "Staging" }
      ],
      "security": [{ "bearerAuth": [] }],
      "securitySchemes": {
        "bearerAuth": {
          "type": "http",
          "scheme": "bearer",
          "bearerFormat": "JWT"
        }
      }
    }
  }
}

Options

OptionTypeDefaultDescription
baseDirstringrootDirBase directory for the output file
outputstring"openapi.yaml"Output file path
info.titlestringAPI title in the info block
info.versionstringAPI version in the info block
info.descriptionstringAPI description in the info block
serversarrayList of server objects (url, optional description)
securityarrayGlobal security requirements (e.g. [{ "bearerAuth": [] }])
securitySchemesobjectSecurity scheme definitions added to components.securitySchemes

Security scheme types

typeRequired fieldsDescription
"http"scheme ("bearer" or "basic"), optional bearerFormatHTTP auth (Bearer JWT, Basic, etc.)
"apiKey"name, in ("header" or "query")API key passed in a header or query param
"oauth2"OAuth 2.0
"openIdConnect"OpenID Connect

Output

The plugin writes a single YAML file. All contract declarations become entries in components/schemas. All operation declarations become paths with their HTTP verbs, request bodies, parameters, and response schemas.

Operations marked internal are omitted from the generated spec by default. Set includeInternal: true in the plugin config to include them (e.g. for an internal-use API spec).

Programmatic use

import { createOpenApiPlugin } from '@contractkit/contractkit-plugin-openapi';

const plugin = createOpenApiPlugin({
  output: 'dist/openapi.yaml',
  info: { title: 'My API', version: '2.0.0' },
  servers: [{ url: 'https://api.example.com' }],
});

Keywords

contractkit

FAQs

Package last updated on 15 May 2026

Did you know?

Socket

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.

Install

Related posts