Skip to content

Commit

Permalink
removed the sonarcloud error
Browse files Browse the repository at this point in the history
  • Loading branch information
ItshMoh committed Sep 7, 2024
1 parent b47f8cf commit 3e618d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ export function convertOpenAPI(input: string | OpenAPIDocument, version: OpenAPI
}

export function convertPostman(input: string, version: OpenAPIConvertVersion, options?: PostmanToAsyncAPIOptions ): string;
export function convertPostman(input: any, version: OpenAPIConvertVersion, options?: PostmanToAsyncAPIOptions): AsyncAPIDocument;
export function convertPostman(input: string | any, version: OpenAPIConvertVersion, options: PostmanToAsyncAPIOptions={}): string | any {
export function convertPostman(input: Record<string,any>, version: OpenAPIConvertVersion, options?: PostmanToAsyncAPIOptions): AsyncAPIDocument;
export function convertPostman(input: string | Record<string,any>, version: OpenAPIConvertVersion, options: PostmanToAsyncAPIOptions={}): string | AsyncAPIDocument {
const { format, document } = serializeInput(input);
const postmantoAsyncapiConverter = postmanConverters[version] as ConvertPostmanFunction;
const postmantoAsyncapiConverter = postmanConverters[version];

const convertedAsyncAPI = postmantoAsyncapiConverter(document as any, options);

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { load } from 'js-yaml';

import type { AsyncAPIDocument, OpenAPIDocument } from "./interfaces";

export function serializeInput(document: string | AsyncAPIDocument | OpenAPIDocument): { format: 'json' | 'yaml', document: AsyncAPIDocument | OpenAPIDocument } | never {
export function serializeInput(document: string | AsyncAPIDocument | OpenAPIDocument | Record<string,any>): { format: 'json' | 'yaml', document: AsyncAPIDocument | OpenAPIDocument } | never {
let triedConvertToYaml = false;
try {
if (typeof document === 'object') {
Expand Down

0 comments on commit 3e618d4

Please sign in to comment.