Skip to content

Commit

Permalink
Merge pull request #90 from iheartradio/updating-artist-schema
Browse files Browse the repository at this point in the history
Updating artist schema to include multiple artists
  • Loading branch information
adityaghosh authored Mar 25, 2020
2 parents cf8fce9 + 2eea60c commit 161471f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
8 changes: 8 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog
=========

Version 2.5.0
==============

Released 2020-03-25

- Adding an optional ``artists`` key in the artist schema,
this lists the individual artists if present in the DDEX delivery.

Version 2.4.0
==============

Expand Down
6 changes: 6 additions & 0 deletions pipeline/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ def validate_schema(schema, message, logger=None):
# shared sub-types
artist = SchemaAllRequired({
'name': str,
Optional('artists'): [Any(
None, Schema({
'artist_name': str,
'artist_role': str,
'sequence_number': Any(None, int),
}))],
Optional('url'): Any(None, str),
})
"""Schema to validate an artist.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pipeline',
version='2.4.0',
version='2.5.0',
packages=find_packages(exclude=['tests']),
install_requires=[
'Henson>=0.5.0',
Expand Down
6 changes: 4 additions & 2 deletions tests/data/schema/valid-nulled-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"albumReleaseType": "Single",
"amwKey": "EMS_4260100940705",
"artist": {
"name": "Fäbson"
"name": "Fäbson",
"artists": []
},
"catalogNumber": "4260100940705",
"copyright": {
Expand Down Expand Up @@ -73,7 +74,8 @@
"alternativeName": "Mama",
"amwKey": "EMS_4260100940705_DEUD91708166_1_1",
"artist": {
"name": "Fäbson"
"name": "Fäbson",
"artists": []
},
"copyright": {
"text": "ILM Records",
Expand Down
27 changes: 24 additions & 3 deletions tests/data/schema/valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
"albumReleaseType": "Album",
"amwKey": "iHM_UPC",
"artist": {
"name": "Artist"
"name": "Artist",
"artists": [
{
"artist_name": "Artist",
"artist_role": "Main Artist",
"sequence_number": 1
}
]
},
"catalogNumber": "catalognumber",
"copyright": {
Expand Down Expand Up @@ -53,7 +60,14 @@
"action": "upsert",
"amwKey": "iHM_UPC_ISRC",
"artist": {
"name": "Artist"
"name": "Artist",
"artists": [
{
"artist_name": "Artist",
"artist_role": "Main Artist",
"sequence_number": 1
}
]
},
"copyright": {
"text": "2015 Copyright",
Expand Down Expand Up @@ -102,7 +116,14 @@
"action": "upsert",
"amwKey": "iHM_UPC_ISRC",
"artist": {
"name": "Artist"
"name": "Artist",
"artists": [
{
"artist_name": "Artist",
"artist_role": "Main Artist",
"sequence_number": 1
}
]
},
"copyright": {
"text": "2015 Copyright",
Expand Down

0 comments on commit 161471f

Please sign in to comment.