mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
add some documentation for know how
This commit is contained in:
parent
8dfa39085c
commit
35de0279a9
|
@ -19,6 +19,23 @@ Two popular options are [Swagger UI][swagger-ui] and [ReDoc][redoc].
|
|||
Both require little more than the location of your static schema file or
|
||||
dynamic `SchemaView` endpoint.
|
||||
|
||||
openapi allows you to group endpoints by tags, that's you can configure these tags
|
||||
on your view by adding `openapi_tags` as property, by default will set ['default'].
|
||||
|
||||
```python
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.response import Response
|
||||
|
||||
class HelloWorldApiView(APIView):
|
||||
permission_classes = [AllowAny]
|
||||
openapi_tags = ['example', 'hello-world']
|
||||
|
||||
def get(self, request):
|
||||
return Response(data={'message': 'hello world!'})
|
||||
|
||||
```
|
||||
|
||||
### A minimal example with Swagger UI
|
||||
|
||||
Assuming you've followed the example from the schemas documentation for routing
|
||||
|
|
Loading…
Reference in New Issue
Block a user