apisdkgen

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

README

apisdkgen - Go API SDK generator

Go Reference

Generate typed TypeScript, Kotlin, and Swift SDKs and an API reference from Go DTOs and route definitions.

Define an apispec.Config for your routes, then call apisdkgen.Generate from your application's generation command. Keep the specification in sync with the routes your server exposes. See the Go Reference for configuration and output options.

Documentation

Overview

Package apisdkgen generates typed client SDKs and API references. It supports TypeScript, Kotlin, and Swift from Go DTO types and route definitions.

SDK specifications are defined by each package in an exported SDKAPI() function returning an apispec.Config with that API's error-code type. The consumer's gen-api-sdk command registers those specs and chooses output paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(api *API) error

Generate writes configured SDK outputs for one API surface.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API describes one API surface to generate.

func NewAPI

func NewAPI[C ~string](sourceDir string, output OutputConfig, config apispec.Config[C]) API

NewAPI constructs an SDK generation target from a typed API specification.

type OutputConfig

type OutputConfig struct {
	TypeScriptDir string
	KotlinDir     string
	SwiftDir      string
	MarkdownDir   string
}

OutputConfig names the generated output directories for each target.

Directories

Path Synopsis
Package apispec exposes shared API SDK generation specification types.
Package apispec exposes shared API SDK generation specification types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL