Kona 0.1.1
dotnet tool install --global Kona --version 0.1.1
dotnet new tool-manifest
dotnet tool install --local Kona --version 0.1.1
#tool dotnet:?package=Kona&version=0.1.1
nuke :add-package Kona --version 0.1.1
Kona
<img src="https://raw.githubusercontent.com/g5becks/Kona/master/logo.png" alt="Kona Logo" width="300">
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.
Key Features
| Feature | Kona | Hawaii |
|---|---|---|
| Local YAML/YML schemas | ✅ | ❌ |
| Fable/SolidJS optimized | ✅ | ❌ |
promise { } CE |
✅ | ❌ |
Thoth.Fetch |
✅ | ❌ |
| Server-side .NET | ❌ | ✅ |
Why Kona?
Kona generates API clients optimized for SolidJS:
- Local YAML schema support - Use local
.yamlor.ymlschema files directly (not supported in Hawaii) promise { }computation expressions - Works seamlessly with SolidJScreateResourceThoth.Fetch- Native browserfetchAPI, returnsJS.Promise<int * string>- Fable-only - No .NET server-side bloat, focused on client-side excellence
Install
dotnet tool install -g kona
Configuration
Create a kona.json file:
{
"schema": "https://petstore3.swagger.io/api/v3/openapi.json",
"output": "./output",
"project": "PetStore"
}
Using Local YAML Schemas
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
Configuration Options
| 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 |
Supported Schema Formats
| Format | Local File | Remote URL |
|---|---|---|
JSON (.json) |
✅ | ✅ |
YAML (.yaml, .yml) |
✅ | ✅ |
Note: OData schemas are not supported. Kona only supports OpenAPI/Swagger specifications.
Usage with SolidJS
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)
Roadmap
- Generate
createResourcewrapper functions automatically - Generate typed query/mutation hooks for SolidJS
- Optimistic updates support
Credits
Kona is built on Hawaii by Zaid Ajaj. All credit for the core OpenAPI parsing and type generation goes to Hawaii.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Fix README logo display on NuGet.org