Files
hose-use/scripts/export-workflow-schema.ts
T
gitea a3b64d8c8d chore(repo): consolidate spec artifacts into specs/ and complete README coverage
- Move generated OpenAPI bundles out of dist/ into committed specs/
  (specs/openapi.json, specs/openapi.raw.json); source YAML tree moves
  openapi/ -> specs/openapi/; schemas/workflow-schema.json joins as
  specs/workflow-schema.json
- Update all generators/consumers: bundle-openapi, generate-raw-openapi,
  check-version-sync, bump-version, export-workflow-schema,
  packaging/embedded-openapi
- Rewrite stale .env.example with current HOSE_* environment variables
- Archive stale repo-local enterprise configs (superseded by
  ~/.config/hose-use/enterprises) out of the repo; root enterprises/
  keeps only the tracked example.json plus an explanatory README
- Add missing directory READMEs: approval/contact/message/task/events
  domains, cli/, http/, packaging/
- Fix stale domain doc links in README.domains.md and
  docs/modules/platform.md
2026-10-04 14:00:03 +08:00

32 lines
1019 B
TypeScript

import { writeFileSync, mkdirSync } from "fs";
import { join, dirname } from "path";
import {
WorkflowDetailSchema,
WorkflowTaskSchema,
WorkflowSchema,
} from "../src/domains/platform/types.js";
const OUTPUT_DIR = join(process.cwd(), "specs");
const OUTPUT_FILE = join(OUTPUT_DIR, "workflow-schema.json");
function writeJson(path: string, data: unknown): void {
mkdirSync(dirname(path), { recursive: true });
writeFileSync(path, JSON.stringify(data, null, 2));
}
const workflowDetailJsonSchema = (WorkflowDetailSchema as any).toJSONSchema();
const workflowTaskJsonSchema = (WorkflowTaskSchema as any).toJSONSchema();
const workflowJsonSchema = (WorkflowSchema as any).toJSONSchema();
writeJson(OUTPUT_FILE, {
$schema: "https://json-schema.org/draft/2020-12/schema",
title: "EASO Workflow Schemas",
schemas: {
WorkflowDetail: workflowDetailJsonSchema,
WorkflowTask: workflowTaskJsonSchema,
Workflow: workflowJsonSchema,
},
});
console.log(`Workflow schema written to ${OUTPUT_FILE}`);