2022. 11. 30. 19:05ㆍ서버 프로그래밍
https://medium.com/pythonistas/automated-swagger-api-doc-with-flask-restful-a78119bc4473
Automated Swagger API Doc with Flask Restful
Before diving into the blog, lets clear the air and talk about some of the terms that we are going to use in the blog extensively.
medium.com
이전에는 다른 swagger 라이브러리를 사용했었는데, Flask나 기타 라이브러리의 버전이 낮아야하는 문제가 있어서 최신 버전의 Flask와 연동해서 사용할 수 있는 라이브러리를 찾아본 결과 flask-apispec이 괜찮아서 적용해보았다.
https://pypi.org/project/flask-apispec/
flask-apispec
Build and document REST APIs with Flask and apispec
pypi.org
특히나 flask-apispec이 좋은 점은 marshmallow를 이용하여 API가 리턴하는 데이터 모델을 구조화할 수 있다는 점
https://marshmallow.readthedocs.io/en/stable/index.html
marshmallow: simplified object serialization — marshmallow 3.19.0 documentation
marshmallow: simplified object serialization Release v3.19.0. (Changelog) marshmallow is an ORM/ODM/framework-agnostic library for converting complex datatypes, such as objects, to and from native Python datatypes. from datetime import date from pprint imp
marshmallow.readthedocs.io