Tags
- M:N
- 그리디
- 백트래킹
- regexp
- distinct
- 이진트리
- 완전검색
- Vue
- outer join
- delete
- SQL
- 스택
- 트리
- Article & User
- DB
- 쟝고
- Django
- count
- ORM
- 큐
- Queue
- Tree
- update
- stack
- drf
- 뷰
- 통계학
- create
- migrations
- N:1
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Notice
Recent Posts
Link
데이터 분석 기술 블로그
Django에 대하여(39)_API 문서화 본문
1. OpenAPI Specification (OAS)
RESTful API를 설명하고 시각화하는 표준화된 방법으로 API에 대한 세부사항을 기술할 수 있는 공식 표준입니다.
2. drf-spectacular 라이브러리
DRF를 위한 OpenAPI 3.0 구조 생성을 도와주는 라이브러리입니다.
설치 및 등록하기
$ pip install drf-spectacular
# settings.py
INSTALLED_APPS = [
...,
'drf_spectacular',
...,
]
관련 설정 코드 입력하기 (OpenAPI 스키마 자동 생성 코드)
# settings.py
REST_FRAMEWORK = {
# YOUR SETTINGS
'DEFUALT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}
swagger, redoc 페이지 제공을 위한 url 작성하기
# drf/urls.py
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocVIew, SpectacularSwaggerVIew
urlpatterns = [
...,
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/schema/swagger-ui', SpectacularSwaggerVIew.as_view(url_name='schema'), name='swagger-ui'),
path('api/schema/redoc', SpectacularRedocVIew.as_view(url_name='schema'), name='redoc'),
3. OAS의 핵심 이점 - "설계 우선" 접근법
참고
1. get_object_or_404()
2. get_list_or_404()
'백엔드' 카테고리의 다른 글
Django에 대하여(38)_DRF 역참조 데이터 구성 (0) | 2024.05.26 |
---|---|
Django에 대하여(37)_DRF 응답 데이터 재구성 (0) | 2024.05.25 |
Django에 대하여(36)_DRF with N:1 Relation - DELETE & PUT (0) | 2024.05.24 |
Django에 대하여(35)_DRF with N:1 Relation - POST (0) | 2024.05.23 |
Django에 대하여(34)_DRF with N:1 Relation - GET (0) | 2024.05.22 |