I've created YAML file at Swaggerhub and I generated Python Flask code like this:
java -jar swagger-codegen-cli.jar generate -l python-flask -i swagger.yaml -o mycode/
So far everything works fine. Now I want to implement my own functionality for each API call. There is a generated file named developers_controller.py
which contains getters for my API get methods returning "do some magic!" only. I want to replace them with my functionality (i.e. return data from database). How should I do it?
I've found something about Swagger templates. I am not really sure if it's what I want. I am also not sure how to add/modify the templates. I've found https://github.com/swagger-api/swagger-codegen/wiki/Building-your-own-Templates and according to it I think I'll have to copy whole https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlaskConnexionCodegen.java file and use it as a template? From another sources I think I have to copy whole Isn't it possible just to create a simple file containing: get_my_swagger_generated_method = file.my_own_method ? Do I need to know Java to create Python templates? Or is the only way to edit the generated file afterwards (with sed, awk, bash etc.)?
In short: basically I don't know where to start, I didn't found any step-by-step example how to create python-flask template containing my own functionality.