akua / cli / export

akua export

Convert a Package's Input schema to a standard interchange format. Emits JSON Schema 2020-12 (raw) or OpenAPI 3.1 (Input wrapped under components.schemas). Backed by KCL's resolver + AST walk; field docstrings become description, @ui(...) decorators become x-ui extensions.

akua export --package <path> [--format=<json-schema|openapi>] [--out=<file>]
Not the same as akua render. export is format translation — it doesn't invoke Helm / kro / Kustomize and doesn't need customer inputs. It answers "how do I describe this Package's inputs in a format other tools understand?" Use render when you want deploy-ready manifests; use export when you want a schema for a UI form renderer or API doc generator. See akua render above.

Supported formats

formatoutputfor
json-schema (default)JSON Schema Draft 2020-12 for the Input schemainstall UIs, form renderers (rjsf, JSONForms)
openapiOpenAPI 3.1 with Input under components.schemasAPI docs (Swagger UI, Redoc), client SDK generation, admission-webhook validators

Flags

flagdescription
--package=<path>path to package.k (default ./package.k)
--format=<fmt>json-schema (default) or openapi
--out=<file>write to file (default: stdout)

@ui(...) decorators → x-ui extension

@ui(...) keyword arguments on schema attributes are projected onto the JSON Schema property as the OpenAPI-3.1-compliant x-ui extension. Renderers that recognise it (rjsf, custom form UIs) consume the hints; renderers that don't, ignore them.

schema Input:
    @ui(order=10, group="Identity")
    name: str = "hello"

    @ui(order=20, widget="slider", min=1, max=20)
    replicas: int = 2
{
  "properties": {
    "name": {
      "type": "string",
      "default": "hello",
      "x-ui": {"order": 10, "group": "Identity"}
    },
    "replicas": {
      "type": "integer",
      "default": 2,
      "x-ui": {"order": 20, "widget": "slider", "min": 1, "max": 20}
    }
  }
}

Examples

# JSON Schema for a web form
akua export --package package.k > inputs.schema.json

# OpenAPI 3.1 for API docs
akua export --package package.k --format=openapi > package.openapi.json

# Write to file directly
akua export --package package.k --out=exported/inputs.schema.json

Exit codes

0 success; 1 if package.k lacks an Input schema or has KCL syntax errors; 5 on filesystem errors.