coding-kitties / flask-swagger-generator

A simple to use flask swagger generator working with the Flask web framework.
MIT License
6 stars 6 forks source link

Generator.generate_swagger is not working if destination path is not provided #22

Closed fizaashraf37 closed 2 years ago

fizaashraf37 commented 2 years ago

Destination path parameter in generate_swagger function of Generator class is optional. It works when the parameter is passed. But when destination path is not provided then it throws below error:

Traceback (most recent call last):
  File "e:/OpenSource/flask-swagger-generator/test.py", line 28, in <module>
    generator.generate_swagger(app)
  File "e:\OpenSource\flask-swagger-generator\flask_swagger_generator\generators\generator.py", line 53, in generate_swagger
    self.file = open(destination_path, 'w')
TypeError: expected str, bytes or os.PathLike object, not NoneType

Example:

generator.generate_swagger(app)

fizaashraf37 commented 2 years ago

I have also found the solution. And have created the below PR https://github.com/coding-kitties/flask-swagger-generator/pull/23 for the fix.