Commit d33d0849 authored by Agate's avatar Agate 💬
Browse files

Fixed #1171: invalid swagger syntax

parent 389a30a1
......@@ -824,7 +824,9 @@ def rss_serialize_item(upload):
"enclosure": [
{
# we enforce MP3, since it's the only format supported everywhere
"url": federation_utils.full_url(upload.get_listen_url(to="mp3")),
"url": federation_utils.full_url(
upload.get_listen_url(to="mp3", download=False)
),
"length": upload.size or 0,
"type": "audio/mpeg",
}
......
......@@ -899,10 +899,12 @@ class Upload(models.Model):
def listen_url(self):
return self.track.listen_url + "?upload={}".format(self.uuid)
def get_listen_url(self, to=None):
def get_listen_url(self, to=None, download=None):
url = self.listen_url
if to:
url += "&to={}".format(to)
if download is not None:
url += "&download={}".format(str(download).lower())
return url
@property
......
......@@ -312,7 +312,9 @@ def test_rss_item_serializer(factories):
"link": [{"value": federation_utils.full_url(upload.track.get_absolute_url())}],
"enclosure": [
{
"url": federation_utils.full_url(upload.get_listen_url("mp3")),
"url": federation_utils.full_url(
upload.get_listen_url("mp3", download=False)
),
"length": upload.size,
"type": "audio/mpeg",
}
......
Ensure compatibility with Apple Podcasts (#1176)
\ No newline at end of file
......@@ -204,8 +204,8 @@ paths:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#OAuthApplication"
- $ref: "./api/definitions.yml#OAuthApplicationCreation"
- $ref: "./api/definitions.yml#/OAuthApplication"
- $ref: "./api/definitions.yml#/OAuthApplicationCreation"
requestBody:
required: true
content:
......@@ -322,7 +322,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Me"
$ref: "./api/definitions.yml#/Me"
/api/v1/rate-limit/:
get:
......@@ -335,7 +335,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#RateLimitStatus"
$ref: "./api/definitions.yml#/RateLimitStatus"
/api/v1/artists/:
get:
......@@ -347,9 +347,9 @@ paths:
- "read:libraries"
parameters:
- $ref: "./api/parameters.yml#Search"
- $ref: "./api/parameters.yml#/Search"
- allOf:
- $ref: "./api/parameters.yml#Ordering"
- $ref: "./api/parameters.yml#/Ordering"
- default: "-creation_date"
schema:
required: false
......@@ -359,10 +359,10 @@ paths:
- creation_date
- id
- name
- $ref: "./api/parameters.yml#Playable"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#Scope"
- $ref: "./api/parameters.yml#/Playable"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
- $ref: "./api/parameters.yml#/Scope"
responses:
200:
......@@ -370,19 +370,19 @@ paths:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#Artist"
$ref: "./api/definitions.yml#/Artist"
/api/v1/artists/{id}/:
get:
summary: Retrieve a single artist
parameters:
- $ref: "./api/parameters.yml#ObjectId"
- $ref: "./api/parameters.yml#Refresh"
- $ref: "./api/parameters.yml#/ObjectId"
- $ref: "./api/parameters.yml#/Refresh"
security:
- oauth2:
- "read:libraries"
......@@ -393,12 +393,12 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Artist"
$ref: "./api/definitions.yml#/Artist"
404:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/artists/{id}/libraries/:
get:
summary: List available user libraries containing work from this artist
......@@ -406,9 +406,9 @@ paths:
- oauth2:
- "read:libraries"
parameters:
- $ref: "./api/parameters.yml#ObjectId"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#/ObjectId"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
tags:
- "Library and metadata"
......@@ -417,12 +417,12 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#LibraryPage"
$ref: "./api/definitions.yml#/LibraryPage"
404:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/albums/:
get:
......@@ -435,7 +435,7 @@ paths:
- "read:libraries"
parameters:
- $ref: "./api/parameters.yml#Search"
- $ref: "./api/parameters.yml#/Search"
- name: "artist"
in: "query"
default: null
......@@ -445,7 +445,7 @@ paths:
type: "integer"
format: "int64"
- allOf:
- $ref: "./api/parameters.yml#Ordering"
- $ref: "./api/parameters.yml#/Ordering"
- default: "-creation_date"
schema:
required: false
......@@ -455,10 +455,10 @@ paths:
- creation_date
- release_date
- title
- $ref: "./api/parameters.yml#Playable"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#Scope"
- $ref: "./api/parameters.yml#/Playable"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
- $ref: "./api/parameters.yml#/Scope"
responses:
200:
......@@ -466,19 +466,19 @@ paths:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#Album"
$ref: "./api/definitions.yml#/Album"
/api/v1/albums/{id}/:
get:
summary: Retrieve a single album
parameters:
- $ref: "./api/parameters.yml#ObjectId"
- $ref: "./api/parameters.yml#Refresh"
- $ref: "./api/parameters.yml#/ObjectId"
- $ref: "./api/parameters.yml#/Refresh"
security:
- oauth2:
......@@ -490,20 +490,20 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Album"
$ref: "./api/definitions.yml#/Album"
404:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/albums/{id}/libraries/:
get:
summary: List available user libraries containing tracks from this album
parameters:
- $ref: "./api/parameters.yml#ObjectId"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#/ObjectId"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
security:
- oauth2:
......@@ -515,12 +515,12 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#LibraryPage"
$ref: "./api/definitions.yml#/LibraryPage"
404:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/tracks/:
get:
......@@ -533,7 +533,7 @@ paths:
- "read:libraries"
parameters:
- $ref: "./api/parameters.yml#Search"
- $ref: "./api/parameters.yml#/Search"
- name: "artist"
in: "query"
default: null
......@@ -566,7 +566,7 @@ paths:
required: false
type: "string"
- allOf:
- $ref: "./api/parameters.yml#Ordering"
- $ref: "./api/parameters.yml#/Ordering"
- default: "-creation_date"
schema:
required: false
......@@ -576,10 +576,10 @@ paths:
- creation_date
- release_date
- title
- $ref: "./api/parameters.yml#Playable"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#Scope"
- $ref: "./api/parameters.yml#/Playable"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
- $ref: "./api/parameters.yml#/Scope"
responses:
200:
......@@ -587,18 +587,18 @@ paths:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#Track"
$ref: "./api/definitions.yml#/Track"
/api/v1/tracks/{id}/:
get:
parameters:
- $ref: "./api/parameters.yml#ObjectId"
- $ref: "./api/parameters.yml#Refresh"
- $ref: "./api/parameters.yml#/ObjectId"
- $ref: "./api/parameters.yml#/Refresh"
summary: Retrieve a single track
security:
......@@ -611,20 +611,20 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Track"
$ref: "./api/definitions.yml#/Track"
404:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/tracks/{id}/libraries/:
get:
summary: List available user libraries containing given track
parameters:
- $ref: "./api/parameters.yml#ObjectId"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#/ObjectId"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
security:
- oauth2:
- "read:libraries"
......@@ -635,12 +635,12 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#LibraryPage"
$ref: "./api/definitions.yml#/LibraryPage"
404:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/listen/{uuid}/:
get:
summary: Download the audio file matching the given track uuid
......@@ -672,7 +672,7 @@ paths:
This endpoint support bytess-range requests.
schema:
$ref: "./api/properties.yml#transcode_options"
$ref: "./api/properties.yml#/transcode_options"
- name: upload
in: query
required: false
......@@ -710,7 +710,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/licenses/:
get:
......@@ -721,21 +721,21 @@ paths:
tags:
- "Library and metadata"
parameters:
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
responses:
200:
content:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#License"
$ref: "./api/definitions.yml#/License"
/api/v1/licenses/{code}/:
get:
......@@ -759,12 +759,12 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#License"
$ref: "./api/definitions.yml#/License"
404:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ResourceNotFound"
$ref: "./api/definitions.yml#/ResourceNotFound"
/api/v1/libraries/:
get:
......@@ -772,23 +772,23 @@ paths:
tags:
- "Uploads and audio content"
parameters:
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#Search"
- $ref: "./api/parameters.yml#Scope"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
- $ref: "./api/parameters.yml#/Search"
- $ref: "./api/parameters.yml#/Scope"
responses:
200:
content:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#OwnedLibrary"
$ref: "./api/definitions.yml#/OwnedLibrary"
post:
tags:
- "Uploads and audio content"
......@@ -804,7 +804,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#OwnedLibraryCreate"
$ref: "./api/definitions.yml#/OwnedLibraryCreate"
/api/v1/libraries/{uuid}/:
parameters:
......@@ -823,7 +823,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#OwnedLibrary"
$ref: "./api/definitions.yml#/OwnedLibrary"
post:
summary: Update a library
tags:
......@@ -833,13 +833,13 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#OwnedLibraryCreate"
$ref: "./api/definitions.yml#/OwnedLibraryCreate"
responses:
201:
content:
application/json:
schema:
$ref: "./api/definitions.yml#OwnedLibrary"
$ref: "./api/definitions.yml#/OwnedLibrary"
delete:
summary: Delete a library and all associated uploads
description: |
......@@ -857,14 +857,14 @@ paths:
tags:
- "Channels and subscriptions"
parameters:
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#Scope"
- $ref: "./api/parameters.yml#Search"
- $ref: "./api/parameters.yml#Tags"
- $ref: "./api/parameters.yml#Subscribed"
- $ref: "./api/parameters.yml#External"
- $ref: "./api/parameters.yml#ChannelOrdering"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
- $ref: "./api/parameters.yml#/Scope"
- $ref: "./api/parameters.yml#/Search"
- $ref: "./api/parameters.yml#/Tags"
- $ref: "./api/parameters.yml#/Subscribed"
- $ref: "./api/parameters.yml#/External"
- $ref: "./api/parameters.yml#/ChannelOrdering"
responses:
200:
......@@ -872,13 +872,13 @@ paths:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#Channel"
$ref: "./api/definitions.yml#/Channel"
post:
summary: Create a new channel
tags:
......@@ -893,7 +893,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ChannelCreate"
$ref: "./api/definitions.yml#/ChannelCreate"
/api/v1/channels/metadata-choices:
summary: List metadata (locales, itunes categories) for creating and editing channels.
......@@ -959,7 +959,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Channel"
$ref: "./api/definitions.yml#/Channel"
post:
summary: Update a channel
tags:
......@@ -969,13 +969,13 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#ChannelUpdate"
$ref: "./api/definitions.yml#/ChannelUpdate"
responses:
201:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Channel"
$ref: "./api/definitions.yml#/Channel"
delete:
summary: Delete a channel and all associated uploads
description: |
......@@ -1009,7 +1009,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Subscription"
$ref: "./api/definitions.yml#/Subscription"
/api/v1/channels/{uuid}/rss/:
parameters:
......@@ -1045,7 +1045,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Subscription"
$ref: "./api/definitions.yml#/Subscription"
/api/v1/channels/{uuid}/unsubscribe/:
parameters:
......@@ -1069,23 +1069,23 @@ paths:
- "Uploads and audio content"
parameters:
- $ref: "./api/parameters.yml#Search"
- $ref: "./api/parameters.yml#PageNumber"
- $ref: "./api/parameters.yml#PageSize"
- $ref: "./api/parameters.yml#Scope"
- $ref: "./api/parameters.yml#/Search"
- $ref: "./api/parameters.yml#/PageNumber"
- $ref: "./api/parameters.yml#/PageSize"
- $ref: "./api/parameters.yml#/Scope"
responses:
200:
content:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#OwnedUpload"
$ref: "./api/definitions.yml#/OwnedUpload"
post:
tags:
- "Uploads and audio content"
......@@ -1126,7 +1126,7 @@ paths:
- "pending"
import_metadata:
required: false
$ref: "./api/definitions.yml#ImportMetadata"
$ref: "./api/definitions.yml#/ImportMetadata"
/api/v1/subscriptions/{uuid}/:
......@@ -1146,7 +1146,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#Subscription"
$ref: "./api/definitions.yml#/Subscription"
/api/v1/subscriptions/:
get:
......@@ -1159,13 +1159,13 @@ paths:
application/json:
schema:
allOf:
- $ref: "./api/definitions.yml#ResultPage"
- $ref: "./api/definitions.yml#/ResultPage"
- type: "object"
properties:
results:
type: "array"
items:
$ref: "./api/definitions.yml#Subscription"
$ref: "./api/definitions.yml#/Subscription"
/api/v1/subscriptions/all/:
get:
......@@ -1182,7 +1182,7 @@ paths:
results:
type: "array"
items:
$ref: "./api/definitions.yml#SubscriptionsAll"
$ref: "./api/definitions.yml#/SubscriptionsAll"
/api/v1/uploads/{uuid}/:
parameters:
......@@ -1201,7 +1201,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#OwnedUpload"
$ref: "./api/definitions.yml#/OwnedUpload"
patch:
summary: Update a draft upload
description: |
......@@ -1219,7 +1219,7 @@ paths:
content:
application/json:
schema:
$ref: "./api/definitions.yml#OwnedUpload"
$ref: "./api/definitions.yml#/OwnedUpload"
delete:
summary: Delete an upload
</