Skip to content

Commit ea7b07d

Browse files
authored
Validation fixes for tracks/color and session_types/length (#9006)
1 parent 40d9c24 commit ea7b07d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

app/api/schema/session_types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class Meta:
2626

2727
@validates_schema
2828
def validate_length(self, data):
29+
if 'length' not in data:
30+
raise UnprocessableEntityError(
31+
{'pointer': '/data/attributes/length'},
32+
"Length attribute is missing",
33+
)
2934
try:
3035
datetime.strptime(data['length'], '%H:%M')
3136
except ValueError:

app/api/schema/tracks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class Meta:
2626

2727
@validates_schema
2828
def valid_color(self, data):
29+
if 'color' not in data:
30+
raise UnprocessableEntityError(
31+
{'pointer': '/data/attributes/color'},
32+
"Color attribut is required",
33+
)
2934
if not re.search(r'^#(?:[0-9a-fA-F]{3}){1,2}$', data['color']):
3035
raise UnprocessableEntityError(
3136
{'pointer': 'data/attributes/color'},

0 commit comments

Comments
 (0)