resolve-api-to-enum

Convert OpenAPI specifications into TypeScript enum or union type definitions.

1|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/riease/vue-backend-template --skill resolve-api-to-enum
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: resolve-api-to-enum
Source: https://github.com/riease/vue-backend-template/tree/main/.agent/skills/resolve-api-to-enum
Command: npx skills add https://github.com/riease/vue-backend-template --skill resolve-api-to-enum

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Converts OpenAPI specifications into reusable TypeScript enum or union type definitions, enabling strong typing and reduced duplication across API clients.

Core Features & Use Cases

  • Extracts enumerated values from schemas (enum) and fixed value sets from parameters.
  • Generates PascalCase type names and optional display-name mappings for UI-friendly labels.
  • Supports both enum declarations and union-type definitions, with sensible defaults and extensibility for domain-specific enums.

Quick Start

Provide the path to your OpenAPI spec (yaml or json) and run the generator to produce types in src/enums.

Frequently Asked Questions about resolve-api-to-enum

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

FAQPage Schema
How do I generate TypeScript enums from OpenAPI specifications?

To generate TypeScript enums from OpenAPI specifications, provide the path to your spec file and run the generator to extract enumerated values and output definitions under src/enums. It reads yaml or json schemas and infers candidate types automatically.

Can I extract fixed value sets from OpenAPI parameters into union types?

Yes, you can extract fixed value sets from OpenAPI parameters into union types. The generator applies to API schemas with enum fields and parameters, converting them into TypeScript union type definitions or enum declarations for reduced duplication.

Does the TypeScript enum generator support display-name mappings for UI labels?

Yes, the TypeScript enum generator supports optional display-name mappings for UI-friendly labels. It generates PascalCase type names alongside these mappings, enabling strong typing and usable labels across API clients.

What is the best way to convert OpenAPI schema enums to TypeScript type definitions?

The best way to convert OpenAPI schema enums to TypeScript type definitions is using an automated generator that reads doc/api files, infers candidate types, and outputs definitions under src/enums with sensible defaults and extensibility for domain-specific enums.

Do I need a specific OpenAPI format to generate TypeScript enums and union types?

You need an OpenAPI specification in yaml or json format to generate TypeScript enums and union types. The generator extracts enumerated values from schemas and fixed value sets from parameters to produce reusable type definitions.

When should I not use automated TypeScript enum generation from OpenAPI specs?

You should not use automated TypeScript enum generation from OpenAPI specs when your API schemas lack fixed value sets or enum fields, as the generator relies on extracting enumerated values to produce meaningful type definitions.