#!/usr/bin/env -S node --conditions=bun /** * convert — turn the Metabase OpenAPI spec into a Smithy 2.0 JSON model. * * Input: specs/spec-mirror-metabase/specs/openapi.json (spec submodule) * patches/*.patch.json (RFC-6902 patches to the OpenAPI document) * Output: .generated-specs/metabase.json * * The OpenAPI→Smithy converter lives in * `@distilled.cloud/dev/codegen/openapi`; this script is Metabase's * pipeline config. `scripts/generate.ts` compiles the model into src/services. */ import * as path from "node:path"; import { runOpenApiConvert } from "@distilled.cloud/dev/codegen/openapi-cli"; await runOpenApiConvert({ root: path.resolve(import.meta.dirname, ".."), specs: [ { name: "metabase", specPath: "specs/spec-mirror-metabase/specs/openapi.json", }, ], // OpenAPI-document patches (v0 layout: flat patches/*.patch.json). The // smithy-model patch chain in generate.ts is disabled (`patchesDir: false`). patchesDir: "patches", options: { namespace: "com.metabase.api", serviceName: "Metabase", skipDeprecated: true, }, });