convector-rest-api
convector-rest-api copied to clipboard
Cannot find ClassName in apiGeneratorClass
Hi, When following the instructions for the Auto-generated REST API (link here), during the command conv-rest-api generate api -c car -f ./org1.car.config.json I get the error: "TypeError: Cannot read property 'getClassorThrow' of undefined". This is raised by reflectionUtils.js [152:41].
I am using a newer version of convector, where the file /org1.car.cconfig.json is now named as car.config.json, so I used that file.
I could notice that in class apiGenerator, the controllerName object was not retrieving the right data to variables plainName and controllersPattern. So I did a test and directly changed the file:
case 0:
plainName = controllerName.replace('Controller', '').toLowerCase();
controllersPattern = path_1.join(process.cwd(), ".") +
("/packages/**-cc/src/" + "car" + ".controller.ts");
return [4, reflectionUtils_1.ReflectionUtils.getClassMethods(controllersPattern,
"CarController")];//controllerName)];
I have basically inserted the CarController name, and then it worked.
Do you have any idea on why the correct name for the class is not being used in the application?
Hi @BardoBravo I have the same problem did you find any solution?
Hi @krafugo ,
In fact, I described the solution above, but did not received any feedback on why the original application is wrong, or if my solution is really the best one.
in the end, i recommend you to reach the official Discord channel - there they are way more active than here at GitHub.
[]s