dotnet CLI tool to generate type-safe F# and Fable clients from OpenAPI/Swagger services with SolidJS/Thoth.Fetch support
$ dotnet add package Kona
A dotnet CLI tool to generate type-safe Fable clients from OpenAPI/Swagger services, specifically designed for SolidJS applications with native JS.Promise support.
Note: Kona is a fork of Hawaii by Zaid Ajaj. For server-side .NET/F# API clients, use Kiota (Microsoft's official tool) or Hawaii. Kona focuses exclusively on client-side Fable/SolidJS code generation with
promise { }computation expressions and futurecreateResourceintegration.
| Feature | Kona | Hawaii |
|---|---|---|
| Local YAML/YML schemas | ✅ | ❌ |
| Fable/SolidJS optimized | ✅ | ❌ |
promise { } CE | ✅ | ❌ |
Thoth.Fetch | ✅ | ❌ |
| Server-side .NET | ❌ | ✅ |
Kona generates API clients optimized for SolidJS:
.yaml or .yml schema files directly (not supported in Hawaii)promise { } computation expressions - Works seamlessly with SolidJS createResourceThoth.Fetch - Native browser fetch API, returns JS.Promise<int * string>dotnet tool install -g kona
Create a kona.json file:
{
"schema": "https://petstore3.swagger.io/api/v3/openapi.json",
"output": "./output",
"project": "PetStore"
}
Kona supports local YAML/YML schema files—a feature not available in Hawaii:
{
"schema": "./schemas/api.yaml",
"output": "./output",
"project": "MyApi"
}
Run:
kona --config ./kona.json
| Option | Type | Required | Description |
|---|---|---|---|
schema | string | ✅ | URL or local path to OpenAPI/Swagger schema (.json, .yaml, .yml) |
project | string | ✅ | Name of generated project |
output | string | ✅ | Output directory |
resolveReferences | boolean | Resolve external schema references (default: false) | |
emptyDefinitions | "ignore" | "free-form" | Handle empty type definitions (default: ignore) | |
overrideSchema | object | Override schema properties | |
filterTags | string[] | Filter operations by OpenAPI tags |
| Format | Local File | Remote URL |
|---|---|---|
JSON (.json) | ✅ | ✅ |
YAML (.yaml, .yml) | ✅ | ✅ |
Note: OData schemas are not supported. Kona only supports OpenAPI/Swagger specifications.
open Fable.Core.JS
open PetStore
open PetStore.Types
let client = PetStoreClient("https://petstore3.swagger.io/api/v3", [])
// Works directly with SolidJS createResource!
let fetchPets () : JS.Promise<Pet list> =
client.findPetsByStatus("available")
|> Promise.map (function
| FindPetsByStatus.OK pets -> pets
| _ -> [])
// In your SolidJS component
let [pets] = createResource(fetchPets)
createResource wrapper functions automaticallyKona is built on Hawaii by Zaid Ajaj. All credit for the core OpenAPI parsing and type generation goes to Hawaii.
MIT