Comments (4)
Hi @jersmart Did you try the example apps on this repo yet?
from next-swagger-doc.
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.
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:
- move the 'hello.ts' api endpoint into a folder called 'test.json'
from next-swagger-doc.
This appears to be due to a bug in the swagger-jsdoc repo: Surnet/swagger-jsdoc#388
from next-swagger-doc.
Related Issues (20)
- Module not found: Can't resolve '#apg-lite' HOT 1
- Issue with parameters and swcMinify HOT 2
- Example or Docs required to explain how to specify params?
- api doesn't load component on production HOT 9
- Compatibility issues with NodeJS 16+ (version 19.7.0 / 16.19.1) on Windows, Ubuntu, and Heroku
- `Argument of type 'Promise<typeof import("...@types/swagger-ui-react/index")>' is not assignable to parameter of type 'DynamicOptions<{ spec: any; }> | Loader<{ spec: any; }>'. HOT 1
- Authorize using Bearer or OAuth2 HOT 1
- How to manage multiple HTTP methods
- Theme | no light mode support ? HOT 1
- Next13 example project running issue HOT 4
- Swagger annotations $ref as string HOT 1
- Automated doc generation HOT 7
- Where to keep the schema.json file in next.js project?
- Not working on Next 13 HOT 1
- Issue when using different directory such as src HOT 1
- Empty paths in rendered JSON in Production (on Vercel) but not in Dev with NextJS 14 HOT 1
- README Documentation has a missing dependency HOT 2
- Error with yarn build with Next 14 HOT 3
- Error on build - Next.js 14 - TypeError: Class extends value undefined is not a constructor or null HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-swagger-doc.