omkardarves / swagger

Dynamic Swagger UI for frappe Apps
MIT License
2 stars 0 forks source link

Some Issuse #2

Open SKDragon18 opened 2 weeks ago

SKDragon18 commented 2 weeks ago

Hi, thank you for contributing a great app. During using, I discovered that there were some issues and fixed it, you can consider:

  1. "jsk" in swagger_generator.py in 241 line: it doesn't exist in my file_path example: /workspace/development/service-center/apps/sales_app/sales_app/api/order.py solution: use variable app_name_root instead of it
  2. process_function in swagger_generator.py in 65 line: it doesn't work with function (use decorators to wrappe)
  3. crsf_token in www/swagger.html in 20 line: need use frappe.sessions.get_csrf_token() to excute Hope it is helpful for you <3
omkardarves commented 2 weeks ago

Hey @SKDragon18 , thanks for bringing up these issues!

Regarding the first one, that was indeed my oversight, and I’ve resolved it, will be releasing that soon.

Could you please provide more details about point number 2?

As for point number 3, I intentionally set the CSRF token to null in the code because I wanted to consider various use cases. For example, if someone wants to consume APIs developed in Frappe from a mobile app (possibly Flutter), they would likely use token-based authentication. To do this, they would need to access the {{base_url}}/swagger URL in a new window, where there isn't a backend login for other registered users, to prevent overwriting the token sent from the mobile end.

This is the scenario I'm trying to address, and there will be many more similar cases. For now, that’s why the CSRF token is set to null in the headers in swagger.html, and you'll need to open the Swagger URL in a new browser window.

If you have any suggestions or would like to create a PR, I’d appreciate it!