feat: correct typing and rename newopenapi importer to openapi
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import HoppRESTCollImporter from "./hopp"
|
||||
import NewOpenAPIImporter from "./newopenapi"
|
||||
import OpenAPIImporter from "./openapi"
|
||||
|
||||
export const RESTCollectionImporters = [
|
||||
HoppRESTCollImporter,
|
||||
NewOpenAPIImporter,
|
||||
OpenAPIImporter,
|
||||
] as const
|
||||
|
||||
@@ -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({
|
||||
Reference in New Issue
Block a user