Skip to content

Commit

Permalink
Add custom validation functions for language-related properties [SDBE…
Browse files Browse the repository at this point in the history
…LGA-798] (#1977)

* Add custom validation functions for language-related properties [SDBELGA-798]

* update tests
  • Loading branch information
devketanpro authored Apr 30, 2024
1 parent d32f463 commit 4010167
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
24 changes: 15 additions & 9 deletions server/features/events_post.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1193,22 +1193,28 @@ Feature: Events Post
[{
"_id": "event",
"name": "event",
"editor": {
"related_plannings": {"enabled": true}
},
"editor": {"related_plannings": {"enabled": true}, "language": {"enabled": true}},
"schema": {
"related_plannings": {"planning_auto_publish": true}
"related_plannings": {"planning_auto_publish": true},
"language": {
"languages": ["nl", "fr"],
"multilingual": true,
"default_language": "nl"
}
}
},
{
"_id": "planning",
"name": "planning",
"editor": {
"slugline": {"enabled": true}
},
"editor": {"slugline": {"enabled": true}, "language": {"enabled": true}},
"schema": {
"slugline": {"required": true}
}
"slugline": {"required": true},
"language": {
"languages": ["nl", "fr"],
"multilingual": true,
"default_language": "nl"
}
}
}
]
"""
Expand Down
18 changes: 18 additions & 0 deletions server/planning/validate/planning_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,24 @@ def _validate_planning_auto_publish(self, planning_auto_publish, field, value):
"""
pass

def _validate_default_language(self, default_language, field, value):
"""
{'type': string, 'nullable': True}
"""
pass

def _validate_languages(self, languages, field, value):
"""
{'type': 'list', 'nullable': True}
"""
pass

def _validate_multilingual(self, multilingual, field, value):
"""
{'type': 'boolean', 'nullable': True}
"""
pass


class PlanningValidateResource(Resource):
endpoint_name = "planning_validator"
Expand Down

0 comments on commit 4010167

Please sign in to comment.