Remove usage of relative_path in ValidationError Objects
* 'relative_path' requires JSONSchema 2.4.0 * Defaults to trying 'relative_path' and falls back to 'path' Change-Id: Ie8902a3b943ea4e631155ae208aed9d3911c9767 Closes-Bug: #1436261
This commit is contained in:
parent
669fb8fbe2
commit
2709bd7187
@ -32,9 +32,7 @@ class ValidationErrorAPIv2Adapter(base.APIv2Adapter):
|
||||
|
||||
MODIFICATIONS = {
|
||||
'fields': {
|
||||
"path": {
|
||||
'rename': 'absolute_path'
|
||||
},
|
||||
"path": {},
|
||||
"message": {},
|
||||
"validator": {},
|
||||
"validator_value": {},
|
||||
|
@ -16,8 +16,7 @@ from designate.objects import base
|
||||
|
||||
class ValidationError(base.DesignateObject):
|
||||
FIELDS = {
|
||||
'relative_path': {},
|
||||
'absolute_path': {},
|
||||
'path': {},
|
||||
'message': {},
|
||||
'validator': {},
|
||||
'validator_value': {},
|
||||
@ -31,8 +30,7 @@ class ValidationError(base.DesignateObject):
|
||||
"""
|
||||
|
||||
e = cls()
|
||||
e.relative_path = list(js_error.relative_path)
|
||||
e.absolute_path = list(js_error.absolute_path)
|
||||
e.path = list(getattr(js_error, 'releative_path', js_error.path))
|
||||
e.message = js_error.message
|
||||
e.validator = js_error.validator
|
||||
e.validator_value = js_error.validator_value
|
||||
|
@ -382,8 +382,7 @@ class DesignateObjectTest(tests.TestCase):
|
||||
|
||||
# Ensure the nested ID field has triggered the failure.
|
||||
# For some reason testtools turns lists into deques :/
|
||||
self.assertEqual(list(error.absolute_path), ['nested', 'id'])
|
||||
self.assertEqual(list(error.relative_path), ['nested', 'id'])
|
||||
self.assertEqual(error.path, ['nested', 'id'])
|
||||
|
||||
# Set the Nested ID field to a valid value
|
||||
obj.nested.id = 'ffded5c4-e4f6-4e02-a175-48e13c5c12a0'
|
||||
|
Loading…
Reference in New Issue
Block a user