Skip to content

Commit

Permalink
refactor(oas): address duplication issues
Browse files Browse the repository at this point in the history
closes #224
  • Loading branch information
ostridm committed Feb 16, 2024
1 parent 8da9097 commit 54ca343
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/openapi-sampler/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Schema } from './traverse';
import { OpenAPISchema } from './samplers';
import { OpenAPIV2, OpenAPIV3 } from '@har-sdk/core';

const isObject = <T extends Record<string, unknown>>(obj: T): obj is T =>
Expand Down Expand Up @@ -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 = (
Expand Down

0 comments on commit 54ca343

Please sign in to comment.