From 905f9df8feb302c34ec59f65bdfc3dc3aeacced4 Mon Sep 17 00:00:00 2001 From: anymaniax Date: Thu, 12 Nov 2020 18:29:21 +0100 Subject: [PATCH] fix(writers): schemas check if index.ts exist --- src/core/writers/schemas.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/writers/schemas.ts b/src/core/writers/schemas.ts index 904769952..5b2e2d2ae 100644 --- a/src/core/writers/schemas.ts +++ b/src/core/writers/schemas.ts @@ -1,4 +1,4 @@ -import { existsSync, mkdirSync } from 'fs'; +import { existsSync, mkdirSync, writeFileSync } from 'fs'; import { InfoObject } from 'openapi3-ts'; import { join } from 'path'; import { OutputOptions } from '../../types'; @@ -26,7 +26,9 @@ export const writeSchemas = ({ mkdirSync(schemaPath); } - /* writeFileSync(join(schemaPath, '/index.ts'), ''); */ + if (!existsSync(schemaPath + '/index.ts')) { + writeFileSync(join(schemaPath, '/index.ts'), ''); + } writeModels(schemas, schemaPath, info); };