Skip to content

Commit 3cf35bf

Browse files
committed
fix(modules): Change module resolution to node16 to prevent esm import errors, change types library
1 parent 93c92aa commit 3cf35bf

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"dependencies": {
3737
"@apidevtools/json-schema-ref-parser": "^9.0.9",
3838
"json-schema-walker": "^0.0.4",
39+
"openapi-types": "^12.0.0",
3940
"yargs": "^17.5.1"
4041
},
4142
"devDependencies": {
@@ -48,7 +49,6 @@
4849
"eslint-plugin-prettier": "^4.2.1",
4950
"eslint-plugin-unused-imports": "^2.0.0",
5051
"nock": "^13.2.9",
51-
"openapi-typescript": "^5.4.1",
5252
"prettier": "^2.7.1",
5353
"typescript": "^4.7.4",
5454
"vitest": "^0.21.0"

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
import type { Options, SchemaType, SchemaTypeKeys } from './types';
88
import { Walker } from 'json-schema-walker';
99
import { allowedKeywords } from './const.js';
10-
import type { OpenAPI3 } from 'openapi-typescript';
10+
import type { OpenAPIV3 } from 'openapi-types';
1111

1212
class InvalidTypeError extends Error {
1313
constructor(message: string) {
@@ -62,7 +62,7 @@ const handleDefinition = async <T>(
6262
const convert = async <T = JSONSchema>(
6363
schema: T,
6464
options?: Options
65-
): Promise<OpenAPI3> => {
65+
): Promise<OpenAPIV3.Document> => {
6666
const walker = new Walker<T>();
6767
const convertDefs = options?.convertUnreferencedDefinitions ?? true;
6868
await walker.loadSchema(schema, options);
@@ -75,7 +75,7 @@ const convert = async <T = JSONSchema>(
7575
rootSchema.definitions[defName] = await handleDefinition(def, schema);
7676
}
7777
}
78-
return rootSchema as OpenAPI3;
78+
return rootSchema as OpenAPIV3.Document;
7979
};
8080

8181
function stripIllegalKeywords(schema: SchemaType) {

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lib": ["esnext"],
1313
"listEmittedFiles": false,
1414
"listFiles": false,
15-
"moduleResolution": "node",
15+
"moduleResolution": "node16",
1616
"noFallthroughCasesInSwitch": true,
1717
"pretty": true,
1818
"resolveJsonModule": true,

0 commit comments

Comments
 (0)