コード例 #1
0
    def validate(cls, left_spec, right_spec):
        # type: (Spec, Spec) -> typing.Iterable[ValidationMessage]

        request_parameter_paths = RequestParametersWalker(left_spec, right_spec).walk()
        response_paths = ResponsePathsWalker(left_spec, right_spec).walk()

        for changed_types_diff in ChangedTypesDifferWalker(left_spec, right_spec).walk():
            if (
                not is_path_in_top_level_paths(request_parameter_paths, changed_types_diff.path) and
                not is_path_in_top_level_paths(response_paths, changed_types_diff.path)
            ):
                continue
            yield cls.validation_message(format_path(changed_types_diff.path))
    def validate(cls, left_spec, right_spec):
        # type: (Spec, Spec) -> typing.Iterable[ValidationMessage]
        request_parameters_paths = RequestParametersWalker(left_spec, right_spec).walk()

        # FIXME: the used walker is not able to merge together parameters defined in different locations
        for required_property_diff in RequiredPropertiesDifferWalker(left_spec, right_spec).walk():
            if not required_property_diff.mapping.new:
                continue
            if not is_path_in_top_level_paths(request_parameters_paths, required_property_diff.path):
                continue
            yield cls.validation_message(format_path(required_property_diff.path))
 def validate(cls, left_spec, right_spec):
     # type: (Spec, Spec) -> typing.Iterable[ValidationMessage]
     response_paths = ResponsePathsWalker(left_spec, right_spec).walk()
     for required_property_diff in RequiredPropertiesDifferWalker(
             left_spec, right_spec).walk():
         if not required_property_diff.mapping.old:
             continue
         if not is_path_in_top_level_paths(response_paths,
                                           required_property_diff.path):
             continue
         yield cls.validation_message(
             format_path(required_property_diff.path))
コード例 #4
0
    def validate(cls, left_spec, right_spec):
        # type: (Spec, Spec) -> typing.Iterable[ValidationMessage]
        response_paths = ResponsePathsWalker(left_spec, right_spec).walk()

        for enum_values_diff in EnumValuesDifferWalker(left_spec,
                                                       right_spec).walk():
            if not enum_values_diff.mapping.new:
                continue
            if not is_path_in_top_level_paths(response_paths,
                                              enum_values_diff.path):
                continue
            yield cls.validation_message(format_path(enum_values_diff.path))
 def validate(cls, left_spec, right_spec):
     # type: (Spec, Spec) -> typing.Iterable[ValidationMessage]
     response_paths = ResponsePathsWalker(left_spec, right_spec).walk()
     for additional_properties_diff in AdditionalPropertiesDifferWalker(
             left_spec, right_spec).walk():
         if additional_properties_diff.diff_type != DiffType.PROPERTIES:
             continue
         if additional_properties_diff.properties and not additional_properties_diff.properties.new:
             continue
         if not is_path_in_top_level_paths(response_paths,
                                           additional_properties_diff.path):
             continue
         yield cls.validation_message(
             format_path(additional_properties_diff.path))
コード例 #6
0
def test_is_path_in_top_level_paths(top_level_paths, path, expected_result):
    assert is_path_in_top_level_paths(top_level_paths, path) is expected_result