sparktype
v0.1.3
Published
Generate static types from OpenAPI specifications
Maintainers
Readme
sparktype
Generate static types from OpenAPI specifications.
Installation
npm install -g sparktype
# or
npx sparktype generateUsage
# 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 validateConfiguration
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 interfaceszod- Zod schemas with inferred typespython- Python TypedDict classesgo- Go structs with JSON tags
Documentation
For full documentation, visit: https://github.com/hntrl/sparktype
