latest
kure-sh/specDefines the types that the Kure API package generator consumes.
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
88%
Published
a year ago (0.1.2)
kure spec
The spec library package defines the types that the API package generator expects to be fed.
Example
Below is an example of a simple API with one custom resource:
Calculator. Normally, this spec would be generated directly from the operator's codebase, via (e.g.) ingest-go.
import type { APIGroupVersion } from "jsr:@kure/spec"; export const v1alpha1: APIGroupVersion = { apiVersion: "spec.kure.sh/v1alpha1", kind: "APIGroupVersion", api: "example", group: { name: "example.kure.sh", module: null /* root module of API */}, version: 'v1alpha1', dependencies: [ { package: "kubernetes", version: "1.30" }, ], definitions: [ { name: "Calculator", description: "Evaluate a math expression", value: { type: "resource", metadata: { name: "calculators", scope: "namespace", /* ... */}, properties: [ { name: "metadata", value: { type: "reference", target: { scope: { package: "kubernetes", group: { name: "meta", module: "meta" }, version: "v1", }, name: "ObjectMeta" }, } }, { name: "spec", value: { type: "reference", target: { name: "CalculatorSpec" }, } }, { name: "status", value: { type: "reference", target: { name: "CalculatorStatus" }, } }, ] } }, { name: "CalculatorSpec", description: "Defines the input to Calculator", value: { type: "object", properties: [ { name: "expression", value: { type: "string" }, required: true, } ] } }, { name: "CalculatorStatus", description: "Provides the output from Calculator", value: { type: "object", properties: [ { name: "result", value: { type: "optional", // may be `null` value: { type: "integer", size: 32 }, }, required: true, }, { name: "error", description: "If the input expression was invalid, explains the error", value: { type: "string" }, } ] } } ] };
Add Package
deno add jsr:@kure/spec
Import symbol
import * as spec from "@kure/spec";
Import directly with a jsr specifier
import * as spec from "jsr:@kure/spec";
Add Package
pnpm i jsr:@kure/spec
pnpm dlx jsr add @kure/spec
Import symbol
import * as spec from "@kure/spec";
Add Package
yarn add jsr:@kure/spec
yarn dlx jsr add @kure/spec
Import symbol
import * as spec from "@kure/spec";
Add Package
vlt install jsr:@kure/spec
Import symbol
import * as spec from "@kure/spec";
Add Package
npx jsr add @kure/spec
Import symbol
import * as spec from "@kure/spec";
Add Package
bunx jsr add @kure/spec
Import symbol
import * as spec from "@kure/spec";