Generate server stubs - custom template

I am having a difficulty using custom template. In my case aspnetcore. When I set the custom folder in the app and use the Generate Code button the custom templates are ignored. Then I take the command from the log (example: java -jar openapi-generator-cli.jar generate -g aspnetcore --skip-validate-spec -i “http://127.0.0.1:3658/export/openapi/17?version=openapi30” -o “C:\Users\Adelka\Documents\Apidog\CodeGenerator” -t C:\Projects\dsa-mvc\aspnetcore\3.0) and use it with node openapi-generator-cli and the custom templates are used (openapi-generator-cli generate -g aspnetcore --skip-validate-spec -i “http://127.0.0.1:3658/export/openapi/17?version=openapi30” -o “C:\Users\Adelka\Documents\Apidog\CodeGenerator” -t C:\Projects\dsa-mvc\aspnetcore\3.0). Just tried in version 2.6.16

Hi, there is an official template that you should base your approach on openapi-generator/samples/server/petstore at master · OpenAPITools/openapi-generator

Please refer to the YouTube link: https://www.youtube.com/watch?v=Jp2y15Xgk9g for a detailed guide. Apidog simplifies the use of the template directory, eliminating the need to deal with command line issues. Internally, it is based on OpenAPI Generator.

  1. Download template you’d like to override into a directory; E.G. A
  2. Modify the template following the video and guideline Using Templates | OpenAPI Generator.
  3. When you Generate Code from the GUI, Select Custom Template and choose directory A

Thanks but I have read this several times. I cannot see any template in openapi-generator/samples/server/petstore. There are 4 folders related to aspnetcore but all of them contain already generated outcome. I watched the videos before and I have modified the templates from from openapi-generator. My issues is that I can run the modified templates from the command line but not from apidog. Thank you

I guest this might happed bacause of the different version generator used when you use it in your node version. You can download the same version jar and replace the Apidog integrated one.

You can find the integrated one with the Setting Panel > Open External Program folder. Just replace the jar file with same name and the same version you used in openapi-generator-cli.

Thank you. This worked. Just with a small change. The jar is not in ExternalPrograms in ApiDog install directory but in the main directory (1 directory up). On my windows system, the cli version is in C:\Users<user>\AppData\Roaming\npm\node_modules@openapitools\openapi-generator-cli\versions. The file name in my case was 7.8.0.jar. I copied the file over to the ApiDog main folder and renamed it to openapi-generator-cli.jar and generating from custom template now works as expected. Again thank you very much.