oazapfts
Version:
OpenApi TypeScript client generator
39 lines (38 loc) • 946 B
JavaScript
import { A as c, p } from "./tscodegen-BjtNU8_R.js";
import { t as x } from "./tscodegen-BjtNU8_R.js";
import u from "@apidevtools/swagger-parser";
import f from "swagger2openapi";
const S = ["positional", "object"];
function l(e, t, n) {
return new c(e, t, n).generateApi();
}
function m(e) {
return p(e);
}
async function j(e, t = {}) {
const { doc: n, isConverted: r } = await v(e), o = l(n, t, r), { title: i, version: s } = n.info, a = ["$&", i, s].filter(Boolean).join(`
* `);
return m(o).replace(/^\/\*\*/, a);
}
function d(e) {
return "openapi" in e && e.openapi.startsWith("3");
}
async function v(e) {
const t = await u.bundle(e);
return d(t) ? {
doc: t,
isConverted: !1
} : {
doc: (await f.convertObj(t, {})).openapi,
isConverted: !0
};
}
export {
x as cg,
l as generateAst,
j as generateSource,
S as optsArgumentStyles,
v as parseSpec,
m as printAst
};
//# sourceMappingURL=index.js.map