Skip to content
Draft
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
rules: {
"import/order": "error",
"import/namespace": "off",
"import/no-unresolved": ["error", { ignore: ["^inversify$"] }],
"@typescript-eslint/typedef": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/explicit-function-return-type": "off",
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.js$": "ts-jest",
},
transformIgnorePatterns: [
"/node_modules/(?!(inversify|@inversifyjs)/)",
],
testEnvironment: "node",
moduleFileExtensions: ["ts", "js", "json", "node"],
moduleNameMapper: {},
Expand Down
8 changes: 4 additions & 4 deletions lib/generator/exampleGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ export default class Generator {
type pathNode = string | number;
type pathNodes = pathNode[];

const requestPaths = _.paths(example.parameters, { pathFormat: "array" }).map((v) =>
(v as pathNode[]).reverse()
);
const requestPaths: pathNodes[] = (
_.paths(example.parameters, { pathFormat: "array" }) as pathNode[][]
).map((v) => v.reverse());

/**
* construct a inverted index , the key is leaf property key, value is reverse of the path from the root to the leaf property.
Expand Down Expand Up @@ -315,7 +315,7 @@ export default class Generator {
*/
const res = _.mapValuesDeep(
example.responses,
(value, key, parentValue, context) => {
(value: any, key: string | number, parentValue: any, context: any) => {
if (!parentValue) {
log.warn(`parent is null`);
}
Expand Down
66 changes: 33 additions & 33 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"difflib": "0.2.4",
"fast-json-stable-stringify": "^2.1.0",
"glob": "^13.0.0",
"inversify": "^7.10.1",
"inversify": "^8.1.0",
"js-yaml": "^4.1.0",
"json-pointer": "0.6.2",
"json-schema-traverse": "0.4.1",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
/* Basic Options */
"target": "es2018" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"module": "node20" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
Expand Down Expand Up @@ -37,7 +37,7 @@
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"moduleResolution": "node16", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
Expand Down