feat: correct typing and rename newopenapi importer to openapi
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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({
|
||||||
Reference in New Issue
Block a user