postmanlabs / openapi-to-postman

Plugin for converting OpenAPI 3.0 specs to the Postman Collection (v2) format
Apache License 2.0
930 stars 200 forks source link

Support for NextJS Edge runtime #750

Open AdrianMachado opened 1 year ago

AdrianMachado commented 1 year ago

Summary

I am building a NextJS 13 (app directory) web application that uses this library. I get an OpenAPI file from the server and convert it to a postman collection using this library. Unfortunately, I am unable to change the runtime to the Edge Runtime due to a depndency on fs within some of the utils

Module not found: Can't resolve 'fs'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/openapi-to-postmanv2/lib/parse.js
./node_modules/openapi-to-postmanv2/lib/schemapack.js
./node_modules/openapi-to-postmanv2/index.js
...

Would it be possible to distribute a version of this package that doesn't utilize node libraries that aren't supported by Next (I think they use CF workers under the hood)? I assume that ripping out some of the CLI specific code in the package would probably get you most of the way there.

image