sscgen-openapi

Convert OpenAPI 3.x/Swagger specifications into KDL Schema DSL REST client files.

3|Updated Nov 9, 2023
One-click install
npx skills add https://github.com/vypivshiy/selector_schema_codegen --skill sscgen-openapi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sscgen-openapi
Source: https://github.com/vypivshiy/selector_schema_codegen/tree/main/.agents/skills/sscgen-openapi
Command: npx skills add https://github.com/vypivshiy/selector_schema_codegen --skill sscgen-openapi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It turns formal API specifications (OpenAPI/Swagger) into ready-to-use, typed KDL DSL client code so you can integrate REST endpoints without manually designing schemas and request/response mappings.

Core Features & Use Cases

  • Deterministic OpenAPI → KDL conversion: transforms YAML/JSON specs into (rest)struct plus json schemas using strict, rule-based mappings.
  • Correct request generation: emits @request blocks with appropriate curl/raw-HTTP formatting for GET/POST (JSON vs form-urlencoded) and placeholder typing.
  • Schema-resolved, linter-verified output: resolves all $ref before generation, orders generated json blocks bottom-up, and requires uv run ssc-gen check ... -f json to pass before delivery.

Quick Start

Convert your OpenAPI file into a complete KDL REST client by asking: convert openapi.yaml to kdl using sscgen-openapi and ensure the generated KDL passes ssc-gen check -f json.

Frequently Asked Questions about sscgen-openapi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert an OpenAPI spec to a typed REST client?

You can convert an OpenAPI 3.x or Swagger specification into a typed KDL Schema DSL REST client file. The process maps OpenAPI types and modifiers precisely into (rest)struct and json schemas while resolving all $ref references.

Can I generate KDL client code from just a subset of OpenAPI endpoints?

Yes, OpenAPI to KDL conversion supports both full-spec and endpoint subset conversion. You can target specific endpoints while still ensuring consistent grouping by servers URL and resolving all schema references.

What's the best way to ensure generated KDL REST clients pass linting checks?

The generated KDL REST client output is designed to be lint-clean. It enforces bottom-up json schema ordering, strict required/nullable handling, and must pass uv run ssc-gen check -f json before delivery.

Does the OpenAPI to KDL conversion handle different HTTP request body formats?

Yes, conversion correctly handles request body formatting for GET and POST methods. It emits @request blocks with appropriate curl or raw-HTTP formatting, distinguishing between JSON and form-urlencoded payloads.

Why does my generated KDL schema fail validation after converting from Swagger?

KDL schema validation may fail if OpenAPI $ref references are not fully resolved or if json blocks are not ordered bottom-up. The conversion process includes error-fix iterations to resolve these structural issues and ensure lint-clean emission.

When do I need to use KDL Schema DSL for REST client generation?

You need KDL Schema DSL when integrating REST endpoints from formal API specifications without manually designing schemas. It transforms OpenAPI/Swagger files into deterministic, typed client code ready for immediate use.