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 NewOpenAPIImporter from "./newopenapi"
import OpenAPIImporter from "./openapi"
export const RESTCollectionImporters = [
HoppRESTCollImporter,
NewOpenAPIImporter,
OpenAPIImporter,
] as const

View File

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