Пример #1
0
 def get_validation_error_message(self, given_shapes, input_params):
     s = ShapeResolver(given_shapes)
     input_shape = s.get_shape_by_name('Input')
     validator = ParamValidator()
     errors_found = validator.validate(input_params, input_shape)
     error_message = errors_found.generate_report()
     return errors_found
Пример #2
0
 def test_handles_recursive_shapes(self):
     # We're not using assert_skeleton_from_model_is
     # because we can't use a DenormalizedStructureBuilder,
     # we need a normalized model to represent recursive
     # shapes.
     shape_map = ShapeResolver(
         {
             "InputShape": {
                 "type": "structure",
                 "members": {"A": {"shape": "RecursiveStruct"}, "B": {"shape": "StringType"}},
             },
             "RecursiveStruct": {
                 "type": "structure",
                 "members": {"C": {"shape": "RecursiveStruct"}, "D": {"shape": "StringType"}},
             },
             "StringType": {"type": "string"},
         }
     )
     shape = shape_map.get_shape_by_name("InputShape")
     actual = self.arg_generator.generate_skeleton(shape)
     expected = {
         "A": {
             "C": {
                 # For recurisve shapes, we'll just show
                 # an empty dict.
             },
             "D": "",
         },
         "B": "",
     }
     self.assertEqual(actual, expected)
Пример #3
0
 def test_handles_recursive_shapes(self):
     # We're not using assert_skeleton_from_model_is
     # because we can't use a DenormalizedStructureBuilder,
     # we need a normalized model to represent recursive
     # shapes.
     shape_map = ShapeResolver({
         'InputShape': {
             'type': 'structure',
             'members': {
                 'A': {
                     'shape': 'RecursiveStruct'
                 },
                 'B': {
                     'shape': 'StringType'
                 },
             }
         },
         'RecursiveStruct': {
             'type': 'structure',
             'members': {
                 'C': {
                     'shape': 'RecursiveStruct'
                 },
                 'D': {
                     'shape': 'StringType'
                 },
             }
         },
         'StringType': {
             'type': 'string',
         }
     })
     shape = shape_map.get_shape_by_name('InputShape')
     actual = self.arg_generator.generate_skeleton(shape)
     expected = {
         'A': {
             'C': {
                 # For recurisve shapes, we'll just show
                 # an empty dict.
             },
             'D': ''
         },
         'B': ''
     }
     self.assertEqual(actual, expected)
Пример #4
0
 def test_handles_recursive_shapes(self):
     # We're not using assert_skeleton_from_model_is
     # because we can't use a DenormalizedStructureBuilder,
     # we need a normalized model to represent recursive
     # shapes.
     shape_map = ShapeResolver({
         'InputShape': {
             'type': 'structure',
             'members': {
                 'A': {'shape': 'RecursiveStruct'},
                 'B': {'shape': 'StringType'},
             }
         },
         'RecursiveStruct': {
             'type': 'structure',
             'members': {
                 'C': {'shape': 'RecursiveStruct'},
                 'D': {'shape': 'StringType'},
             }
         },
         'StringType': {
             'type': 'string',
         }
     })
     shape = shape_map.get_shape_by_name('InputShape')
     actual = self.arg_generator.generate_skeleton(shape)
     expected = {
         'A': {
             'C': {
                 # For recurisve shapes, we'll just show
                 # an empty dict.
             },
             'D': ''
         },
         'B': ''
     }
     self.assertEqual(actual, expected)
Пример #5
0
 def get_validation_error_message(self, given_shapes, input_params):
     s = ShapeResolver(given_shapes)
     input_shape = s.get_shape_by_name('Input')
     validator = ParamValidator()
     errors_found = validator.validate(input_params, input_shape)
     return errors_found