-
Describe the bugThe api swagger docs are never read, so there is no api information generated. To recreate the repro:
I tried to identify the issue by piecemealing elements from the next 13/14 examples, but couldn't identify the root cause. Reproductionhttps://github.com/jersmart/next-swagger-doc-repro System InfoSystem:
OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 5.68 GB / 15.59 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.3.1 - ~/.nvm/versions/node/v20.3.1/bin/node
npm: 9.6.7 - ~/.nvm/versions/node/v20.3.1/bin/npm
pnpm: 8.6.3 - ~/.nvm/versions/node/v20.3.1/bin/pnpm Used Package Managerpnpm Validations
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi @jersmart Did you try the example apps on this repo yet? |
Beta Was this translation helpful? Give feedback.
-
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
I get the following error:
|
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
-
This appears to be due to a bug in the swagger-jsdoc repo: Surnet/swagger-jsdoc#388 |
Beta Was this translation helpful? Give feedback.
I decided to fork the swagger-jsdoc repo so I could fix the bug myself, then use pnpm override so next-swagger-doc uses my fork: "next-swagger-doc>swagger-jsdoc": "npm:@jersmart/swagger-jsdoc@^6.1.1". There has been some work to enhance the build with better error handling here which covers more use cases than the one my fix covers. Not sure if/when this will get released.