Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6511eaa51b6a7897e843df1f589f6f72871db04f
4ac3f26093f019e2b5603b2c4746102e45d534b8
172 changes: 70 additions & 102 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,19 @@
"prepare": "husky"
},
"overrides": {
"js-yaml": "^4.1.1",
"js-yaml": "^5.2.3",
"lodash": "^4.17.23"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/node": "^26.1.2",
"@workos/oagen": "^0.28.1",
"@workos/oagen-emitters": "^0.22.0",
"@workos/oagen": "^0.29.2",
"@workos/oagen-emitters": "^0.24.0",
"diff2html": "^3.4.56",
"husky": "^9.1.7",
"js-yaml": "^4.1.1",
"openapi-to-postmanv2": "^6.3.1",
"js-yaml": "^5.2.3",
"openapi-to-postmanv2": "^6.3.2",
"tsdown": "^0.22.14",
"tsx": "^4.23.1",
"tsx": "^4.23.9",
"typescript": "^7.0.2"
}
}
2 changes: 1 addition & 1 deletion scripts/postman/generate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import yaml from "js-yaml";
import * as yaml from "js-yaml";
import { convertSpec } from "./lib/convert.js";
import {
nestFolders,
Expand Down
23 changes: 12 additions & 11 deletions scripts/postman/lib/convert.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Converter from "openapi-to-postmanv2";
import type {
ConversionOptions,
ConversionResult,
PostmanCollection,
} from "./types.js";
import Converter, { type Options } from "openapi-to-postmanv2";
import type { PostmanCollection } from "./types.js";

const OPTIONS: ConversionOptions = {
const OPTIONS: Options = {
schemaFaker: true,
requestParametersResolution: "Example",
exampleParametersResolution: "Example",
Expand All @@ -20,16 +16,21 @@ export function convertSpec(
Converter.convert(
{ type: "string", data: specString },
OPTIONS,
(err: Error | null, result: ConversionResult) => {
(err, result) => {
if (err) {
reject(new Error(`Conversion error: ${err.message}`));
return;
}
if (!result.result) {
reject(new Error(`Conversion failed: ${result.reason}`));
if (!result?.result) {
reject(new Error(`Conversion failed: ${result?.reason}`));
return;
}
resolve(result.output[0].data as PostmanCollection);
const output = result.output?.[0];
if (!output) {
reject(new Error("Conversion produced no output"));
return;
}
resolve(output.data as PostmanCollection);
}
);
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/postman/lib/post-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function getRequestBodySchema(
if (!operation?.requestBody?.content?.["application/json"]?.schema)
return null;

let schema = operation.requestBody.content["application/json"].schema;
let schema: OpenApiSchema | null = operation.requestBody.content["application/json"].schema;
if (schema.$ref) {
schema = resolveRef(spec, schema.$ref);
}
Expand Down
Loading
Loading