Skip to content

Commit 4aa7f0e

Browse files
committed
- Simplified schema generation
1 parent 9a1fa39 commit 4aa7f0e

28 files changed

+354
-828
lines changed

bin/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ program
1010
.version(pkg.version)
1111
.option('--input [value]', 'Path to swagger specification', './spec.json')
1212
.option('--output [value]', 'Output directory', './generated')
13-
.option('--http-client [value]', 'HTTP client to generate [fetch, xhr]', 'fetch')
13+
.option('--client [value]', 'HTTP client to generate [fetch, xhr]', 'fetch')
1414
.parse(process.argv);
1515

1616
const SwaggerCodegen = require(path.resolve(__dirname, '../dist/index.js'));
@@ -19,6 +19,6 @@ if (SwaggerCodegen) {
1919
SwaggerCodegen.generate(
2020
program.input,
2121
program.output,
22-
program.httpClient
22+
program.client
2323
);
2424
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-typescript-codegen",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification.",
55
"author": "Ferdi Koomen",
66
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export enum HttpClient {
1818
* service layer, etc.
1919
* @param input The relative location of the OpenAPI spec.
2020
* @param output The relative location of the output directory.
21-
* @param httpClient: The selected httpClient (fetch or XHR).
21+
* @param httpClient The selected httpClient (fetch or XHR).
2222
*/
2323
export function generate(input: string, output: string, httpClient: HttpClient = HttpClient.FETCH): void {
2424
const inputPath = path.resolve(process.cwd(), input);

src/templates/core/Schema.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/templates/core/getSchema.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/templates/index.hbs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* istanbul ignore file */
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
/* prettier-ignore */
5+
6+
export { ApiError } from './core/ApiError';
7+
export { isSuccess } from './core/isSuccess';
8+
export { OpenAPI } from './core/OpenAPI';
9+
{{#if models}}
10+
11+
{{#each models}}
12+
export { {{{this}}} } from './models/{{{this}}}';
13+
{{/each}}
14+
{{/if}}
15+
{{#if models}}
16+
17+
{{#each models}}
18+
export { ${{{this}}} } from './schemas/${{{this}}}';
19+
{{/each}}
20+
{{/if}}
21+
{{#if services}}
22+
23+
{{#each services}}
24+
export { {{{this}}} } from './services/{{{this}}}';
25+
{{/each}}
26+
{{/if}}

src/templates/index.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ import { {{{this}}} } from './{{{this}}}';
1414
{{else equals export 'enum'}}
1515
{{>exportEnum}}
1616
{{else}}
17-
{{>exportGeneric}}
17+
{{>exportType}}
1818
{{/equals}}

src/templates/models/index.hbs

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)