Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work (indexOf undefined) #22

Open
Uter1007 opened this issue Aug 7, 2016 · 20 comments
Open

Doesn't work (indexOf undefined) #22

Uter1007 opened this issue Aug 7, 2016 · 20 comments

Comments

@Uter1007
Copy link

Uter1007 commented Aug 7, 2016

apidoc on it's own runs smoothly.

apidoc-swagger -i dist/ -o doc/
(node:10252) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
warn: parser plugin 'param' not found in block: 0
error: Cannot read property 'indexOf' of undefined

@lzerma
Copy link

lzerma commented Dec 15, 2016

@Uter1007 try to use the excluding filters and remove the node_modules/ folder.

@svanbelleghem
Copy link

Have the exact same problem.

apidoc-swagger -o/docs
warn: parser plugin 'param' not found in block: 1
error: Cannot read property 'indexOf' of undefined

Folderstructure:
structuur-backend2

Any idea how to resolve this?

@lzerma
Copy link

lzerma commented Mar 20, 2017

@svanbelleghem @Uter1007 Here try this:

apidoc-swagger -v -e "node_modules/" -f \'.*\\.js$\' -i ./api -o ./

@svanbelleghem
Copy link

svanbelleghem commented Mar 20, 2017

Btw: thanks for the reply ;)

apidoc-swagger -v -e "node_modules/" -f \'.*\\.js$\' -i ./api -o ./

verbose: apidoc-generator name: apidoc-swagger
verbose: apidoc-generator version: 0.2.2
verbose: apidoc-core version: 0.3.1
verbose: apidoc-spec version: 0.2.0
verbose: run parser
error: No files found.
{ Path: '.' }

@lzerma
Copy link

lzerma commented Mar 20, 2017

@svanbelleghem replace the js extension to which you are currently working with.

apidoc-swagger -v -e "node_modules/" -f \'.*\\.<replace me>$\' -i ./api -o ./

@svanbelleghem
Copy link

replace the js extension to which you are currently working with.

Do you mean the apidoc configfile which is written in json?

@lzerma
Copy link

lzerma commented Mar 20, 2017

What are the files that contain the documentation block on it? On the image that you attached I couldn't see any well-known structure for a project, so I need to know in order to help you out.
vendor and apidoc doesn't mean nothing.

@svanbelleghem
Copy link

vendor is my composer output folder. apidoc is the output folder from a previous generated apidoc. Index.php contains the code that needs to be documented.

@lzerma
Copy link

lzerma commented Mar 20, 2017

@svanbelleghem ok, try this then apidoc-swagger -v -e "node_modules/" -f \'.*\\.php$\' -i ./vendor/index.php -o ./

@svanbelleghem
Copy link

Index.php is located on the root, not in vendor (excuses for the misunderstanding). But when I try apidoc-swagger -v -e "node_modules/" -f \'.*\\.php$\' -i ./index.php -o ./ I still got the same result:

apidoc-swagger -v -e "node_modules/" -f \'.*\\.php$\' -i ./index.php -o ./

verbose: apidoc-generator name: apidoc-swagger verbose: apidoc-generator version: 0.2.2 verbose: apidoc-core version: 0.3.1 verbose: apidoc-spec version: 0.2.0 verbose: run parser error: No files found. { Path: '.' }

@lzerma
Copy link

lzerma commented Mar 20, 2017

Ok, then try cd /html/ && apidoc-swagger -v -e "node_modules/" -f \'.*\\.php$\' -i ./ -o ./

If you still getting the same error, it means that it is not finding the index.php.

@svanbelleghem
Copy link

I'm really sorry but still getting the same error. But with cmd I can locate the file.

if exist index.php echo File Found!
File Found!

And when I run apidoc alone it runs smoothly. Do I need to specify some settings in apidoc.json or in my index.php besides the standart apidoc settings and annotations?

@svanbelleghem
Copy link

Ok, so for some reason this apidoc-swagger -i example/ -o doc/ works perfectly!

@cyyeh
Copy link

cyyeh commented Aug 15, 2017

@svanbelleghem apidoc-swagger -i example/ -o doc/, what files does the 'example' directory contain?

@RiceLinTW
Copy link

RiceLinTW commented Feb 23, 2018

Same problem when run apidoc-swagger

Got these output
error: Cannot read property 'indexOf' of undefined
debug: TypeError: Cannot read property 'indexOf' of undefined
at createFieldArrayDefinitions (/usr/local/lib/node_modules/apidoc-swagger/lib/apidocToSwagger.js:188:25)
at createVerbDefinitions (/usr/local/lib/node_modules/apidoc-swagger/lib/apidocToSwagger.js:134:22)
at createGetDeleteOutput (/usr/local/lib/node_modules/apidoc-swagger/lib/apidocToSwagger.js:236:29)
at extractPaths (/usr/local/lib/node_modules/apidoc-swagger/lib/apidocToSwagger.js:64:19)
at Object.toSwagger (/usr/local/lib/node_modules/apidoc-swagger/lib/apidocToSwagger.js:13:18)
at Object.createApidocSwagger (/usr/local/lib/node_modules/apidoc-swagger/lib/index.js:107:63)
at Object. (/usr/local/lib/node_modules/apidoc-swagger/bin/apidocSwagger.js:143:19)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)

Any update?

@Eamonnzhang
Copy link

still got the same error

@newsages
Copy link

Same

@BorisKotlyarov
Copy link

BorisKotlyarov commented Jul 27, 2020

Open file apidocToSwagger.js row 274
replace if (verbs.parameter && verbs.parameter.fields.Parameter) to
if (verbs.parameter && verbs.parameter && verbs.parameter.fields && verbs.parameter.fields.Parameter)

image

see PR #57

@18819296186
Copy link

I know why throw this error now~
Look at the photos.

var type = parameter.type;
This variant need to get the type, and this type from {}. But code lack the {}

@apiParam {string} userId 用户

image

@aaaaaaaaaaalex
Copy link

@18819296186, you are right. In order to solve this problem:
Open file apidocToSwagger.js on row 190
replace
var typeIndex = type.indexOf("[]");
to
var typeIndex = type === undefined ? -1 : type.indexOf("[]");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants