JSPM

sparktype

0.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1273
  • Score
    100M100P100Q123813F
  • License MIT

Generate static types from OpenAPI specifications

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sparktype) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    sparktype

    Generate static types from OpenAPI specifications.

    Installation

    npm install -g sparktype
    # or
    npx sparktype generate

    Usage

    # Generate types using typegen.jsonc in current directory
    sparktype generate
    
    # Specify config file
    sparktype generate --config ./path/to/typegen.jsonc
    
    # Initialize a new config file
    sparktype init
    
    # Validate config file
    sparktype validate

    Configuration

    Create a typegen.jsonc file:

    {
      "specs": {
        "api": {
          "path": "./openapi.yaml"
        }
      },
      "outputs": [
        {
          "path": "./src/types/api.ts",
          "format": "typescript",
          "spec": "api"
        }
      ]
    }

    Supported Output Formats

    • typescript - TypeScript interfaces
    • zod - Zod schemas with inferred types
    • python - Python TypedDict classes
    • go - Go structs with JSON tags

    Documentation

    For full documentation, visit: https://github.com/hntrl/sparktype