Merge branch 'fix-schema-channel-metadata-choices' into 'develop'
fix channel metadata choices schema See merge request funkwhale/funkwhale!2907
This commit is contained in:
commit
9ca504c620
|
@ -2,10 +2,12 @@ from django import http
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Count, Prefetch, Q, Sum
|
from django.db.models import Count, Prefetch, Q, Sum
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from drf_spectacular.utils import extend_schema, extend_schema_view
|
from drf_spectacular.utils import extend_schema, extend_schema_view, inline_serializer
|
||||||
from rest_framework import decorators, exceptions, mixins
|
from rest_framework import decorators, exceptions, mixins
|
||||||
from rest_framework import permissions as rest_permissions
|
from rest_framework import permissions as rest_permissions
|
||||||
from rest_framework import response, viewsets
|
from rest_framework import response
|
||||||
|
from rest_framework import serializers as rest_serializers
|
||||||
|
from rest_framework import viewsets
|
||||||
|
|
||||||
from funkwhale_api.common import locales, permissions, preferences
|
from funkwhale_api.common import locales, permissions, preferences
|
||||||
from funkwhale_api.common import utils as common_utils
|
from funkwhale_api.common import utils as common_utils
|
||||||
|
@ -210,6 +212,32 @@ class ChannelViewSet(
|
||||||
data = serializers.rss_serialize_channel_full(channel=object, uploads=uploads)
|
data = serializers.rss_serialize_channel_full(channel=object, uploads=uploads)
|
||||||
return response.Response(data, status=200)
|
return response.Response(data, status=200)
|
||||||
|
|
||||||
|
@extend_schema(
|
||||||
|
responses=inline_serializer(
|
||||||
|
name="MetedataChoicesSerializer",
|
||||||
|
fields={
|
||||||
|
"language": rest_serializers.ListField(
|
||||||
|
child=inline_serializer(
|
||||||
|
name="LanguageItem",
|
||||||
|
fields={
|
||||||
|
"value": rest_serializers.CharField(),
|
||||||
|
"label": rest_serializers.CharField(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"itunes_category": rest_serializers.ListField(
|
||||||
|
child=inline_serializer(
|
||||||
|
name="iTunesCategoryItem",
|
||||||
|
fields={
|
||||||
|
"value": rest_serializers.CharField(),
|
||||||
|
"label": rest_serializers.CharField(),
|
||||||
|
"children": rest_serializers.CharField(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
)
|
||||||
@decorators.action(
|
@decorators.action(
|
||||||
methods=["get"],
|
methods=["get"],
|
||||||
detail=False,
|
detail=False,
|
||||||
|
|
|
@ -2152,7 +2152,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Channel'
|
$ref: '#/components/schemas/MetedataChoices'
|
||||||
description: ''
|
description: ''
|
||||||
/api/v1/channels/rss-subscribe/:
|
/api/v1/channels/rss-subscribe/:
|
||||||
post:
|
post:
|
||||||
|
@ -11653,7 +11653,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Channel'
|
$ref: '#/components/schemas/MetedataChoices'
|
||||||
description: ''
|
description: ''
|
||||||
/api/v2/channels/rss-subscribe/:
|
/api/v2/channels/rss-subscribe/:
|
||||||
post:
|
post:
|
||||||
|
@ -20926,6 +20926,16 @@ components:
|
||||||
required:
|
required:
|
||||||
- channel
|
- channel
|
||||||
- uuid
|
- uuid
|
||||||
|
LanguageItem:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
value:
|
||||||
|
type: string
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- label
|
||||||
|
- value
|
||||||
Library:
|
Library:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -23146,6 +23156,20 @@ components:
|
||||||
readOnly: true
|
readOnly: true
|
||||||
required:
|
required:
|
||||||
- tracks
|
- tracks
|
||||||
|
MetedataChoices:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
language:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/LanguageItem'
|
||||||
|
itunes_category:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/iTunesCategoryItem'
|
||||||
|
required:
|
||||||
|
- itunes_category
|
||||||
|
- language
|
||||||
ModerationTarget:
|
ModerationTarget:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -25845,6 +25869,19 @@ components:
|
||||||
minLength: 1
|
minLength: 1
|
||||||
required:
|
required:
|
||||||
- key
|
- key
|
||||||
|
iTunesCategoryItem:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
value:
|
||||||
|
type: string
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
children:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- children
|
||||||
|
- label
|
||||||
|
- value
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
ApplicationToken:
|
ApplicationToken:
|
||||||
type: http
|
type: http
|
||||||
|
|
Loading…
Reference in New Issue