Skip to content

Commit

Permalink
Update OpenAPIV3_1 import in src/spec/info/index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mearman committed Apr 27, 2024
1 parent d5e1c6f commit 01bdf4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/spec/info/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs";
import { OpenAPIV3_1 } from "openapi-types";
import * as OpenAPITypes from "openapi-types";
import OpenAPIV3_1 = OpenAPITypes.OpenAPIV3_1;
import LicenseObject = OpenAPIV3_1.LicenseObject;

const version: string = JSON.parse(
Expand Down Expand Up @@ -54,7 +55,7 @@ export const info: InfoObject = {
// '[![Open in](https://img.shields.io/badge/Open%20in-Repl.it-F26207?style=for-the-badge&logo=Replit&link=https://repl.it/github/Mearman/openalex-python)](https://repl.it/github/Mearman/openalex-python)',

// '[![Open in](https://img.shields.io/badge/Open%20in-StackBlitz-1269D3?style=for-the-badge&logo=StackBlitz&link=https://stackblitz.com/github/Mearman/openalex-python)](https://stackblitz.com/github/Mearman/openalex-python)'
].join("\n")
].join("\n"),
].join("\n\n"),
"---",
].join("\n\n"),
Expand Down
15 changes: 9 additions & 6 deletions src/util/dereference.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { commandWrapper } from "@redocly/cli/lib/wrapper";
import { BundleOptions, handleBundle } from "@redocly/cli/src/commands/bundle";
// import { BundleOptions, handleBundle } from "@redocly/cli/src/commands/bundle";
import * as cliBundle from "@redocly/cli/lib/commands/bundle";
import fs from "fs";
import { OpenAPI } from "openapi-types";
import { Arguments } from "yargs";
import BundleOptions = cliBundle.BundleOptions;
import handleBundle = cliBundle.handleBundle;

import { makeTempFile } from "~/util/makeTempFile";

export async function dereference(spec: OpenAPI.Document): Promise<OpenAPI.Document> {
export async function dereference(
spec: OpenAPI.Document
): Promise<OpenAPI.Document> {
const output = makeTempFile({}, "dereferenced.json");
const argv: Arguments<BundleOptions> = {
$0: "",
_: undefined,
apis: [
makeTempFile(spec, "openapi.json")
],
apis: [makeTempFile(spec, "openapi.json")],
ext: "json",
lint: true,
dereferenced: true,
output
output,
};
await commandWrapper(handleBundle)(argv);
return JSON.parse(fs.readFileSync(output, "utf8"));
Expand Down

0 comments on commit 01bdf4f

Please sign in to comment.