You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Possible issue for: error: Cannot read property 'indexOf' of undefined
On receiving the above error, I went thru the code and found out that:
When created an API by using yo rest:api, it doesn't generate the datatype in annotations for @apiParam. See a sample annotation generated below for products
I understand that the user model already has the datatypes defined in annotations because the logic is defined for each param, and the yo rest:api command doesn't accept datatypes from the CLI.
I am suggesting that since the generator already assigns the datatype String to the params we create for the API, so let's assign "String" as the param data type in annotations.
The text was updated successfully, but these errors were encountered:
Possible issue for:
error: Cannot read property 'indexOf' of undefined
On receiving the above error, I went thru the code and found out that:
When created an API by using
yo rest:api
, it doesn't generate the datatype in annotations for@apiParam
. See a sample annotation generated below forproducts
Whereas, the user model generated by
yo rest
does contain the datatype{String}
for @apiParamaccess_token
.I checked the code and there's a small fix required in this line, https://github.com/diegohaz/rest/blob/master/generators/api/templates/index.js#L71
I see the template in this line that could be used
https://github.com/diegohaz/rest/blob/master/generators/app/templates/api/user/index.js#L98
I understand that the user model already has the datatypes defined in annotations because the logic is defined for each param, and the
yo rest:api
command doesn't accept datatypes from the CLI.I am suggesting that since the generator already assigns the datatype
String
to the params we create for the API, so let's assign "String" as the param data type in annotations.The text was updated successfully, but these errors were encountered: