Giter Site home page Giter Site logo

Comments (4)

jellydn avatar jellydn commented on July 24, 2024

Hi @jersmart Did you try the example apps on this repo yet?

from next-swagger-doc.

jersmart avatar jersmart commented on July 24, 2024

Hi @jersmart Did you try the example apps on this repo yet?

The example apps worked for me. The biggest difference between the example apps and what's generated by create-next-app is nesting pages etc into the 'src' directory. However, when I try to change

apiFolder: 'pages/api' -> 'src/pages/api'

I get the following error:

- error Error: EISDIR: illegal operation on a directory, read at Object.readSync (node:fs:760:3) at tryReadSync (node:fs:440:20) at Object.readFileSync (node:fs:486:19) at extractAnnotations (/home/example/node_modules/.pnpm/[email protected][email protected]/node_modules/swagger-jsdoc/src/utils.js:54:26) at build (/home/example/node_modules/.pnpm/[email protected][email protected]/node_modules/swagger-jsdoc/src/specification.js:200:9) at Object.module.exports [as default] (/home/example/node_modules/.pnpm/[email protected][email protected]/node_modules/swagger-jsdoc/src/lib.js:32:10) at createSwaggerSpec (/home/example/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next-swagger-doc/dist/swagger-99304a1e.cjs:61:48) at getApiDocs (webpack-internal:///./src/swagger.ts:9:85) at getServerSideProps (webpack-internal:///./src/pages/api-doc/index.tsx:30:76) at fn (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/render.tsx:1028:11) at /home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/lib/trace/tracer.ts:261:28 at NoopContextManager.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057) at ContextAPI.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516) at NoopTracer.startActiveSpan (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086) at ProxyTracer.startActiveSpan (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847) at /home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/lib/trace/tracer.ts:238:32 at NoopContextManager.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057) at ContextAPI.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516) at NextTracerImpl.trace (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/lib/trace/tracer.ts:237:28) at renderToHTMLImpl (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/render.tsx:1019:32) at async doRender (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/base-server.ts:1802:18) at async cacheEntry.responseCache.get.incrementalCache.incrementalCache (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/base-server.ts:2031:24) at async /home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/response-cache/index.ts:126:28 { digest: undefined }

from next-swagger-doc.

jersmart avatar jersmart commented on July 24, 2024

Hi @jersmart Did you try the example apps on this repo yet?

The example apps worked for me. The biggest difference between the example apps and what's generated by create-next-app is nesting pages etc into the 'src' directory. However, when I try to change

apiFolder: 'pages/api' -> 'src/pages/api'

I get the following error:

- error Error: EISDIR: illegal operation on a directory, read at Object.readSync (node:fs:760:3) at tryReadSync (node:fs:440:20) at Object.readFileSync (node:fs:486:19) at extractAnnotations (/home/example/node_modules/.pnpm/[email protected][email protected]/node_modules/swagger-jsdoc/src/utils.js:54:26) at build (/home/example/node_modules/.pnpm/[email protected][email protected]/node_modules/swagger-jsdoc/src/specification.js:200:9) at Object.module.exports [as default] (/home/example/node_modules/.pnpm/[email protected][email protected]/node_modules/swagger-jsdoc/src/lib.js:32:10) at createSwaggerSpec (/home/example/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next-swagger-doc/dist/swagger-99304a1e.cjs:61:48) at getApiDocs (webpack-internal:///./src/swagger.ts:9:85) at getServerSideProps (webpack-internal:///./src/pages/api-doc/index.tsx:30:76) at fn (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/render.tsx:1028:11) at /home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/lib/trace/tracer.ts:261:28 at NoopContextManager.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057) at ContextAPI.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516) at NoopTracer.startActiveSpan (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086) at ProxyTracer.startActiveSpan (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847) at /home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/lib/trace/tracer.ts:238:32 at NoopContextManager.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057) at ContextAPI.with (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516) at NextTracerImpl.trace (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/lib/trace/tracer.ts:237:28) at renderToHTMLImpl (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/render.tsx:1019:32) at async doRender (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/base-server.ts:1802:18) at async cacheEntry.responseCache.get.incrementalCache.incrementalCache (/home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/base-server.ts:2031:24) at async /home/example/node_modules/.pnpm/[email protected]_patch_hash=tpbd5rbdpqoageh5z5zdjldhkq_@[email protected][email protected][email protected]/node_modules/next/src/server/response-cache/index.ts:126:28 { digest: undefined }

I found the root cause of this issue. I have directories in the api folder that have a period in them that simulate retrieval of a file but actually build them dynamically (fwiw, not my design decision.) The error is accurate; it's trying to read a directory like its a file because it looks like one. This error is reproducible in the example:

  1. move the 'hello.ts' api endpoint into a folder called 'test.json'

from next-swagger-doc.

jersmart avatar jersmart commented on July 24, 2024

This appears to be due to a bug in the swagger-jsdoc repo: Surnet/swagger-jsdoc#388

from next-swagger-doc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.