From b6eaa4cf85c489c241ac0423f3f15d82d30db183 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Mon, 11 Sep 2023 15:37:48 -0500 Subject: [PATCH] chore: bump oas and friends to get tests working --- __tests__/lib/analyzeOas.test.ts | 2 +- package-lock.json | 58 ++++++++++++++++---------------- package.json | 4 +-- src/cmds/openapi/convert.ts | 2 +- src/cmds/openapi/inspect.ts | 2 +- src/cmds/openapi/reduce.ts | 8 ++--- src/lib/analyzeOas.ts | 6 ++-- src/lib/prepareOas.ts | 6 ++-- 8 files changed, 42 insertions(+), 46 deletions(-) diff --git a/__tests__/lib/analyzeOas.test.ts b/__tests__/lib/analyzeOas.test.ts index 68cffd69b..53ffd08f8 100644 --- a/__tests__/lib/analyzeOas.test.ts +++ b/__tests__/lib/analyzeOas.test.ts @@ -1,4 +1,4 @@ -import type { OASDocument } from 'oas/dist/rmoas.types.js'; +import type { OASDocument } from 'oas/rmoas.types'; import petstore from '@readme/oas-examples/3.0/json/petstore.json' assert { type: 'json' }; import { describe, it, expect } from 'vitest'; diff --git a/package-lock.json b/package-lock.json index ff5597ef8..413c1e834 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,8 +23,8 @@ "ignore": "^5.2.0", "mime-types": "^2.1.35", "node-fetch": "^2.6.1", - "oas": "^20.10.2", - "oas-normalize": "^8.4.1", + "oas": "^21.0.3", + "oas-normalize": "^9.0.0", "open": "^8.2.1", "ora": "^5.4.1", "parse-link-header": "^2.0.0", @@ -10226,9 +10226,9 @@ } }, "node_modules/oas": { - "version": "20.10.3", - "resolved": "https://registry.npmjs.org/oas/-/oas-20.10.3.tgz", - "integrity": "sha512-dBxDuwn2ssggPMOqEKEzT4sjCqbkol8JozuWrpwD7chcmbKbverj5vpk2kmsczeyguFkLcKUOMcqUUimf9h+IQ==", + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/oas/-/oas-21.0.3.tgz", + "integrity": "sha512-UnC+oqUJq3HIw3d8MlvoCrNGCuKe7i9FeB9ipX0JUqwgb9g7JKTyzOHpmUKhy0MqMOA0FePnP+883PoHAfep2Q==", "dependencies": { "@readme/json-schema-ref-parser": "^1.2.0", "@types/json-schema": "^7.0.11", @@ -10236,13 +10236,13 @@ "jsonpath-plus": "^7.2.0", "jsonpointer": "^5.0.0", "memoizee": "^0.4.14", - "oas-normalize": "^8.4.0", + "oas-normalize": "^9.0.0", "openapi-types": "^12.1.1", "path-to-regexp": "^6.2.0", - "remove-undefined-objects": "^3.0.0" + "remove-undefined-objects": "^4.0.2" }, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/oas-kit-common": { @@ -10267,15 +10267,15 @@ } }, "node_modules/oas-normalize": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-8.4.1.tgz", - "integrity": "sha512-cGODg+AntZteJRHBiYDWKtcO2svWGMXuFWYu2I8b4hOrNiwB3hgDs/ScX3O9mYm6RpLsUIftt6rDHGc8eYG8aA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-9.0.0.tgz", + "integrity": "sha512-6G4uRemkP3YAr73lzJve0F9sbUnn88G5uCkuMSyIMnB4ml6Y6eRL7zpaE/0Oj0IU7zgCw8dszB2HpYOd/kM9rQ==", "dependencies": { "@readme/openapi-parser": "^2.5.0", "@readme/postman-to-openapi": "^4.1.0", "js-yaml": "^4.1.0", - "node-fetch": "^2.6.1", - "openapi-types": "^12.1.0", + "node-fetch": "^2.7.0", + "openapi-types": "^12.1.3", "swagger2openapi": "^7.0.8" }, "engines": { @@ -11689,9 +11689,9 @@ } }, "node_modules/remove-undefined-objects": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-3.0.0.tgz", - "integrity": "sha512-nxG1yYfc/Jxi+bNCBiqKhxVJPE+QvziIOKbD+Dxc93Uisz92v/ZYpo4WR0TJuf+dk2xE8lW2WPJsA3mDFzXy8w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-4.0.2.tgz", + "integrity": "sha512-6Nh52HADM60lhewwWU30ujMzTjYJk4M5q/LhRYLAacP0hTbzjVWiBVlV84U5RsQA4wDKLwkL0r0qJvti2hRLeQ==", "engines": { "node": ">=16" } @@ -22316,9 +22316,9 @@ } }, "oas": { - "version": "20.10.3", - "resolved": "https://registry.npmjs.org/oas/-/oas-20.10.3.tgz", - "integrity": "sha512-dBxDuwn2ssggPMOqEKEzT4sjCqbkol8JozuWrpwD7chcmbKbverj5vpk2kmsczeyguFkLcKUOMcqUUimf9h+IQ==", + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/oas/-/oas-21.0.3.tgz", + "integrity": "sha512-UnC+oqUJq3HIw3d8MlvoCrNGCuKe7i9FeB9ipX0JUqwgb9g7JKTyzOHpmUKhy0MqMOA0FePnP+883PoHAfep2Q==", "requires": { "@readme/json-schema-ref-parser": "^1.2.0", "@types/json-schema": "^7.0.11", @@ -22326,10 +22326,10 @@ "jsonpath-plus": "^7.2.0", "jsonpointer": "^5.0.0", "memoizee": "^0.4.14", - "oas-normalize": "^8.4.0", + "oas-normalize": "^9.0.0", "openapi-types": "^12.1.1", "path-to-regexp": "^6.2.0", - "remove-undefined-objects": "^3.0.0" + "remove-undefined-objects": "^4.0.2" } }, "oas-kit-common": { @@ -22351,15 +22351,15 @@ } }, "oas-normalize": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-8.4.1.tgz", - "integrity": "sha512-cGODg+AntZteJRHBiYDWKtcO2svWGMXuFWYu2I8b4hOrNiwB3hgDs/ScX3O9mYm6RpLsUIftt6rDHGc8eYG8aA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-9.0.0.tgz", + "integrity": "sha512-6G4uRemkP3YAr73lzJve0F9sbUnn88G5uCkuMSyIMnB4ml6Y6eRL7zpaE/0Oj0IU7zgCw8dszB2HpYOd/kM9rQ==", "requires": { "@readme/openapi-parser": "^2.5.0", "@readme/postman-to-openapi": "^4.1.0", "js-yaml": "^4.1.0", - "node-fetch": "^2.6.1", - "openapi-types": "^12.1.0", + "node-fetch": "^2.7.0", + "openapi-types": "^12.1.3", "swagger2openapi": "^7.0.8" } }, @@ -23377,9 +23377,9 @@ } }, "remove-undefined-objects": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-3.0.0.tgz", - "integrity": "sha512-nxG1yYfc/Jxi+bNCBiqKhxVJPE+QvziIOKbD+Dxc93Uisz92v/ZYpo4WR0TJuf+dk2xE8lW2WPJsA3mDFzXy8w==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/remove-undefined-objects/-/remove-undefined-objects-4.0.2.tgz", + "integrity": "sha512-6Nh52HADM60lhewwWU30ujMzTjYJk4M5q/LhRYLAacP0hTbzjVWiBVlV84U5RsQA4wDKLwkL0r0qJvti2hRLeQ==" }, "require-directory": { "version": "2.1.1", diff --git a/package.json b/package.json index ad323f6b0..c52434725 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,8 @@ "ignore": "^5.2.0", "mime-types": "^2.1.35", "node-fetch": "^2.6.1", - "oas": "^20.10.2", - "oas-normalize": "^8.4.1", + "oas": "^21.0.3", + "oas-normalize": "^9.0.0", "open": "^8.2.1", "ora": "^5.4.1", "parse-link-header": "^2.0.0", diff --git a/src/cmds/openapi/convert.ts b/src/cmds/openapi/convert.ts index 0dfc135e8..7185540ba 100644 --- a/src/cmds/openapi/convert.ts +++ b/src/cmds/openapi/convert.ts @@ -1,5 +1,5 @@ import type { CommandOptions } from '../../lib/baseCommand.js'; -import type { OASDocument } from 'oas/dist/rmoas.types.js'; +import type { OASDocument } from 'oas/rmoas.types'; import fs from 'node:fs'; import path from 'node:path'; diff --git a/src/cmds/openapi/inspect.ts b/src/cmds/openapi/inspect.ts index c9fa2259f..26746dd07 100644 --- a/src/cmds/openapi/inspect.ts +++ b/src/cmds/openapi/inspect.ts @@ -1,6 +1,6 @@ import type { Analysis, AnalyzedFeature } from '../../lib/analyzeOas.js'; import type { CommandOptions } from '../../lib/baseCommand.js'; -import type { OASDocument } from 'oas/dist/rmoas.types.js'; +import type { OASDocument } from 'oas/rmoas.types'; import chalk from 'chalk'; import config from 'config'; diff --git a/src/cmds/openapi/reduce.ts b/src/cmds/openapi/reduce.ts index 74b48f508..aef3121bb 100644 --- a/src/cmds/openapi/reduce.ts +++ b/src/cmds/openapi/reduce.ts @@ -1,12 +1,12 @@ import type { CommandOptions } from '../../lib/baseCommand.js'; -import type { OASDocument } from 'oas/dist/rmoas.types.js'; +import type { OASDocument } from 'oas/rmoas.types'; import fs from 'node:fs'; import path from 'node:path'; import chalk from 'chalk'; -import OasImport from 'oas'; -import oasReducer from 'oas/dist/lib/reducer.js'; +import Oas from 'oas'; +import oasReducer from 'oas/lib/reducer'; import ora from 'ora'; import prompts from 'prompts'; @@ -16,8 +16,6 @@ import prepareOas from '../../lib/prepareOas.js'; import promptTerminal from '../../lib/promptWrapper.js'; import { validateFilePath } from '../../lib/validatePromptInput.js'; -const Oas = OasImport.default; - interface Options { method?: string[]; out?: string; diff --git a/src/lib/analyzeOas.ts b/src/lib/analyzeOas.ts index 831c765c8..4542a9457 100644 --- a/src/lib/analyzeOas.ts +++ b/src/lib/analyzeOas.ts @@ -1,7 +1,7 @@ -import type { OASAnalysis, OASAnalysisFeature } from 'oas/dist/analyzer'; -import type { OASDocument } from 'oas/dist/rmoas.types.js'; +import type { OASAnalysis, OASAnalysisFeature } from 'oas/analyzer'; +import type { OASDocument } from 'oas/rmoas.types'; -import analyzer from 'oas/dist/analyzer/index.js'; +import analyzer from 'oas/analyzer'; export interface AnalyzedFeature extends OASAnalysisFeature { description: string; diff --git a/src/lib/prepareOas.ts b/src/lib/prepareOas.ts index d5b3da735..a18578496 100644 --- a/src/lib/prepareOas.ts +++ b/src/lib/prepareOas.ts @@ -1,7 +1,7 @@ import type { OpenAPI } from 'openapi-types'; import chalk from 'chalk'; -import OASNormalizeImport, { getAPIDefinitionType } from 'oas-normalize'; +import OASNormalize, { getAPIDefinitionType } from 'oas-normalize'; import ora from 'ora'; import isCI from './isCI.js'; @@ -9,9 +9,7 @@ import { debug, info, oraOptions } from './logger.js'; import promptTerminal from './promptWrapper.js'; import readdirRecursive from './readdirRecursive.js'; -export type SpecFileType = OASNormalizeImport.default['type']; - -const OASNormalize = OASNormalizeImport.default; +export type SpecFileType = OASNormalize.default['type']; interface FoundSpecFile { /** path to the spec file */