Skip to content

Commit 88b2ddf

Browse files
committed
Fix limit parameter
- minimum value of limit parameter is one and not zero - get playlists tracks endpoint has a maximum limit of 100 and not 50 - use already existing QueryLimit parameter where possible
1 parent 7988777 commit 88b2ddf

File tree

6 files changed

+98
-30
lines changed

6 files changed

+98
-30
lines changed

fixed-spotify-open-api.yml

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ paths:
538538
default: 20
539539
example: 10
540540
type: integer
541-
minimum: 0
541+
minimum: 1
542542
maximum: 50
543543
- name: offset
544544
required: false
@@ -735,9 +735,20 @@ paths:
735735
can be excluded by prefixing them with an exclamation mark, for example:<br>`fields=items.track.album(!external_urls,images)`
736736
example: "items(added_by.id,track(name,href,album(name,href)))"
737737
type: string
738-
- $ref: '#/components/parameters/QueryLimit'
739738
- $ref: '#/components/parameters/QueryOffset'
740739
- $ref: '#/components/parameters/QueryAdditionalTypes'
740+
- name: limit
741+
required: false
742+
in: query
743+
schema:
744+
title: Limit
745+
description: |
746+
The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 100.
747+
default: 20
748+
example: 10
749+
type: integer
750+
minimum: 1
751+
maximum: 100
741752
responses:
742753
"200":
743754
$ref: '#/components/responses/PlaylistTracksPagingObject'
@@ -2063,18 +2074,7 @@ paths:
20632074
The last artist ID retrieved from the previous request.
20642075
example: 0I2XqVXqHScXjHhk6AYYRe
20652076
type: string
2066-
- name: limit
2067-
required: false
2068-
in: query
2069-
schema:
2070-
title: Limit
2071-
description: |
2072-
The maximum number of items to return. Default: 20\. Minimum: 1\. Maximum: 50\.
2073-
default: 20
2074-
example: 10
2075-
type: integer
2076-
minimum: 0
2077-
maximum: 50
2077+
- $ref: '#/components/parameters/QueryLimit'
20782078
responses:
20792079
"200":
20802080
$ref: '#/components/responses/CursorPagedArtists'
@@ -3390,18 +3390,6 @@ paths:
33903390
Get tracks from the current user's recently played tracks.
33913391
_**Note**: Currently doesn't support podcast episodes._
33923392
parameters:
3393-
- name: limit
3394-
required: false
3395-
in: query
3396-
schema:
3397-
title: Limit
3398-
description: |
3399-
The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
3400-
default: 20
3401-
example: 10
3402-
type: integer
3403-
minimum: 0
3404-
maximum: 50
34053393
- name: after
34063394
required: false
34073395
in: query
@@ -3423,6 +3411,7 @@ paths:
34233411
before (but not including) this cursor position. If `before` is specified,
34243412
`after` must not be specified.
34253413
type: integer
3414+
- $ref: '#/components/parameters/QueryLimit'
34263415
responses:
34273416
"200":
34283417
$ref: '#/components/responses/PlayHistoryCursorPagingObject'
@@ -6448,7 +6437,7 @@ components:
64486437
default: 20
64496438
example: 10
64506439
type: integer
6451-
minimum: 0
6440+
minimum: 1
64526441
maximum: 50
64536442
QueryOffset:
64546443
name: offset
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
description: Minimum value for limit parameter is one not zero
2+
operations:
3+
- op: test
4+
path: "$.components.parameters.QueryLimit.schema.minimum"
5+
value: 0
6+
- op: set
7+
path: "$.components.parameters.QueryLimit.schema.minimum"
8+
value: 1
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
description: Use existing QueryLimit parameter
2+
operations:
3+
- op: test
4+
path: "$.paths./me/following.get.parameters[?(@.name=='limit')]"
5+
value:
6+
- name: limit
7+
required: false
8+
in: query
9+
schema:
10+
title: Limit
11+
description: |
12+
The maximum number of items to return. Default: 20\. Minimum: 1\. Maximum: 50\.
13+
default: 20
14+
example: 10
15+
type: integer
16+
minimum: 0
17+
maximum: 50
18+
- op: delete
19+
path: "$.paths./me/following.get.parameters[?(@.name=='limit')]"
20+
- op: add
21+
path: "$.paths./me/following.get.parameters"
22+
value:
23+
$ref: '#/components/parameters/QueryLimit'
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
description: update response type to PlaylistTracksPagingObject
1+
description: update response type to PlaylistTracksPagingObject and fix maximum of limit parameter
22
operations:
33
- op: test
44
path: "$.paths./playlists/{playlist_id}/tracks.get.responses.200.$ref"
55
value: '#/components/responses/PagingObject'
66
- op: set
77
path: "$.paths./playlists/{playlist_id}/tracks.get.responses.200.$ref"
88
value: '#/components/responses/PlaylistTracksPagingObject'
9+
- op: test
10+
path: "$.paths./playlists/{playlist_id}/tracks.get.parameters[?(@.$ref=='#/components/parameters/QueryLimit')]"
11+
value:
12+
- $ref: '#/components/parameters/QueryLimit'
13+
- op: delete
14+
path: "$.paths./playlists/{playlist_id}/tracks.get.parameters[?(@.$ref=='#/components/parameters/QueryLimit')]"
15+
- op: add
16+
path: "$.paths./playlists/{playlist_id}/tracks.get.parameters"
17+
value:
18+
name: limit
19+
required: false
20+
in: query
21+
schema:
22+
title: Limit
23+
description: |
24+
The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 100.
25+
default: 20
26+
example: 10
27+
type: integer
28+
minimum: 1
29+
maximum: 100
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
description: update response type to PlayHistoryCursorPagingObject
1+
description: update response type to PlayHistoryCursorPagingObject and use existing QueryLimit parameter
22
operations:
33
- op: test
44
path: "$.paths./me/player/recently-played.get.responses.200.$ref"
55
value: '#/components/responses/CursorPaging'
66
- op: set
77
path: "$.paths./me/player/recently-played.get.responses.200.$ref"
88
value: '#/components/responses/PlayHistoryCursorPagingObject'
9+
- op: test
10+
path: "$.paths./me/player/recently-played.get.parameters[?(@.name=='limit')]"
11+
value:
12+
- name: limit
13+
required: false
14+
in: query
15+
schema:
16+
title: Limit
17+
description: |
18+
The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
19+
default: 20
20+
example: 10
21+
type: integer
22+
minimum: 0
23+
maximum: 50
24+
- op: delete
25+
path: "$.paths./me/player/recently-played.get.parameters[?(@.name=='limit')]"
26+
- op: add
27+
path: "$.paths./me/player/recently-played.get.parameters"
28+
value:
29+
$ref: '#/components/parameters/QueryLimit'

spotify-web-api-open-api/src/main/resources/patches/path-search.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: Fix parameter type
1+
description: Fix schema of type parameter and fix minimum value of limit parameter
22
operations:
33
- op: test
44
path: "$.paths./search.get.parameters[?(@.name=='type')].schema.items"
@@ -26,3 +26,9 @@ operations:
2626
- episode
2727
- op: delete
2828
path: "$.paths./search.get.parameters[?(@.name=='type')].schema.enum"
29+
- op: test
30+
path: "$.paths./search.get.parameters[?(@.name=='limit')].schema.minimum"
31+
value: [0]
32+
- op: set
33+
path: "$.paths./search.get.parameters[?(@.name=='limit')].schema.minimum"
34+
value: 1

0 commit comments

Comments
 (0)