Skip to content

Commit

Permalink
feat: add defineConfig config support ts type
Browse files Browse the repository at this point in the history
  • Loading branch information
liangskyli committed Nov 9, 2023
1 parent 33837cd commit 35903ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 13 additions & 3 deletions packages/openapi-gen-ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Definition } from 'typescript-json-schema';
import { commandCodeGenCli } from './cli/code-gen';
import type { IGenTsDataOpts, IGenTsDataOptsCLI } from './gen';
import genTsData from './gen/index';
import type { OpenapiMethod } from './utils';

Expand All @@ -15,7 +16,16 @@ type PartialAll<T> = {
[P in keyof T]?: PartialAll<T[P]>;
};

export type { IGenTsDataOpts, IGenTsDataOptsCLI } from './gen/index';
export type { IAPIRequest, PartialAll, Definition };
export { commandCodeGenCli };
const defineConfig = (config: IGenTsDataOptsCLI) => {
return config;
};

export { commandCodeGenCli, defineConfig };
export type {
Definition,
IAPIRequest,
IGenTsDataOpts,
IGenTsDataOptsCLI,
PartialAll,
};
export default genTsData;
7 changes: 3 additions & 4 deletions packages/openapi-gen-ts/test/cli/request.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IGenTsDataOptsCLI } from '../../lib';
import { defineConfig } from '../../lib/index.esm';

const config: IGenTsDataOptsCLI = [
export default defineConfig([
{
genTsDir: './test/all-gen-dirs/gen-ts-dir-cli1',
openapiPath: './test/example/openapi/openapiv3-example.json',
Expand All @@ -9,5 +9,4 @@ const config: IGenTsDataOptsCLI = [
genTsDir: './test/all-gen-dirs/gen-ts-dir-cli2',
openapiPath: './test/example/openapi/openapi-v3.yaml',
},
];
export default config;
]);

0 comments on commit 35903ac

Please sign in to comment.