feat: correct typing and rename newopenapi importer to openapi

This commit is contained in:
Andrew Bastin
2022-01-07 23:46:20 +05:30
parent a9bd52d154
commit 24fabc8b7b
2 changed files with 6 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
import HoppRESTCollImporter from "./hopp" import HoppRESTCollImporter from "./hopp"
import NewOpenAPIImporter from "./newopenapi" import OpenAPIImporter from "./openapi"
export const RESTCollectionImporters = [ export const RESTCollectionImporters = [
HoppRESTCollImporter, HoppRESTCollImporter,
NewOpenAPIImporter, OpenAPIImporter,
] as const ] as const

View File

@@ -557,20 +557,20 @@ const convertPathToHoppReqs = (
const convertOpenApiDocToHopp = ( const convertOpenApiDocToHopp = (
doc: OpenAPI.Document doc: OpenAPI.Document
): TE.TaskEither<never, Collection<HoppRESTRequest>> => { ): TE.TaskEither<never, Collection<HoppRESTRequest>[]> => {
const name = doc.info.title const name = doc.info.title
const paths = Object.entries(doc.paths ?? {}) const paths = Object.entries(doc.paths ?? {})
.map(([pathName, pathObj]) => convertPathToHoppReqs(doc, pathName, pathObj)) .map(([pathName, pathObj]) => convertPathToHoppReqs(doc, pathName, pathObj))
.flat() .flat()
return TE.of( return TE.of([
makeCollection<HoppRESTRequest>({ makeCollection<HoppRESTRequest>({
name, name,
folders: [], folders: [],
requests: paths, requests: paths,
}) }),
) ])
} }
export default defineImporter({ export default defineImporter({