openapi defs for album and artist
This commit is contained in:
@@ -1,6 +1,27 @@
|
||||
from playlist.models import Artist
|
||||
from rest_framework import serializers
|
||||
from drf_spectacular.utils import extend_schema_serializer, OpenApiExample
|
||||
|
||||
@extend_schema_serializer(
|
||||
examples=[
|
||||
OpenApiExample(
|
||||
'Daft Punk',
|
||||
value = {
|
||||
"id": "4tZwfgrHOc3mvqYlEYSvVi",
|
||||
"name": "Daft Punk",
|
||||
"url": "http://127.0.0.1:8001/api/artist/4tZwfgrHOc3mvqYlEYSvVi"
|
||||
}
|
||||
),
|
||||
OpenApiExample(
|
||||
'コリッキー',
|
||||
value = {
|
||||
"id": "307y5sbPNvRpXjBcZgS25q",
|
||||
"name": "コリッキー",
|
||||
"url": "http://127.0.0.1:8001/api/artist/307y5sbPNvRpXjBcZgS25q"
|
||||
}
|
||||
)
|
||||
]
|
||||
)
|
||||
class ArtistSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Artist
|
||||
|
||||
Reference in New Issue
Block a user