From 54ca3430ea61374c2006e5e4cae098d355341a74 Mon Sep 17 00:00:00 2001 From: Dmitry Ostrikov Date: Fri, 16 Feb 2024 15:44:31 +0400 Subject: [PATCH] refactor(oas): address duplication issues closes #224 --- packages/openapi-sampler/src/utils.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/openapi-sampler/src/utils.ts b/packages/openapi-sampler/src/utils.ts index 402bbbb1..38166129 100644 --- a/packages/openapi-sampler/src/utils.ts +++ b/packages/openapi-sampler/src/utils.ts @@ -1,4 +1,5 @@ import { Schema } from './traverse'; +import { OpenAPISchema } from './samplers'; import { OpenAPIV2, OpenAPIV3 } from '@har-sdk/core'; const isObject = >(obj: T): obj is T => @@ -31,14 +32,10 @@ export const getReplacementForCircular = (type: string) => ({ value: type === 'object' ? {} : type === 'array' ? [] : undefined }); -export const hasExample = ( - schema: Schema -): schema is OpenAPIV3.SchemaObject | OpenAPIV2.SchemaObject => +export const hasExample = (schema: Schema): schema is OpenAPISchema => (schema as any).example !== undefined; -export const hasDefault = ( - schema: Schema -): schema is OpenAPIV3.SchemaObject | OpenAPIV2.SchemaObject => +export const hasDefault = (schema: Schema): schema is OpenAPISchema => (schema as any).default !== undefined; export const isArraySchema = (