From 4ac2289810230eea30b28c28ebe55e440e754727 Mon Sep 17 00:00:00 2001 From: Nam Vu Date: Thu, 11 Jul 2024 17:17:43 +0200 Subject: [PATCH] test: assert equivalent differences - Create one subfolder per test case - Convert all JSON specs to YAML - Create diff.json filew with the expected differences - Replace all test cases with this new validation --- src/Criteo.OpenApi.Comparator.Cli/Program.cs | 8 +- .../OpenApiEnumDirectionTests.cs | 92 -- .../OpenApiSpecificationsCompareTests.cs | 956 ++---------------- .../added_additional_properties/diff.json | 20 + .../new.yaml} | 0 .../added_additional_properties/old.yaml | 33 + .../Resource/added_enum_value/diff.json | 56 + .../new.yaml} | 0 .../Resource/added_enum_value/old.yaml | 68 ++ .../Resource/added_header/diff.json | 20 + .../new.yaml} | 0 .../Resource/added_header/old.yaml | 24 + .../Resource/added_operation/diff.json | 20 + .../new.yaml} | 0 .../Resource/added_operation/old.yaml | 26 + .../added_optional_parameter/diff.json | 11 + .../new.yaml} | 0 .../added_optional_parameter/old.yaml | 31 + .../added_optional_property/diff.json | 20 + .../new.yaml} | 0 .../Resource/added_optional_property/old.yaml | 38 + .../Resource/added_path/diff.json | 11 + .../added_path.yaml => added_path/new.yaml} | 0 .../Resource/added_path/old.yaml | 9 + .../added_property_in_response/diff.json | 38 + .../new.yaml} | 0 .../added_property_in_response/old.yaml | 53 + .../diff.json | 29 + .../new.yaml} | 0 .../old.yaml | 53 + .../Resource/added_request_body/diff.json | 11 + .../new.yaml} | 0 .../Resource/added_request_body/old.yaml | 46 + .../added_required_parameter/diff.json | 11 + .../new.yaml} | 0 .../added_required_parameter/old.yaml | 33 + .../added_required_property/diff.json | 29 + .../new.yaml} | 0 .../Resource/added_required_property/old.yaml | 45 + .../Resource/added_response_code/diff.json | 20 + .../new.yaml} | 0 .../Resource/added_response_code/old.yaml | 28 + .../added_schema_in_response/diff.json | 11 + .../new.yaml} | 0 .../added_schema_in_response/old.yaml | 34 + .../changed_parameter_order/diff.json | 20 + .../new.yaml} | 0 .../Resource/changed_parameter_order/old.yaml | 34 + .../constant_status_has_changed/diff.json | 29 + .../new.yaml} | 0 .../constant_status_has_changed/old.yaml | 35 + .../Resource/constraint_changed/diff.json | 56 + .../new.yaml} | 0 .../Resource/constraint_changed/old.yaml | 47 + .../Resource/constraint_is_stronger/diff.json | 83 ++ .../new.yaml} | 0 .../Resource/constraint_is_stronger/old.yaml | 61 ++ .../Resource/constraint_is_weaker/diff.json | 83 ++ .../new.yaml} | 0 .../Resource/constraint_is_weaker/old.yaml | 57 ++ .../Resource/default_value_changed/diff.json | 29 + .../new.yaml} | 0 .../Resource/default_value_changed/old.yaml | 46 + .../Resource/different_allOf/diff.json | 29 + .../new.yaml} | 0 .../Resource/different_allOf/old.yaml | 75 ++ .../different_discriminator/diff.json | 38 + .../new.yaml} | 0 .../Resource/different_discriminator/old.yaml | 58 ++ .../enum_direction_body_add/diff.json | 20 + .../Resource/enum_direction_body_add/new.yaml | 46 + .../Resource/enum_direction_body_add/old.yaml | 45 + .../enum_direction_body_remove/diff.json | 20 + .../enum_direction_body_remove/new.yaml | 44 + .../enum_direction_body_remove/old.yaml | 45 + .../enum_direction_both_ref_add/diff.json | 38 + .../enum_direction_both_ref_add/new.yaml | 49 + .../enum_direction_both_ref_add/old.yaml | 48 + .../enum_direction_both_ref_remove/diff.json | 38 + .../enum_direction_both_ref_remove/new.yaml | 47 + .../enum_direction_both_ref_remove/old.yaml | 48 + .../enum_direction_path_add/diff.json | 20 + .../Resource/enum_direction_path_add/new.yaml | 46 + .../Resource/enum_direction_path_add/old.yaml | 45 + .../enum_direction_path_remove/diff.json | 29 + .../enum_direction_path_remove/new.yaml | 44 + .../enum_direction_path_remove/old.yaml | 45 + .../enum_direction_query_add/diff.json | 20 + .../enum_direction_query_add/new.yaml | 46 + .../enum_direction_query_add/old.yaml | 45 + .../enum_direction_query_remove/diff.json | 20 + .../enum_direction_query_remove/new.yaml | 44 + .../enum_direction_query_remove/old.yaml | 45 + .../enum_direction_request_ref_add/diff.json | 20 + .../enum_direction_request_ref_add/new.yaml | 49 + .../enum_direction_request_ref_add/old.yaml | 48 + .../diff.json | 20 + .../new.yaml | 47 + .../old.yaml | 48 + .../enum_direction_response_add/diff.json | 20 + .../enum_direction_response_add/new.yaml | 46 + .../enum_direction_response_add/old.yaml | 45 + .../enum_direction_response_ref_add/diff.json | 20 + .../enum_direction_response_ref_add/new.yaml | 49 + .../enum_direction_response_ref_add/old.yaml | 48 + .../diff.json | 20 + .../new.yaml | 47 + .../old.yaml | 48 + .../enum_direction_response_remove/diff.json | 20 + .../enum_direction_response_remove/new.yaml | 44 + .../enum_direction_response_remove/old.yaml | 45 + .../Resource/long_running_operation/diff.json | 20 + .../new.yaml} | 0 .../Resource/long_running_operation/old.yaml | 17 + .../Resource/modified_operation_id/diff.json | 29 + .../new.yaml} | 0 .../Resource/modified_operation_id/old.yaml | 15 + .../Resource/no_version_change/diff.json | 11 + .../new.yaml} | 0 .../old.yaml} | 0 .../nullable_property_changed/diff.json | 20 + .../new.yaml} | 0 .../nullable_property_changed/old.yaml | 35 + .../old/added_additional_properties.json | 56 - .../Resource/old/added_enum_value.json | 106 -- .../Resource/old/added_header.json | 40 - .../Resource/old/added_operation.json | 41 - .../old/added_optional_parameter.json | 50 - .../Resource/old/added_optional_property.json | 63 -- .../Resource/old/added_path.json | 15 - .../old/added_property_in_response.json | 83 -- .../added_readOnly_property_in_response.json | 83 -- .../Resource/old/added_request_body.json | 79 -- .../old/added_required_parameter.json | 52 - .../Resource/old/added_required_property.json | 69 -- .../Resource/old/added_response_code.json | 44 - .../old/added_schema_in_response.json | 55 - .../Resource/old/changed_parameter_order.json | 55 - .../old/constant_status_has_changed.json | 57 -- .../Resource/old/constraint_changed.json | 78 -- .../Resource/old/constraint_is_stronger.json | 97 -- .../Resource/old/constraint_is_weaker.json | 91 -- .../Resource/old/default_value_changed.json | 68 -- .../Resource/old/different_allOf.json | 124 --- .../Resource/old/different_discriminator.json | 90 -- .../Resource/old/long_running_operation.json | 27 - .../Resource/old/modified_operation_id.json | 24 - .../Resource/old/no_version_change.json | 8 - .../old/nullable_property_changed.json | 52 - .../old/parameter_in_has_changed.json | 55 - .../Resource/old/parameter_style_changed.json | 88 -- .../Resource/old/polymorphic_schema.json | 127 --- .../old/readonly_property_changed.json | 67 -- .../Resource/old/recursive_model.json | 86 -- .../Resource/old/reference_redirection.json | 103 -- .../old/removed_additional_properties.json | 81 -- .../old/removed_client_parameter.json | 44 - .../Resource/old/removed_enum_value.json | 86 -- .../Resource/old/removed_header.json | 45 - .../Resource/old/removed_operation.json | 25 - .../Resource/old/removed_path.json | 37 - .../Resource/old/removed_property.json | 91 -- .../Resource/old/removed_request_body.json | 96 -- .../old/removed_required_parameter.json | 55 - .../Resource/old/removed_response_code.json | 51 - .../Resource/old/removed_schema.json | 84 -- .../old/removed_schema_in_response.json | 58 -- ...quest_body_format_no_longer_supported.json | 120 --- .../request_body_format_now_supported.json | 67 -- .../Resource/old/required_status_changed.json | 102 -- .../response_body_format_now_supported.json | 86 -- .../old/server_no_longer_supported.json | 21 - .../Resource/old/type_changed.json | 68 -- .../Resource/old/type_format_changed.json | 62 -- .../Resource/old/valid_oas.json | 242 ----- .../Resource/old/version_reversed.json | 8 - .../Resource/old/x-ms-paths.json | 98 -- .../parameter_in_has_changed/diff.json | 20 + .../new.yaml} | 0 .../parameter_in_has_changed/old.yaml | 34 + .../parameter_style_changed/diff.json | 29 + .../new.yaml} | 0 .../Resource/parameter_style_changed/old.yaml | 52 + .../Resource/polymorphic_schema/diff.json | 11 + .../new.yaml} | 0 .../Resource/polymorphic_schema/old.yaml | 76 ++ .../readonly_property_changed/diff.json | 29 + .../new.yaml} | 0 .../readonly_property_changed/old.yaml | 45 + .../Resource/recursive_model/diff.json | 38 + .../new.yaml} | 0 .../Resource/recursive_model/old.yaml | 74 ++ .../Resource/reference_redirection/diff.json | 20 + .../new.yaml} | 0 .../Resource/reference_redirection/old.yaml | 63 ++ .../removed_additional_properties/diff.json | 20 + .../new.yaml} | 0 .../removed_additional_properties/old.yaml | 50 + .../removed_client_parameter/diff.json | 11 + .../new.yaml} | 0 .../removed_client_parameter/old.yaml | 29 + .../Resource/removed_enum_value/diff.json | 56 + .../new.yaml} | 0 .../Resource/removed_enum_value/old.yaml | 56 + .../Resource/removed_header/diff.json | 20 + .../new.yaml} | 0 .../Resource/removed_header/old.yaml | 27 + .../Resource/removed_operation/diff.json | 11 + .../new.yaml} | 0 .../Resource/removed_operation/old.yaml | 16 + .../Resource/removed_path/diff.json | 20 + .../new.yaml} | 0 .../Resource/removed_path/old.yaml | 24 + .../Resource/removed_property/diff.json | 29 + .../new.yaml} | 0 .../Resource/removed_property/old.yaml | 59 ++ .../Resource/removed_request_body/diff.json | 11 + .../new.yaml} | 0 .../Resource/removed_request_body/old.yaml | 56 + .../removed_required_parameter/diff.json | 11 + .../new.yaml} | 0 .../removed_required_parameter/old.yaml | 34 + .../Resource/removed_response_code/diff.json | 20 + .../new.yaml} | 0 .../Resource/removed_response_code/old.yaml | 32 + .../Resource/removed_schema/diff.json | 11 + .../new.yaml} | 0 .../Resource/removed_schema/old.yaml | 55 + .../removed_schema_in_response/diff.json | 11 + .../new.yaml} | 0 .../removed_schema_in_response/old.yaml | 36 + .../diff.json | 38 + .../new.yaml} | 0 .../old.yaml | 71 ++ .../diff.json | 11 + .../new.yaml} | 0 .../old.yaml | 39 + .../required_status_changed/diff.json | 29 + .../new.yaml} | 0 .../Resource/required_status_changed/old.yaml | 67 ++ .../diff.json | 47 + .../new.yaml} | 0 .../old.yaml | 50 + .../server_no_longer_supported/diff.json | 20 + .../new.yaml} | 0 .../server_no_longer_supported/old.yaml | 11 + .../Resource/type_changed/diff.json | 38 + .../new.yaml} | 0 .../Resource/type_changed/old.yaml | 45 + .../Resource/type_format_changed/diff.json | 38 + .../new.yaml} | 0 .../Resource/type_format_changed/old.yaml | 39 + .../Resource/valid_oas/diff.json | 1 + .../valid_oas.yaml => valid_oas/new.yaml} | 0 .../Resource/valid_oas/old.yaml | 156 +++ .../Resource/version_reversed/diff.json | 11 + .../Resource/version_reversed/new.yaml | 5 + .../Resource/version_reversed/old.yaml | 5 + .../Resource/x-ms-paths/diff.json | 29 + .../x-ms-paths.yaml => x-ms-paths/new.yaml} | 0 .../Resource/x-ms-paths/old.yaml | 59 ++ 261 files changed, 5455 insertions(+), 4742 deletions(-) delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/OpenApiEnumDirectionTests.cs create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_additional_properties.yaml => added_additional_properties/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_enum_value.yaml => added_enum_value/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_header.yaml => added_header/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_operation.yaml => added_operation/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_optional_parameter.yaml => added_optional_parameter/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_optional_property.yaml => added_optional_property/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_path.yaml => added_path/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_property_in_response.yaml => added_property_in_response/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_readOnly_property_in_response.yaml => added_readOnly_property_in_response/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_request_body.yaml => added_request_body/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_required_parameter.yaml => added_required_parameter/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_required_property.yaml => added_required_property/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_response_code.yaml => added_response_code/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/added_schema_in_response.yaml => added_schema_in_response/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/changed_parameter_order.yaml => changed_parameter_order/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/constant_status_has_changed.yaml => constant_status_has_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/constraint_changed.yaml => constraint_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/constraint_is_stronger.yaml => constraint_is_stronger/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/constraint_is_weaker.yaml => constraint_is_weaker/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/default_value_changed.yaml => default_value_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/different_allOf.yaml => different_allOf/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/different_discriminator.yaml => different_discriminator/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/long_running_operation.yaml => long_running_operation/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/modified_operation_id.yaml => modified_operation_id/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/no_version_change.yaml => no_version_change/new.yaml} (100%) rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/version_reversed.yaml => no_version_change/old.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/nullable_property_changed.yaml => nullable_property_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/old.yaml delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_additional_properties.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_enum_value.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_header.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_operation.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_parameter.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_property.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_path.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_property_in_response.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_readOnly_property_in_response.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_request_body.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_parameter.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_property.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_response_code.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_schema_in_response.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/changed_parameter_order.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/constant_status_has_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_stronger.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_weaker.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/default_value_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_allOf.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_discriminator.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/long_running_operation.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/modified_operation_id.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/no_version_change.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/nullable_property_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_in_has_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_style_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/polymorphic_schema.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/readonly_property_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/recursive_model.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/reference_redirection.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_additional_properties.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_client_parameter.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_enum_value.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_header.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_operation.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_path.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_property.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_request_body.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_required_parameter.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_response_code.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema_in_response.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_no_longer_supported.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_now_supported.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/required_status_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/response_body_format_now_supported.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/server_no_longer_supported.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_format_changed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/valid_oas.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/version_reversed.json delete mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/old/x-ms-paths.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/parameter_in_has_changed.yaml => parameter_in_has_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/parameter_style_changed.yaml => parameter_style_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/polymorphic_schema.yaml => polymorphic_schema/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/readonly_property_changed.yaml => readonly_property_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/recursive_model.yaml => recursive_model/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/reference_redirection.yaml => reference_redirection/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_additional_properties.yaml => removed_additional_properties/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_client_parameter.yaml => removed_client_parameter/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_enum_value.yaml => removed_enum_value/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_header.yaml => removed_header/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_operation.yaml => removed_operation/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_path.yaml => removed_path/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_property.yaml => removed_property/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_request_body.yaml => removed_request_body/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_required_parameter.yaml => removed_required_parameter/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_response_code.yaml => removed_response_code/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_schema.yaml => removed_schema/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/removed_schema_in_response.yaml => removed_schema_in_response/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/request_body_format_no_longer_supported.yaml => request_body_format_no_longer_supported/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/request_body_format_now_supported.yaml => request_body_format_now_supported/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/required_status_changed.yaml => required_status_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/response_body_format_now_supported.yaml => response_body_format_now_supported/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/server_no_longer_supported.yaml => server_no_longer_supported/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/type_changed.yaml => type_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/type_format_changed.yaml => type_format_changed/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/valid_oas.yaml => valid_oas/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/diff.json create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/new.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/old.yaml create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/diff.json rename src/Criteo.OpenApi.Comparator.UTest/Resource/{new/x-ms-paths.yaml => x-ms-paths/new.yaml} (100%) create mode 100644 src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/old.yaml diff --git a/src/Criteo.OpenApi.Comparator.Cli/Program.cs b/src/Criteo.OpenApi.Comparator.Cli/Program.cs index fde605a..60fa244 100644 --- a/src/Criteo.OpenApi.Comparator.Cli/Program.cs +++ b/src/Criteo.OpenApi.Comparator.Cli/Program.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Net.Http; using System.Text.Json; +using System.Text.Json.Serialization; namespace Criteo.OpenApi.Comparator.Cli { @@ -114,7 +115,12 @@ private static void DisplayOutput(IEnumerable differences, Ou { if (outputFormat == OutputFormat.Json) { - Console.WriteLine(JsonSerializer.Serialize(differences, new JsonSerializerOptions { WriteIndented = true })); + var serializerOptions = new JsonSerializerOptions + { + WriteIndented = true, + Converters = { new JsonStringEnumConverter() } + }; + Console.WriteLine(JsonSerializer.Serialize(differences, serializerOptions)); return; } diff --git a/src/Criteo.OpenApi.Comparator.UTest/OpenApiEnumDirectionTests.cs b/src/Criteo.OpenApi.Comparator.UTest/OpenApiEnumDirectionTests.cs deleted file mode 100644 index e970291..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/OpenApiEnumDirectionTests.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Criteo Technology. All rights reserved. -// Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. - -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using Criteo.OpenApi.Comparator.Logging; -using NUnit.Framework; - -namespace Criteo.OpenApi.Comparator.UTest; - -[TestFixture] -public class OpenApiEnumDirectionTests -{ - [TestCase("old_without_refs", "path_add", "#/paths/~1order~1{path}/post/parameters/0/schema/enum")] - [TestCase("old_without_refs", "query_add", "#/paths/~1order~1{path}/post/parameters/1/schema/enum")] - [TestCase("old_without_refs", "body_add", "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum")] - [TestCase("old_with_refs", "request_ref_add", "#/paths/~1order~1{path}/post/parameters/0/schema/enum")] - public void CompareOAS_ShouldReturn_NonBreaking_AddedEnumValueChange(string oldName, string newName, string jsonRef, int expectedDifferencesCount = 1) - { - var differences = CompareSpecifications(oldName, newName); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.AddedEnumValue, - Severity = Severity.Warning, - NewJsonRef = jsonRef - }, expectedDifferencesCount); - } - - - [TestCase("old_without_refs", "response_add", "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum")] - [TestCase("old_with_refs", "response_ref_add", "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum")] - [TestCase("old_with_refs", "both_ref_add", "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", 2)] - public void CompareOAS_ShouldReturn_Breaking_AddedEnumValueChange(string oldName, string newName, string jsonRef, int expectedDifferencesCount = 1) - { - var differences = CompareSpecifications(oldName, newName); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.AddedEnumValue, - Severity = Severity.Error, - NewJsonRef = jsonRef - }, expectedDifferencesCount); - } - - [TestCase("old_without_refs", "response_remove", "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum")] - [TestCase("old_with_refs", "response_ref_remove", "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum")] - public void CompareOAS_ShouldReturn_NonBreaking_RemovedEnumValueChange(string oldName, string newName, string jsonRef, int expectedDifferencesCount = 1) - { - var differences = CompareSpecifications(oldName, newName); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.RemovedEnumValue, - Severity = Severity.Warning, - NewJsonRef = jsonRef - }, expectedDifferencesCount); - } - - [TestCase("old_without_refs", "path_remove", "#/paths/~1order~1{path}/post/parameters/0/schema/enum")] - [TestCase("old_without_refs", "query_remove", "#/paths/~1order~1{path}/post/parameters/1/schema/enum")] - [TestCase("old_without_refs", "body_remove", "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum")] - [TestCase("old_with_refs", "request_ref_remove", "#/paths/~1order~1{path}/post/parameters/0/schema/enum")] - [TestCase("old_with_refs", "both_ref_remove", "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum")] - public void CompareOAS_ShouldReturn_Breaking_RemovedEnumValueChange(string oldName, string newName, string jsonRef, int expectedDifferencesCount = 1) - { - var differences = CompareSpecifications(oldName, newName); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.RemovedEnumValue, - Severity = Severity.Error, - NewJsonRef = jsonRef, - }, expectedDifferencesCount); - } - - private static IList CompareSpecifications(string oldName, string newName) - { - var baseDirectory = Directory - .GetParent(typeof(OpenApiSpecificationsCompareTests).GetTypeInfo().Assembly.Location) - .ToString(); - - var oldFileName = Path.Combine(baseDirectory, "Resource", "enum_direction", oldName + ".json"); - var newFileName = Path.Combine(baseDirectory, "Resource", "enum_direction", newName + ".yaml"); - - var differences = OpenApiComparator - .Compare(File.ReadAllText(oldFileName), File.ReadAllText(newFileName), strict: true) - .ToList(); - - OpenApiSpecificationsCompareTests.ValidateDifferences(differences); - - return differences; - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs b/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs index 97ad994..1c4d003 100644 --- a/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs +++ b/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs @@ -2,911 +2,89 @@ // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. using System.IO; -using System.Linq; using NUnit.Framework; -using System.Collections.Generic; using System.Reflection; +using System.Text.Json; +using System.Text.Json.Serialization; using Criteo.OpenApi.Comparator.Logging; +using System.Collections.Generic; +using System.Linq; -namespace Criteo.OpenApi.Comparator.UTest +namespace Criteo.OpenApi.Comparator.UTest; + +/// +/// This class contains tests for the logic comparing two swagger specifications, +/// an older version against newer version. +/// +/// For all but the tests that verify that version checks are done properly, the +/// old and new specifications have the same version number, which should force +/// the comparison logic to produce errors rather than warnings for each breaking +/// change. +/// +/// Non-breaking changes are always presented as informational messages, regardless +/// of whether the version has changed or not. +/// +[TestFixture] +public class OpenApiSpecificationsCompareTests { - /// - /// This class contains tests for the logic comparing two swagger specifications, - /// an older version against newer version. - /// - /// For all but the tests that verify that version checks are done properly, the - /// old and new specifications have the same version number, which should force - /// the comparison logic to produce errors rather than warnings for each breaking - /// change. - /// - /// Non-breaking changes are always presented as informational messages, regardless - /// of whether the version has changed or not. - /// - [TestFixture] - public class OpenApiSpecificationsCompareTests + private static readonly JsonSerializerOptions serializerOptions = new() { - [Test] - public void CompareOAS_ShouldNotReturn_Differences() - { - var differences = CompareSpecifications("valid_oas"); - Assert.That(differences, Is.Empty); - } - - [Test] - public void CompareOAS_ShouldNotReturn_Warnings_When_NoVersionChanged() - { - var differences = CompareSpecifications("no_version_change"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.NoVersionChange, - Severity = Severity.Info, - OldJsonRef = "#/info/version" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_VersionReversedDifferences() - { - var differences = CompareSpecifications("version_reversed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.VersionsReversed, - Severity = Severity.Error, - OldJsonRef = "#/info/version" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedPathDifferences() - { - var differences = CompareSpecifications("removed_path"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedPath, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Parameters~1{a}" - }); - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedPath, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Responses" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedPathDifferences() - { - var differences = CompareSpecifications("added_path"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedPath, - Severity = Severity.Info, - NewJsonRef = "#/paths/~1api~1Paths" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedOperationDifferences() - { - var differences = CompareSpecifications("removed_operation"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedOperation, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Operations/post" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedOperationDifferences() - { - var differences = CompareSpecifications("added_operation"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedOperation, - Severity = Severity.Info, - NewJsonRef = "#/paths/~1api~1Paths/post" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ModifiedOperationIdDifferences() - { - var differences = CompareSpecifications("modified_operation_id"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ModifiedOperationId, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Paths/get/operationId", - OldJsonRef = "#/paths/~1api~1Operations/get/operationId" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedResponseCodeDifferences() - { - var differences = CompareSpecifications("added_response_code"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddingResponseCode, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Operations/post/responses/200" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedResponseCodeDifferences() - { - var differences = CompareSpecifications("removed_response_code"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedResponseCode, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Operations/post/responses/200" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedHeaderDifferences() - { - var differences = CompareSpecifications("added_header"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddingHeader, - Severity = Severity.Info, - NewJsonRef = "#/paths/~1api~1Responses/get/responses/200/headers/x-c" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedHeaderDifferences() - { - var differences = CompareSpecifications("removed_header"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovingHeader, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Responses/get/responses/200/headers/x-c" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_LongRunningOperationDifferences() - { - var differences = CompareSpecifications("long_running_operation"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.LongRunningOperationExtensionChanged, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/put/x-ms-long-running-operation" - }); - } - - /// - /// Verifies that if a referenced schema is removed, it's flagged. - /// But if an unreferenced schema is removed, it's not. - /// - [Test] - public void CompareOAS_ShouldReturn_RemovedSchemaDifferences() - { - var differences = CompareSpecifications("removed_schema"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedDefinition, - Severity = Severity.Warning, - OldJsonRef = "#/schemas/Pet" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedClientParameterDifferences() - { - var differences = CompareSpecifications("removed_client_parameter"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedClientParameter, - Severity = Severity.Warning, - OldJsonRef = "#/parameters/limitParam" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedRequiredParameterDifferences() - { - var differences = CompareSpecifications("removed_required_parameter"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedRequiredParameter, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Parameters/put/parameters/1" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedRequiredParameterDifferences() - { - var differences = CompareSpecifications("added_required_parameter"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddingRequiredParameter, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/put/parameters/1" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ParameterInHasChangedDifferences() - { - var differences = CompareSpecifications("parameter_in_has_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ParameterInHasChanged, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/put/parameters/0/in" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ConstantStatusHasChangedDifferences() - { - var differences = CompareSpecifications("constant_status_has_changed"); - - // If the number of values in an enum increases, then a ConstraintIsWeaker message will be raised as well - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstantStatusHasChanged, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/put/parameters/1/enum" - }, 1); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintIsWeaker, - Severity = Severity.Info, - }, 1); - } - - /// - /// Verifies that if you change the reference of a parameter, it is flagged. - /// Here the reference of a parameter and a response's item's schema is change. - /// The name of a referenced response is also changed, but shouldn't be flagged. - /// - /// - /// Just changing the name of a parameter schema in the definitions section does not change the wire format for - /// the parameter, so it shouldn't result in a separate error for the parameter. - /// - [Test] - public void CompareOAS_ShouldReturn_ReferenceRedirectionDifferences() - { - var differences = CompareSpecifications("reference_redirection"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ReferenceRedirection, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/items" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedEnumValueDifferences() - { - var differences = CompareSpecifications("removed_enum_value"); - - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.RemovedEnumValue, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Parameters/put/parameters/0/schema/enum" - }, 3); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintIsStronger, - Severity = Severity.Info, - }, 3); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedEnumValueDifferences() - { - var differences = CompareSpecifications("added_enum_value"); - - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.AddedEnumValue, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum" - }, 2); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintIsWeaker, - Severity = Severity.Info, - }, 4); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedAdditionalPropertiesDifferences() - { - var differences = CompareSpecifications("added_additional_properties"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedAdditionalProperties, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/additionalProperties" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedAdditionalPropertiesDifferences() - { - var differences = CompareSpecifications("removed_additional_properties"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedAdditionalProperties, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/additionalProperties" - }); - } - - /// - /// Verifies that if the format of a definition's property is changed, it's found - /// The response format change is counted twice: one time during the response comparison, - /// and the other time in the components comparison - /// The parameter format change in only counted once, because int32 -> int64 is allowed in a request direction - /// - [Test] - public void CompareOAS_ShouldReturn_TypeFormatChangedDifferences() - { - var differences = CompareSpecifications("type_format_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.TypeFormatChanged, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/sleepTime/format" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RequiredStatusChangedDifferences() - { - var differences = CompareSpecifications("required_status_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RequiredStatusChange, - OldJsonRef = "#/paths/~1pets/get/parameters/0/required" - }); - } - - /// - /// Verifies that if the type of a schema is changed (or a schema's property, which is also a schema), it's flagged. - /// But if the type of an unreferenced schema is changed, it's not. - /// - [Test] - public void CompareOAS_ShouldReturn_TypeChangedDifferences() - { - var differences = CompareSpecifications("type_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.TypeChanged, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/type" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_DefaultValueChangedDifferences() - { - var differences = CompareSpecifications("default_value_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.DefaultValueChanged, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/default" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ReadonlyPropertyChangedDifferences() - { - var differences = CompareSpecifications("readonly_property_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ReadonlyPropertyChanged, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/responses/default/content/application~1json/schema/readOnly" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_DifferentDiscriminatorDifferences() - { - var differences = CompareSpecifications("different_discriminator"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.DifferentDiscriminator, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/responses/404/content/application~1json/schema/discriminator" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedPropertyDifferences() - { - var differences = CompareSpecifications("removed_property"); + Converters = { new JsonStringEnumConverter() } + }; - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedProperty, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedRequiredPropertyDifferences() - { - var differences = CompareSpecifications("added_required_property"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedRequiredProperty, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/items" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedOptionalParameterDifferences() - { - var differences = CompareSpecifications("added_optional_parameter"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddingOptionalParameter, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/put/parameters/1" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedOptionalPropertyDifferences() - { - var differences = CompareSpecifications("added_optional_property"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedOptionalProperty, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1api~1Parameters/put/parameters/0/schema/properties/message" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ChangedParameterOrderDifferences() - { - var differences = CompareSpecifications("changed_parameter_order"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ChangedParameterOrder, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Parameters/put/parameters" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedPropertyInResponseDifferences() - { - var differences = CompareSpecifications("added_property_in_response"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedPropertyInResponse, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedReadOnlyPropertyInResponseDifferences() - { - var differences = CompareSpecifications("added_readOnly_property_in_response"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedReadOnlyPropertyInResponse, - Severity = Severity.Info, - NewJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ConstraintChangedDifferences() - { - var differences = CompareSpecifications("constraint_changed"); - - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintChanged, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/parameters/0/schema/properties/accessKey/pattern" - }, 3); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.RemovedEnumValue, - Severity = Severity.Warning - }, 1); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintChanged, - Severity = Severity.Info - }, 1); - } - - [Test] - public void CompareOAS_ShouldReturn_ConstraintIsStrongerDifferences() - { - var differences = CompareSpecifications("constraint_is_stronger"); - - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintIsStronger, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/parameters/0/schema/properties/minLimit/maximum" - }, 6); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintIsStronger, - Severity = Severity.Info - }, 2); - } - - [Test] - public void CompareOAS_ShouldReturn_ConstraintIsWeakerDifferences() - { - var differences = CompareSpecifications("constraint_is_weaker"); - - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintIsWeaker, - Severity = Severity.Info, - OldJsonRef = "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum" - }, 7); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ConstraintIsWeaker, - Severity = Severity.Warning, - }, 1); - } - - [Test] - public void CompareOAS_ShouldReturn_DifferentAllOfDifferences() - { - var differences = CompareSpecifications("different_allOf"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.DifferentAllOf, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/parameters/0/schema/allOf" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_OneMessagePerRule_When_RecursiveModel() - { - var differences = CompareSpecifications("recursive_model"); - - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.RemovedProperty, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Operations/post/parameters/0/schema/properties/error/properties/target" - }, 2); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.ReadonlyPropertyChanged, - Severity = Severity.Warning, - }, 2); - } - - [Test] - public void CompareOAS_ShouldReturn_RequestBodyFormatNowSupportedDifferences() - { - var differences = CompareSpecifications("request_body_format_now_supported"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RequestBodyFormatNowSupported, - Severity = Severity.Info, - NewJsonRef = "#/paths/~1pets/post/requestBody/content/application~1xml" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ResponseBodyFormatNowSupportedDifferences() - { - var differences = CompareSpecifications("response_body_format_now_supported"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ResponseBodyFormatNowSupported, - Severity = Severity.Info, - NewJsonRef = "#/paths/~1pets/get/responses/200/content/application~1xml" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RequestBodyFormatNoLongerSupportedDifferences() - { - var differences = CompareSpecifications("request_body_format_no_longer_supported"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RequestBodyFormatNoLongerSupported, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/post/requestBody/content/text~1plain" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ServerNoLongerSupportedDifferences() - { - var differences = CompareSpecifications("server_no_longer_supported"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ServerNoLongerSupported, - Severity = Severity.Warning, - OldJsonRef = "#/servers/1" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_ParameterStyleChangedDifferences() - { - var differences = CompareSpecifications("parameter_style_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.ParameterStyleChanged, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/get/parameters/0/style" - }); - } - - /// - /// Comparator should return AddedOptionalProperty only if schema is referenced. - /// Schema is referenced if one of its allOf property has a discriminator. - /// - [Test] - public void CompareOAS_ShouldReturn_AddedOptionalPropertyDifferences_When_ValidPolymorphicSchema() - { - var differences = CompareSpecifications("polymorphic_schema"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedOptionalProperty, - Severity = Severity.Warning, - NewJsonRef = "#/schemas/Dog/properties/breed" - }); - } - - /// - /// ComparePaths method should also work for x-ms-paths extension - /// - [Test] - public void CompareOAS_ShouldReturn_Differences_When_XMsPathsExtension() - { - var differences = CompareSpecifications("x-ms-paths"); - - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.RemovedPath, - Severity = Severity.Warning, - OldJsonRef = "#/x-ms-paths/~1myPath~1query-drive?op=file" - }, 1); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.RequiredStatusChange, - Severity = Severity.Warning, - OldJsonRef = "#/x-ms-paths/~1myPath~1query-drive?op=folder/get/parameters/0/required" - }, 1); - differences.AssertContains(new ExpectedDifference - { - Rule = ComparisonRules.TypeChanged, - Severity = Severity.Warning, - OldJsonRef = "#/schemas/Cat/properties/sleepTime/type" - }, 1); - } - - [Test] - public void CompareOAS_ShouldReturn_AddedRequestBodyDifferences() - { - var differences = CompareSpecifications("added_request_body"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedRequestBody, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1pets/post/requestBody" - }); - } - - [Test] - public void CompareOAS_ShouldReturn_RemovedRequestBodyDifferences() - { - var differences = CompareSpecifications("removed_request_body"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedRequestBody, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1pets/post/requestBody" - }); - } - - [Test] - public void Compare_OAS_Should_Return_Removed_Schema_When_Schema_Is_Removed_In_Response() - { - var differences = CompareSpecifications("removed_schema_in_response"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.RemovedDefinition, - Severity = Severity.Warning, - OldJsonRef = "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema" - }); - } - - [Test] - public void Compare_OAS_Should_Return_Added_Schema_When_Schema_Is_Added_In_Response() - { - var differences = CompareSpecifications("added_schema_in_response"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.AddedSchema, - Severity = Severity.Error, - NewJsonRef = "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema" - }); - } - - [Test] - public void Compare_OAS_Should_Return_Nullable_Property_Changed_When_Nullable_Property_Is_Changed() - { - var differences = CompareSpecifications("nullable_property_changed"); - - differences.AssertContainsOnly(new ExpectedDifference - { - Rule = ComparisonRules.NullablePropertyChanged, - Severity = Severity.Warning, - NewJsonRef = "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/tag/nullable" - }); - } - - /// - /// Helper method -- load two Open Api Specification documents and invoke the comparison logic. - /// - /// The name of the OpenApi specification document file. - /// The file name must be the same in both the 'modified' and 'original' folder. - /// A list of messages from the comparison logic. - private static IList CompareSpecifications(string oasName) - { - var baseDirectory = Directory.GetParent(typeof(OpenApiSpecificationsCompareTests).GetTypeInfo().Assembly.Location) - .ToString(); - - var oldFileName = Path.Combine(baseDirectory, "Resource", "old", oasName + ".json"); - var newFileName = Path.Combine(baseDirectory, "Resource", "new", oasName + ".yaml"); - - var differences = OpenApiComparator.Compare( - File.ReadAllText(oldFileName), - File.ReadAllText(newFileName)) - .ToList(); - - ValidateDifferences(differences); - - return differences; - } + [TestCaseSource(nameof(TestCases))] + public void CompareOAS(string testcase) + { + var resourceDirectory = GetResourceDirectory(); + var oldFileName = Path.Combine(resourceDirectory, testcase, "old.yaml"); + var newFileName = Path.Combine(resourceDirectory, testcase, "new.yaml"); + var diffFileName = Path.Combine(resourceDirectory, testcase, "diff.json"); - private static void ValidateMessage(ComparisonMessage message) - { - var newLocation = message.NewLocation(); - var oldLocation = message.OldLocation(); - Assert.True(oldLocation != null || newLocation != null); + var differences = OpenApiComparator + .Compare(File.ReadAllText(oldFileName), File.ReadAllText(newFileName)); - switch (message.Mode) - { - case MessageType.Update: - Assert.NotNull(newLocation); - Assert.NotNull(oldLocation); - Assert.NotNull(message.OldJsonRef); - Assert.NotNull(message.NewJsonRef); - break; - case MessageType.Addition: - Assert.NotNull(newLocation); - Assert.NotNull(message.NewJsonRef); - break; - case MessageType.Removal: - Assert.NotNull(oldLocation); - Assert.NotNull(message.OldJsonRef); - break; - } - } + var expectedDifferences = JsonSerializer + .Deserialize(File.ReadAllText(diffFileName), serializerOptions); - internal static void ValidateDifferences(IEnumerable differences) - { - foreach (var message in differences) - { - ValidateMessage(message); - } - } + Assert.That(differences, + Is.EquivalentTo(expectedDifferences).Using(Comparer)); } - public static class DifferencesExtension + private static IEnumerable TestCases() { - public static void AssertContainsOnly(this IList differences, ExpectedDifference expectedDifference) - { - differences.AssertContains(expectedDifference, differences.Count); - } - - public static void AssertContains(this IList differences, ExpectedDifference expectedDifference, int expectedNumberOfDifferences) - { - Assert.AreEqual(expectedNumberOfDifferences, differences.Count(message => message.Id == expectedDifference.Rule.Id - && (expectedDifference.Severity == null || message.Severity == expectedDifference.Severity))); - - differences.AssertContainsJsonRef(expectedDifference); - } - - private static void AssertContainsJsonRef(this IList differences, ExpectedDifference expectedDifference) - { - if (expectedDifference.OldJsonRef != null) - { - Assert.IsTrue(differences.Any(difference => difference.Id == expectedDifference.Rule.Id - && difference.OldJsonRef == expectedDifference.OldJsonRef)); - } - - if (expectedDifference.NewJsonRef != null) - { - Assert.IsTrue(differences.Any(difference => difference.Id == expectedDifference.Rule.Id - && difference.NewJsonRef == expectedDifference.NewJsonRef)); - } - } + var resourceDirectory = GetResourceDirectory(); + return Directory + .GetDirectories(resourceDirectory) + .Where(directory => File.Exists(Path.Combine(directory, "diff.json"))) + .Select(Path.GetFileName); } - public class ExpectedDifference + private static string GetResourceDirectory() { - public ComparisonRule Rule; - - public Severity? Severity; - - public string OldJsonRef; + var assemblyLocation = typeof(OpenApiSpecificationsCompareTests).GetTypeInfo().Assembly.Location; + var baseDirectory = Directory.GetParent(assemblyLocation).ToString(); + return Path.Combine(baseDirectory, "Resource"); + } - public string NewJsonRef; + private static bool Comparer(ComparisonMessage message, ComparisonMessageModel model) + { + return message.Severity == model.Severity + && message.Message == model.Message + && message.OldJsonRef == model.OldJsonRef + && message.NewJsonRef == model.NewJsonRef + && message.Id == model.Id + && message.Code == model.Code + && message.Mode == model.Mode; } } + +internal class ComparisonMessageModel +{ + public Severity Severity { get; set; } + public string Message { get; set; } + public string OldJsonRef { get; set; } + public string NewJsonRef { get; set; } + public int Id { get; set; } + public string Code { get; set; } + public MessageType Mode { get; set; } +} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/diff.json new file mode 100644 index 0000000..a65476a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version adds an \u0027additionalProperties\u0027 element.", + "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/additionalProperties", + "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/additionalProperties", + "Id": 1021, + "Code": "AddedAdditionalProperties", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version adds an \u0027additionalProperties\u0027 element.", + "OldJsonRef": "#/schemas/Pet/additionalProperties", + "NewJsonRef": "#/schemas/Pet/additionalProperties", + "Id": 1021, + "Code": "AddedAdditionalProperties", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/old.yaml new file mode 100644 index 0000000..476007f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/old.yaml @@ -0,0 +1,33 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + - bird + required: + - name + - petType diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/diff.json new file mode 100644 index 0000000..f14c98f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/diff.json @@ -0,0 +1,56 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/accountType/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/accountType/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/schemas/Pet/properties/petType/enum", + "NewJsonRef": "#/schemas/Pet/properties/petType/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/schemas/Pet/properties/petType/enum", + "NewJsonRef": "#/schemas/Pet/properties/petType/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/schemas/Pet/properties/accountType/enum", + "NewJsonRef": "#/schemas/Pet/properties/accountType/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/old.yaml new file mode 100644 index 0000000..71672c1 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_enum_value/old.yaml @@ -0,0 +1,68 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + accountType: + type: string + enum: + - Standard_LRS + - Standard_ZRS + - Standard_GRS + - Standard_RAGRS + x-ms-enum: + name: AccountType + modelAsString: true + required: + - name + - petType + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: string + enum: + - clueless + - adventurous diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/diff.json new file mode 100644 index 0000000..c081b00 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Info", + "Message": "The new version adds a required header \u0027x-d\u0027.", + "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", + "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", + "Id": 1013, + "Code": "AddingHeader", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version adds a required header \u0027x-c\u0027.", + "OldJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", + "NewJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", + "Id": 1013, + "Code": "AddingHeader", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/old.yaml new file mode 100644 index 0000000..310789e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/old.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.1 +info: + title: operation_check_03 + version: "1.0" +paths: + /api/Parameters: + get: + operationId: Responses_Get + responses: + "200": + description: dummy response + content: + application/json: + schema: + type: integer + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + headers: + x-a: {} + x-b: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/diff.json new file mode 100644 index 0000000..410fbe0 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Info", + "Message": "The new version is adding an operation that was not found in the old version.", + "OldJsonRef": "#/paths/~1api~1Paths/post", + "NewJsonRef": "#/paths/~1api~1Paths/post", + "Id": 1039, + "Code": "AddedOperation", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version is adding an operation that was not found in the old version.", + "OldJsonRef": "#/paths/~1api~1Operations/head", + "NewJsonRef": "#/paths/~1api~1Operations/head", + "Id": 1039, + "Code": "AddedOperation", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/old.yaml new file mode 100644 index 0000000..1579b11 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/old.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.1 +info: + title: removed_path + version: "1.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} + /api/Parameters/{a}: + get: + operationId: Parameters_Get + responses: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/diff.json new file mode 100644 index 0000000..ffb8f20 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The optional parameter \u0027limitParam\u0027 was added in the new version.", + "OldJsonRef": null, + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1", + "Id": 1043, + "Code": "AddingOptionalParameter", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/old.yaml new file mode 100644 index 0000000..3737a3d --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/old.yaml @@ -0,0 +1,31 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/diff.json new file mode 100644 index 0000000..5f1f424 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a new optional property \u0027message\u0027 that was not found in the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/properties/message", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/properties/message", + "Id": 1045, + "Code": "AddedOptionalProperty", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version has a new optional property \u0027end\u0027 that was not found in the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/end", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/end", + "Id": 1045, + "Code": "AddedOptionalProperty", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/old.yaml new file mode 100644 index 0000000..e26304f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/old.yaml @@ -0,0 +1,38 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: object + properties: + error: + type: string + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: object + properties: + begin: + type: integer diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/diff.json new file mode 100644 index 0000000..267a9b3 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Info", + "Message": "The new version is adding a path that was not found in the old version.", + "OldJsonRef": null, + "NewJsonRef": "#/paths/~1api~1Paths", + "Id": 1038, + "Code": "AddedPath", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/old.yaml new file mode 100644 index 0000000..3357083 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/old.yaml @@ -0,0 +1,9 @@ +openapi: 3.0.1 +info: + title: added_path + version: "1.0" +paths: + /api/Operations: + get: + operationId: Operations_Get + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/diff.json new file mode 100644 index 0000000..6a8046e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a new property \u0027petType\u0027 in response that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType", + "Id": 1041, + "Code": "AddedPropertyInResponse", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version has a new property \u0027petAge\u0027 in response that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petAge", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petAge", + "Id": 1041, + "Code": "AddedPropertyInResponse", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version has a new property \u0027message\u0027 in response that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/properties/message", + "NewJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/properties/message", + "Id": 1041, + "Code": "AddedPropertyInResponse", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version has a new property \u0027message\u0027 in response that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/500/content/application~1json/schema/properties/message", + "NewJsonRef": "#/paths/~1pets/get/responses/500/content/application~1json/schema/properties/message", + "Id": 1041, + "Code": "AddedPropertyInResponse", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/old.yaml new file mode 100644 index 0000000..4d67371 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_property_in_response/old.yaml @@ -0,0 +1,53 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string + "500": + $ref: '#/components/responses/InternalErrorResponse' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + responses: + InternalErrorResponse: + description: internal error + content: + application/json: + schema: + type: object + properties: + error: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/diff.json new file mode 100644 index 0000000..d614d93 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Info", + "Message": "The new version has a new read-only property \u0027petType\u0027 in response that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType", + "Id": 1040, + "Code": "AddedReadOnlyPropertyInResponse", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a new read-only property \u0027message\u0027 in response that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/properties/message", + "NewJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/properties/message", + "Id": 1040, + "Code": "AddedReadOnlyPropertyInResponse", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a new read-only property \u0027message\u0027 in response that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/500/content/application~1json/schema/properties/message", + "NewJsonRef": "#/paths/~1pets/get/responses/500/content/application~1json/schema/properties/message", + "Id": 1040, + "Code": "AddedReadOnlyPropertyInResponse", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/old.yaml new file mode 100644 index 0000000..4d67371 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_readOnly_property_in_response/old.yaml @@ -0,0 +1,53 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string + "500": + $ref: '#/components/responses/InternalErrorResponse' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + responses: + InternalErrorResponse: + description: internal error + content: + application/json: + schema: + type: object + properties: + error: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/diff.json new file mode 100644 index 0000000..c3a8864 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding a requestBody that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/post/requestBody", + "NewJsonRef": "#/paths/~1pets/post/requestBody", + "Id": 1046, + "Code": "AddedRequestBody", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/old.yaml new file mode 100644 index 0000000..e63f058 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/old.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.0" +paths: + /pets: + post: + description: Post multiple pets + responses: + "200": + content: + text/plain: + schema: + type: integer + /pets/{id}: + post: + description: Post one pet according to its id + requestBody: + $ref: '#/components/requestBodies/PetBody' + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + requestBodies: + PetBody: + content: + application/json: + schema: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/diff.json new file mode 100644 index 0000000..9a17947 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The required parameter \u0027limitParam\u0027 was added in the new version.", + "OldJsonRef": null, + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1", + "Id": 1010, + "Code": "AddingRequiredParameter", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/old.yaml new file mode 100644 index 0000000..47bd12d --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/old.yaml @@ -0,0 +1,33 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/diff.json new file mode 100644 index 0000000..749dd1d --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has new required property \u0027petType\u0027 that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items", + "Id": 1034, + "Code": "AddedRequiredProperty", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version has new required property \u0027message\u0027 that was not found in the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema", + "NewJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema", + "Id": 1034, + "Code": "AddedRequiredProperty", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version has new required property \u0027petType\u0027 that was not found in the old version.", + "OldJsonRef": "#/schemas/Pet", + "NewJsonRef": "#/schemas/Pet", + "Id": 1034, + "Code": "AddedRequiredProperty", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/old.yaml new file mode 100644 index 0000000..9e5c8e7 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/diff.json new file mode 100644 index 0000000..f9ec7ab --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version adds a response code \u0027200\u0027.", + "OldJsonRef": "#/paths/~1api~1Operations/post/responses/200", + "NewJsonRef": "#/paths/~1api~1Operations/post/responses/200", + "Id": 1011, + "Code": "AddingResponseCode", + "Mode": "Addition" + }, + { + "Severity": "Warning", + "Message": "The new version adds a response code \u0027202\u0027.", + "OldJsonRef": "#/paths/~1api~1Responses/get/responses/202", + "NewJsonRef": "#/paths/~1api~1Responses/get/responses/202", + "Id": 1011, + "Code": "AddingResponseCode", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/old.yaml new file mode 100644 index 0000000..9d30e8e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/old.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.1 +info: + title: operation_check_01 + version: "1.0" +paths: + /api/Path: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} + /api/Parameters/{a}: + get: + operationId: Parameters_Get + responses: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + "400": + description: null diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/diff.json new file mode 100644 index 0000000..aa4213b --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Error", + "Message": "The new version is adding a new schema that was not found in the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", + "Id": 1048, + "Code": "AddedSchema", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/old.yaml new file mode 100644 index 0000000..5af1729 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/old.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: Added Schema in response + version: "1.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: [] + responses: + "200": + content: + application/json: {} +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + required: + - name + - petType diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/diff.json new file mode 100644 index 0000000..62fd119 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The order of parameter \u0027skipParam\u0027 was changed. ", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters", + "Id": 1042, + "Code": "ChangedParameterOrder", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The order of parameter \u0027limitParam\u0027 was changed. ", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters", + "Id": 1042, + "Code": "ChangedParameterOrder", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/old.yaml new file mode 100644 index 0000000..38f9cd0 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/old.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/limitParam' + - $ref: '#/components/parameters/skipParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/diff.json new file mode 100644 index 0000000..a7c35f2 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The \u0027constant\u0027 status changed from the old version to the new.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/enum", + "Id": 1016, + "Code": "ConstantStatusHasChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString, Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/old.yaml new file mode 100644 index 0000000..7034276 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/old.yaml @@ -0,0 +1,35 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: string + enum: + - clueless diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/diff.json new file mode 100644 index 0000000..0d1cdd2 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/diff.json @@ -0,0 +1,56 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a different \u0027pattern\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/accessKey/pattern", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/accessKey/pattern", + "Id": 1036, + "Code": "ConstraintChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different \u0027uniqueItems\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/uniqueItems", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/uniqueItems", + "Id": 1036, + "Code": "ConstraintChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a different \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "Id": 1036, + "Code": "ConstraintChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different \u0027multipleOf\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/maxRequest/multipleOf", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/maxRequest/multipleOf", + "Id": 1036, + "Code": "ConstraintChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/old.yaml new file mode 100644 index 0000000..3b0b121 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/old.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + type: object + properties: + maxRequest: + type: integer + multipleOf: 100 +components: + schemas: + limitParam: + type: object + properties: + accessKey: + type: string + redirectUrl: + type: array + uniqueItems: true + items: + type: string + constrainsItems: + type: string + enum: + - item1 + - item2 + - item3 + parameters: + limitParam: + name: limit + in: query + required: true + schema: + $ref: '#/components/schemas/limitParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/diff.json new file mode 100644 index 0000000..b022da0 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/diff.json @@ -0,0 +1,83 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a more constraining \u0027maximum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minLimit/maximum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minLimit/maximum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a more constraining \u0027minimum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/exclusiveMin/minimum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/exclusiveMin/minimum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a more constraining \u0027maxLength\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/maxTextSize/maxLength", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/maxTextSize/maxLength", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a more constraining \u0027minLength\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minTextSize/minLength", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minTextSize/minLength", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a more constraining \u0027maxItems\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/maxItems", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/maxItems", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a more constraining \u0027minItems\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/minItems", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/minItems", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027maximum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/code/maximum", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/code/maximum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/constrainsItems/enum", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/constrainsItems/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/constrainsItems/enum", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/constrainsItems/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/old.yaml new file mode 100644 index 0000000..dd89175 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_stronger/old.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + type: object + properties: + code: + type: integer + maximum: 500 + constrainsItems: + type: string + enum: + - item1 + - item2 + - item3 +components: + schemas: + limitParam: + type: object + properties: + minLimit: + type: integer + maxLimit: + type: integer + exclusiveMin: + type: integer + minimum: 400 + maxTextSize: + type: string + maxLength: 200 + minTextSize: + type: string + minLength: 100 + accessKey: + type: string + redirectUrl: + type: array + minItems: 100 + maxItems: 500 + items: + type: string + parameters: + limitParam: + name: limit + in: query + required: true + schema: + $ref: '#/components/schemas/limitParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/diff.json new file mode 100644 index 0000000..a329eed --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/diff.json @@ -0,0 +1,83 @@ +[ + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027maximum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minLimit/maximum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minLimit/maximum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027minimum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/exclusiveMin/minimum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/exclusiveMin/minimum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027maxLength\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/maxTextSize/maxLength", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/maxTextSize/maxLength", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027minLength\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minTextSize/minLength", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/minTextSize/minLength", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027maxItems\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/maxItems", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/maxItems", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027minItems\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/minItems", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/redirectUrl/minItems", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/properties/constrainsItems/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a less constraining \u0027maximum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/code/maximum", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/code/maximum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/old.yaml new file mode 100644 index 0000000..cb72f5a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_is_weaker/old.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + type: object + properties: + code: + type: integer + maximum: 400 +components: + schemas: + limitParam: + type: object + properties: + minLimit: + type: integer + maximum: 400 + exclusiveMin: + type: integer + minimum: 500 + maxTextSize: + type: string + maxLength: 150 + minTextSize: + type: string + minLength: 200 + redirectUrl: + type: array + minItems: 200 + maxItems: 400 + items: + type: string + constrainsItems: + type: string + enum: + - item1 + - item3 + parameters: + limitParam: + name: limit + in: query + required: true + schema: + $ref: '#/components/schemas/limitParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/diff.json new file mode 100644 index 0000000..a2a85b6 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a different default value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/default", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/default", + "Id": 1027, + "Code": "DefaultValueChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different default value than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/default", + "NewJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/default", + "Id": 1027, + "Code": "DefaultValueChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different default value than the previous one.", + "OldJsonRef": "#/schemas/Pet/properties/name/default", + "NewJsonRef": "#/schemas/Pet/properties/name/default", + "Id": 1027, + "Code": "DefaultValueChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/old.yaml new file mode 100644 index 0000000..816d9d9 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/old.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: default response + content: + application/json: + schema: + description: Error schema + type: string + default: OldDefaultError +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + default: oldDefaultPetName + tag: + type: string + default: DefaultTag diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/diff.json new file mode 100644 index 0000000..c165221 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a different \u0027allOf\u0027 property than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/schema/allOf", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/schema/allOf", + "Id": 1032, + "Code": "DifferentAllOf", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different \u0027allOf\u0027 property than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/allOf", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/allOf", + "Id": 1032, + "Code": "DifferentAllOf", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different \u0027allOf\u0027 property than the previous one.", + "OldJsonRef": "#/schemas/Cat/allOf", + "NewJsonRef": "#/schemas/Cat/allOf", + "Id": 1032, + "Code": "DifferentAllOf", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/old.yaml new file mode 100644 index 0000000..5d9b459 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_allOf/old.yaml @@ -0,0 +1,75 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/petParam' + responses: + "200": + content: + application/json: + schema: + type: object + required: + - message + - code + allOf: + - $ref: '#/components/schemas/Pet' + - $ref: '#/components/schemas/Cat' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Cat: + description: A representation of a cat. Note that `Cat` will be used as the discriminator value. + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: + description: A representation of a dog. Note that `Dog` will be used as the discriminator value. + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize + parameters: + petParam: + name: pet + in: query + required: true + schema: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/diff.json new file mode 100644 index 0000000..820eef3 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a different discriminator than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/discriminator", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/discriminator", + "Id": 1030, + "Code": "DifferentDiscriminator", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different discriminator than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/201/content/application~1json/schema/discriminator", + "NewJsonRef": "#/paths/~1pets/get/responses/201/content/application~1json/schema/discriminator", + "Id": 1030, + "Code": "DifferentDiscriminator", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different discriminator than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/discriminator", + "NewJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/discriminator", + "Id": 1030, + "Code": "DifferentDiscriminator", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different discriminator than the previous one.", + "OldJsonRef": "#/schemas/Pet/discriminator", + "NewJsonRef": "#/schemas/Pet/discriminator", + "Id": 1030, + "Code": "DifferentDiscriminator", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/old.yaml new file mode 100644 index 0000000..22eb54e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/different_discriminator/old.yaml @@ -0,0 +1,58 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "201": + description: Created + content: + application/json: + schema: + type: object + discriminator: + propertyName: oldDiscriminator + properties: + error: + type: string + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string +components: + schemas: + Pet: + type: object + required: + - name + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/diff.json new file mode 100644 index 0000000..038c502 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/new.yaml new file mode 100644 index 0000000..9eeab82 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/new.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - zzzzzz + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/diff.json new file mode 100644 index 0000000..086f42f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/new.yaml new file mode 100644 index 0000000..2105211 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/new.yaml @@ -0,0 +1,44 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/diff.json new file mode 100644 index 0000000..34d3641 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/new.yaml new file mode 100644 index 0000000..5ba88d8 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/new.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: "#/components/schemas/RequestOnlyEnum" + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + bar: + $ref: "#/components/schemas/ResponseOnlyEnum" +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - zzzzzz + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/old.yaml new file mode 100644 index 0000000..06d6453 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/old.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: '#/components/schemas/RequestOnlyEnum' + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + bar: + $ref: '#/components/schemas/ResponseOnlyEnum' +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/diff.json new file mode 100644 index 0000000..252c4c4 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/foo/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/requestBody/content/application~1json/schema/properties/foo/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/new.yaml new file mode 100644 index 0000000..ccd6408 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/new.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: "#/components/schemas/RequestOnlyEnum" + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + bar: + $ref: "#/components/schemas/ResponseOnlyEnum" +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/old.yaml new file mode 100644 index 0000000..06d6453 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/old.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: '#/components/schemas/RequestOnlyEnum' + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + bar: + $ref: '#/components/schemas/ResponseOnlyEnum' +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/diff.json new file mode 100644 index 0000000..1e5887e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/new.yaml new file mode 100644 index 0000000..f79d219 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/new.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - zzzzzz + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/diff.json new file mode 100644 index 0000000..039a82f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The \u0027constant\u0027 status changed from the old version to the new.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/enum", + "Id": 1016, + "Code": "ConstantStatusHasChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/new.yaml new file mode 100644 index 0000000..f2d60eb --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/new.yaml @@ -0,0 +1,44 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/diff.json new file mode 100644 index 0000000..5fdb013 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/new.yaml new file mode 100644 index 0000000..35cc27e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/new.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + - zzzzzz + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/diff.json new file mode 100644 index 0000000..b9f5350 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/new.yaml new file mode 100644 index 0000000..0e00cc7 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/new.yaml @@ -0,0 +1,44 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/diff.json new file mode 100644 index 0000000..1e5887e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/new.yaml new file mode 100644 index 0000000..95d768b --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/new.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: "#/components/schemas/RequestOnlyEnum" + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + bar: + $ref: "#/components/schemas/ResponseOnlyEnum" +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - zzzzzz + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/old.yaml new file mode 100644 index 0000000..06d6453 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/old.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: '#/components/schemas/RequestOnlyEnum' + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + bar: + $ref: '#/components/schemas/ResponseOnlyEnum' +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/diff.json new file mode 100644 index 0000000..f1939bd --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/new.yaml new file mode 100644 index 0000000..27e7b6c --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/new.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: "#/components/schemas/RequestOnlyEnum" + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + bar: + $ref: "#/components/schemas/ResponseOnlyEnum" +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/old.yaml new file mode 100644 index 0000000..06d6453 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/old.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: '#/components/schemas/RequestOnlyEnum' + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + bar: + $ref: '#/components/schemas/ResponseOnlyEnum' +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/diff.json new file mode 100644 index 0000000..5a84756 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/new.yaml new file mode 100644 index 0000000..507e865 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/new.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - zzzzzz + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/diff.json new file mode 100644 index 0000000..5a84756 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is adding enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1020, + "Code": "AddedEnumValue", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1037, + "Code": "ConstraintIsWeaker", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/new.yaml new file mode 100644 index 0000000..bb90040 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/new.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: "#/components/schemas/RequestOnlyEnum" + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + bar: + $ref: "#/components/schemas/ResponseOnlyEnum" +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + - zzzzzz + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/old.yaml new file mode 100644 index 0000000..06d6453 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/old.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: '#/components/schemas/RequestOnlyEnum' + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + bar: + $ref: '#/components/schemas/ResponseOnlyEnum' +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/diff.json new file mode 100644 index 0000000..bedb604 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/new.yaml new file mode 100644 index 0000000..0fdd3d4 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/new.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: "#/components/schemas/RequestOnlyEnum" + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: "#/components/schemas/RequestResponseEnum" + bar: + $ref: "#/components/schemas/ResponseOnlyEnum" +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/old.yaml new file mode 100644 index 0000000..06d6453 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/old.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + $ref: '#/components/schemas/RequestOnlyEnum' + requestBody: + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + foo: + $ref: '#/components/schemas/RequestResponseEnum' + bar: + $ref: '#/components/schemas/ResponseOnlyEnum' +components: + schemas: + RequestOnlyEnum: + type: string + enum: + - abc + - def + ResponseOnlyEnum: + type: string + enum: + - ghi + - jkl + RequestResponseEnum: + type: string + enum: + - mno + - pqr diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/diff.json new file mode 100644 index 0000000..bedb604 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/new.yaml new file mode 100644 index 0000000..5136c29 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/new.yaml @@ -0,0 +1,44 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.2.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/old.yaml new file mode 100644 index 0000000..e8c48f5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: My API + version: 0.1.0 +paths: + /order/{path}: + post: + parameters: + - name: path + in: path + required: true + schema: + type: string + enum: + - abc + - def + - name: query + in: query + schema: + type: string + enum: + - ghi + - jkl + requestBody: + content: + application/json: + schema: + properties: + foo: + type: string + enum: + - mno + - pqr + responses: + "200": + description: Successful Response + content: + application/json: + schema: + properties: + bar: + type: string + enum: + - stu + - vwx diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/diff.json new file mode 100644 index 0000000..b5a2b2f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a different \u0027x-ms-long-running-operation\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/get/x-ms-long-running-operation", + "NewJsonRef": "#/paths/~1api~1Parameters/get/x-ms-long-running-operation", + "Id": 1044, + "Code": "LongRunningOperationExtensionChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different \u0027x-ms-long-running-operation\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/x-ms-long-running-operation", + "NewJsonRef": "#/paths/~1api~1Parameters/put/x-ms-long-running-operation", + "Id": 1044, + "Code": "LongRunningOperationExtensionChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/old.yaml new file mode 100644 index 0000000..fdfcfa7 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/old.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.1 +info: + title: type_changed + version: "1.0" +paths: + /api/Parameters: + get: + operationId: Parameters_Get + responses: {} + x-ms-long-running-operation: true + put: + operationId: Parameters_Put + parameters: + - name: database + required: true + responses: {} + x-ms-long-running-operation: false diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/diff.json new file mode 100644 index 0000000..6404cae --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The operation id has been changed from \u0027Paths_Get\u0027 to \u0027Paths_List\u0027. This will impact generated code.", + "OldJsonRef": "#/paths/~1api~1Paths/get/operationId", + "NewJsonRef": "#/paths/~1api~1Paths/get/operationId", + "Id": 1008, + "Code": "ModifiedOperationId", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The operation id has been changed from \u0027\u0027 to \u0027Operations_Get\u0027. This will impact generated code.", + "OldJsonRef": "#/paths/~1api~1Operations/get/operationId", + "NewJsonRef": "#/paths/~1api~1Operations/get/operationId", + "Id": 1008, + "Code": "ModifiedOperationId", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The operation id has been changed from \u0027Operations_Post\u0027 to \u0027\u0027. This will impact generated code.", + "OldJsonRef": "#/paths/~1api~1Operations/post/operationId", + "NewJsonRef": "#/paths/~1api~1Operations/post/operationId", + "Id": 1008, + "Code": "ModifiedOperationId", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/old.yaml new file mode 100644 index 0000000..393dbde --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/old.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: changed_operation_id + version: "1.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + responses: {} + post: + operationId: Operations_Post + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/diff.json new file mode 100644 index 0000000..61ccbd1 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Info", + "Message": "The versions have not changed.", + "OldJsonRef": "#/info/version", + "NewJsonRef": "#/info/version", + "Id": 1001, + "Code": "NoVersionChange", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/old.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/old.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/diff.json new file mode 100644 index 0000000..c13b3de --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The nullable property has changed from \u0027true\u0027 to \u0027false\u0027.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/tag/nullable", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/tag/nullable", + "Id": 2000, + "Code": "NullablePropertyChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The nullable property has changed from \u0027true\u0027 to \u0027false\u0027.", + "OldJsonRef": "#/schemas/Pet/properties/tag/nullable", + "NewJsonRef": "#/schemas/Pet/properties/tag/nullable", + "Id": 2000, + "Code": "NullablePropertyChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/old.yaml new file mode 100644 index 0000000..d43f287 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/old.yaml @@ -0,0 +1,35 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + tag: + type: string + nullable: true diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_additional_properties.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_additional_properties.json deleted file mode 100644 index 18300fe..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_additional_properties.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot", - "bird" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_enum_value.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_enum_value.json deleted file mode 100644 index d8e9384..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_enum_value.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot" - ] - }, - "accountType": { - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_ZRS", - "Standard_GRS", - "Standard_RAGRS" - ], - "x-ms-enum": { - "name": "AccountType", - "modelAsString": true - } - } - }, - "required": [ - "name", - "petType" - ] - } - }, - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "string", - "enum": [ - "clueless", - "adventurous" - ] - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_header.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_header.json deleted file mode 100644 index 3e30356..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_header.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_03", - "version": "1.0" - }, - "paths": { - "/api/Parameters": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": "dummy response", - "content": { - "application/json":{ - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null, - "headers": { - "x-a": { }, - "x-b": { } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_operation.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_operation.json deleted file mode 100644 index c153926..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_operation.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "removed_path", - "version": "1.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - }, - "/api/Parameters/{a}": { - "get": { - "operationId": "Parameters_Get", - "responses": { } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_parameter.json deleted file mode 100644 index b023aa8..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_parameter.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_property.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_property.json deleted file mode 100644 index 515ff51..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_optional_property.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "object", - "properties": { - "begin": { - "type": "integer" - } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_path.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_path.json deleted file mode 100644 index 140eb28..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_path.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "added_path", - "version": "1.0" - }, - "paths": { - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_property_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_property_in_response.json deleted file mode 100644 index d857721..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_property_in_response.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - }, - "500": { - "$ref": "#/components/responses/InternalErrorResponse" - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - } - } - } - }, - "responses": { - "InternalErrorResponse": { - "description": "internal error", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_readOnly_property_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_readOnly_property_in_response.json deleted file mode 100644 index d857721..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_readOnly_property_in_response.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - }, - "500": { - "$ref": "#/components/responses/InternalErrorResponse" - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - } - } - } - }, - "responses": { - "InternalErrorResponse": { - "description": "internal error", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_request_body.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_request_body.json deleted file mode 100644 index 4c8a7d7..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_request_body.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.0" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/pets/{id}": { - "post": { - "description": "Post one pet according to its id", - "requestBody": { - "$ref": "#/components/requestBodies/PetBody" - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_parameter.json deleted file mode 100644 index c8097a1..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_parameter.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_property.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_property.json deleted file mode 100644 index e9d14c9..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_required_property.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_response_code.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_response_code.json deleted file mode 100644 index 1279c9a..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_response_code.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_01", - "version": "1.0" - }, - "paths": { - "/api/Path": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - }, - "/api/Parameters/{a}": { - "get": { - "operationId": "Parameters_Get", - "responses": { } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null - }, - "400": { - "description": null - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_schema_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_schema_in_response.json deleted file mode 100644 index 5b73fb5..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/added_schema_in_response.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "Added Schema in response", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/changed_parameter_order.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/changed_parameter_order.json deleted file mode 100644 index 0cf8715..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/changed_parameter_order.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/limitParam" - }, - { - "$ref": "#/components/parameters/skipParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constant_status_has_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constant_status_has_changed.json deleted file mode 100644 index fc7dad8..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constant_status_has_changed.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "string", - "enum": [ - "clueless" - ] - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_changed.json deleted file mode 100644 index 3ef8dc8..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_changed.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/limitParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "maxRequest": { - "type": "integer", - "multipleOf": 100 - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "limitParam": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "redirectUrl": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "string" - } - }, - "constrainsItems": { - "type": "string", - "enum": [ - "item1", - "item2", - "item3" - ] - } - } - } - }, - "parameters": { - "limitParam": { - "name": "limit", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/limitParam" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_stronger.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_stronger.json deleted file mode 100644 index 996dc18..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_stronger.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/limitParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "maximum": 500 - }, - "constrainsItems": { - "type": "string", - "enum": [ - "item1", - "item2", - "item3" - ] - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "limitParam": { - "type": "object", - "properties": { - "minLimit": { - "type": "integer" - }, - "maxLimit": { - "type": "integer" - }, - "exclusiveMin": { - "type": "integer", - "minimum": 400 - }, - "maxTextSize": { - "type": "string", - "maxLength": 200 - }, - "minTextSize": { - "type": "string", - "minLength": 100 - }, - "accessKey": { - "type": "string" - }, - "redirectUrl": { - "type": "array", - "minItems": 100, - "maxItems": 500, - "items": { - "type": "string" - } - } - } - } - }, - "parameters": { - "limitParam": { - "name": "limit", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/limitParam" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_weaker.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_weaker.json deleted file mode 100644 index 070ed36..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/constraint_is_weaker.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/limitParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "maximum": 400 - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "limitParam": { - "type": "object", - "properties": { - "minLimit": { - "type": "integer", - "maximum": 400 - }, - "exclusiveMin": { - "type": "integer", - "minimum": 500 - }, - "maxTextSize": { - "type": "string", - "maxLength": 150 - }, - "minTextSize": { - "type": "string", - "minLength": 200 - }, - "redirectUrl": { - "type": "array", - "minItems": 200, - "maxItems": 400, - "items": { - "type": "string" - } - }, - "constrainsItems": { - "type": "string", - "enum": [ - "item1", - "item3" - ] - } - } - } - }, - "parameters": { - "limitParam": { - "name": "limit", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/limitParam" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/default_value_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/default_value_changed.json deleted file mode 100644 index 0851509..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/default_value_changed.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "description": "Error schema", - "type": "string", - "default": "OldDefaultError" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "default": "oldDefaultPetName" - }, - "tag": { - "type": "string", - "default": "DefaultTag" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_allOf.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_allOf.json deleted file mode 100644 index 4c28b58..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_allOf.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/petParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "code" - ], - "allOf": [ - { "$ref": "#/components/schemas/Pet" }, - { "$ref": "#/components/schemas/Cat" } - ] - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - }, - "required": [ - "name", - "petType" - ] - }, - "Cat": { - "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "type": "object", - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - } - ] - }, - "Dog": { - "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "type": "object", - "properties": { - "packSize": { - "type": "integer", - "format": "int32", - "description": "the size of the pack the dog is from", - "default": 0, - "minimum": 0 - } - }, - "required": [ - "packSize" - ] - } - ] - } - }, - "parameters": { - "petParam": { - "name": "pet", - "in": "query", - "required": true, - "schema": { - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_discriminator.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_discriminator.json deleted file mode 100644 index 943a522..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/different_discriminator.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": { - "type": "object", - "discriminator": { - "propertyName": "oldDiscriminator" - }, - "properties": { - "error": { - "type": "string" - } - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/long_running_operation.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/long_running_operation.json deleted file mode 100644 index 13c37a6..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/long_running_operation.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "type_changed", - "version": "1.0" - }, - "paths": { - "/api/Parameters": { - "get": { - "operationId": "Parameters_Get", - "responses": { }, - "x-ms-long-running-operation": true - }, - "put": { - "operationId": "Parameters_Put", - "parameters": [ - { - "name": "database", - "required": true - } - ], - "responses": { }, - "x-ms-long-running-operation": false - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/modified_operation_id.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/modified_operation_id.json deleted file mode 100644 index 7052ead..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/modified_operation_id.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "changed_operation_id", - "version": "1.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/no_version_change.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/no_version_change.json deleted file mode 100644 index 1f7a8f3..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/no_version_change.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "version_check_02", - "version": "1.0" - }, - "paths": { } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/nullable_property_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/nullable_property_changed.json deleted file mode 100644 index 3e58c26..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/nullable_property_changed.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string", - "nullable": true - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_in_has_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_in_has_changed.json deleted file mode 100644 index 469229a..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_in_has_changed.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_style_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_style_changed.json deleted file mode 100644 index 5de043a..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/parameter_style_changed.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "1.0" - }, - "paths": { - "/pets": { - "get": { - "description": "Get all pets from Petstore", - "parameters": [ - { - "name": "pageParam", - "in": "query", - "style": "spaceDelimited" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - }, - "/pets/{id}": { - "parameters": [ - { - "name": "PetId", - "in": "path", - "required": true, - "style": "label" - } - ], - "post": { - "description": "Register a new pet", - "parameters": [ - { - "$ref": "#/components/parameters/PetParameter" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - }, - "parameters": { - "PetParameter": { - "name": "PetParameter", - "in": "query", - "style": "form", - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/polymorphic_schema.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/polymorphic_schema.json deleted file mode 100644 index 4274e36..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/polymorphic_schema.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0", - "title": "OpenApi Petstore" - }, - "servers": [ - { - "url": "https://petstore.openapi.io/v1" - } - ], - "paths": { - "/pets": { - "put": { - "summary": "Add a pet", - "operationId": "addPet", - "tags": [ - "pets" - ], - "parameters": [ - { - "name": "Pet parameter", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "PetWithoutDiscriminator": { - "properties": { - "petKind": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "name", - "petKind" - ] - }, - "Pet": { - "discriminator": { - "propertyName": "petKind" - }, - "properties": { - "petKind": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "name", - "petKind" - ] - }, - "Cat": { - "description": "A representation of a cat", - "allOf": [ - { - "$ref": "#/components/schemas/PetWithoutDiscriminator" - }, - { - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - } - ] - }, - "Dog": { - "description": "A representation of a dog", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "properties": { - "packSize": { - "type": "integer", - "format": "int32", - "description": "the size of the pack the dog is from", - "default": 0, - "minimum": 0 - } - }, - "required": [ - "packSize" - ] - } - ] - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/readonly_property_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/readonly_property_changed.json deleted file mode 100644 index 22413ff..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/readonly_property_changed.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "description": "Error schema", - "type": "string", - "readOnly": true - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string", - "readOnly": true - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/recursive_model.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/recursive_model.json deleted file mode 100644 index c8c01fc..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/recursive_model.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "recursive_model", - "version": "1.0" - }, - "servers": [{ - "url": "http:localhost:8000" - }], - "paths": { - "/api/Operations": { - "post": { - "tag": [ "Operations" ], - "operationId": "Operations_Post", - "parameters": [ - { - "name": "accountName", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/CreateParam" - }, - "description": "Create Param." - } - ], - "responses": { - "200": { - "description": "OK" - }, - "default": { - "description": "BadRequest", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/CloudError" } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "CloudError": { - "description": "Error from a REST request.", - "type": "object", - "properties": { "error": { "$ref": "#/components/schemas/CloudErrorBody" } }, - "x-ms-external": true - }, - "CloudErrorBody": { - "description": "Body of an error from a REST request.", - "type": "object", - "properties": { - "code": { "type": "string" }, - "message": { "type": "string" }, - "target": { "type": "string" }, - "details": { - "description": "Inner errors.", - "type": "array", - "items": { "$ref": "#/components/schemas/CloudErrorBody" } - } - } - }, - "CreateParam": { - "description": "Create Param a REST request.", - "type": "object", - "properties": { "error": { "$ref": "#/components/schemas/CreateParamBody" } }, - "x-ms-external": true - }, - "CreateParamBody": { - "description": "Create Param Body a REST request.", - "type": "object", - "properties": { - "code": { "type": "string" }, - "message": { "type": "string" }, - "target": { "type": "string" }, - "details": { - "description": "Inner errors.", - "type": "array", - "items": { "$ref": "#/components/schemas/CreateParam" } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/reference_redirection.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/reference_redirection.json deleted file mode 100644 index ed38392..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/reference_redirection.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { "url": "http://localhost:8000" } - ], - "paths": { - "/api/Parameters": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "400": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Dog" - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - }, - "required": [ - "name", - "petType" - ] - }, - "Dog": { - "type": "object", - "properties": { - "breed": { - "type": "string" - } - }, - "required": [ - "name", - "petType" - ] - }, - "Cat": { - "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "type": "object", - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - } - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_additional_properties.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_additional_properties.json deleted file mode 100644 index d947407..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_additional_properties.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot", - "bird" - ] - } - }, - "additionalProperties": { - "type": "string" - }, - "required": [ - "name", - "petType" - ] - } - }, - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_client_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_client_parameter.json deleted file mode 100644 index de9bc36..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_client_parameter.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { "url": "http://localhost:8000" } - ], - "paths": { - "/api/Parameters": { - "put": { - "parameters": [ - { "$ref": "#/components/parameters/skipParam" }, - { "$ref": "#/components/parameters/skipParam" }, - { "$ref": "#/components/parameters/limitParam" } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skip", - "in": "query", - "description": "number of items to skip", - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} - diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_enum_value.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_enum_value.json deleted file mode 100644 index edc8969..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_enum_value.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { "url": "http://localhost:8000" } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/limitParam" - }, - { - "name": "skipParam", - "in": "query", - "description": "max records to skip", - "required": true, - "schema" : { - "$ref": "#/components/schemas/Pet" - } - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot", - "bird" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - }, - "parameters": { - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "string", - "enum": [ - "clueless", - "lazy", - "adventurous" - ] - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_header.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_header.json deleted file mode 100644 index b998de5..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_header.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_03", - "version": "1.0" - }, - "paths": { - "/api/Parameters": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null, - "headers": { - "x-b": { - "schema": { - "type": "integer" - } - }, - "x-d": { } - } - } - } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null, - "headers": { - "x-a": { - "schema": { - "type": "integer" - } - }, - "x-c": { } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_operation.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_operation.json deleted file mode 100644 index c395ba4..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_operation.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "removed_operation", - "version": "1.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_path.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_path.json deleted file mode 100644 index 07be5ef..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_path.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "removed_path", - "version": "1.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - }, - "/api/Parameters/{a}": { - "get": { - "operationId": "Parameters_Get", - "responses": {} - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": {} - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_property.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_property.json deleted file mode 100644 index 16bed25..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_property.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "description": "Updated name of the pet", - "type": "string" - }, - "status": { - "description": "Updated status of the pet", - "type": "string" - } - }, - "required": [ - "status" - ] - } - } - } - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_request_body.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_request_body.json deleted file mode 100644 index a940a15..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_request_body.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.0" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schema/Pet" - } - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/pets/{id}": { - "post": { - "description": "Post one pet according to its id", - "requestBody": { - "$ref": "#/components/requestBodies/PetBody" - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_required_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_required_parameter.json deleted file mode 100644 index 469229a..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_required_parameter.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_response_code.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_response_code.json deleted file mode 100644 index a5de198..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_response_code.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_01", - "version": "1.0" - }, - "paths": { - "/api/Path": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { - "200": { - "description": null - } - } - } - }, - "/api/Parameters/{a}": { - "get": { - "operationId": "Parameters_Get", - "responses": { } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null - }, - "202": { - "description": null - }, - "400": { - "description": null - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema.json deleted file mode 100644 index 4700328..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Database" - } - } - } - } - }, - "get": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Get", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Database" - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Database": { - "description": "Database schema", - "properties": { - "a": { - "type": "string", - "readOnly": true, - "description": "This is a system generated property.\nThe _rid value is empty for this operation." - }, - "b": { - "type": "integer", - "readOnly": true, - "default": 0, - "description": "This property shows the number of databases returned." - } - } - }, - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - }, - "required": [ - "name", - "petType" - ] - } - } - } -} - diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema_in_response.json deleted file mode 100644 index cf16af1..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/removed_schema_in_response.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "Added Schema in response", - "version": "1.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_no_longer_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_no_longer_supported.json deleted file mode 100644 index f6c767f..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_no_longer_supported.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "1.0" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "requestBody": { - "content": { - "text/plain": { - "schema": { - "type": "string" - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schema/Pet" - } - } - }, - "application/xml": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schema/Pet" - } - } - } - } - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/pets/{id}": { - "post": { - "description": "Post one pet according to its id", - "requestBody": { - "$ref": "#/components/requestBodies/PetBody" - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - }, - "Error": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "text/plain": { - "schema": { - "type": "string" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - }, - "application/xml": { - "schema": { - "$ref": "#/components/schema/Pet" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_now_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_now_supported.json deleted file mode 100644 index f003ba7..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/request_body_format_now_supported.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.0" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schema/Pet" - } - } - } - } - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/required_status_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/required_status_changed.json deleted file mode 100644 index 519ccbf..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/required_status_changed.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "tags to filter by", - "required": true, - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "$ref": "#/components/parameters/limit" - } - ], - "requestBody": { - "description": "Pets payload", - "content": { - "application/json": { - "schema": { - "description": "body description", - "properties": { - "eyesColor": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - }, - "parameters": { - "limit": { - "name": "limit", - "in": "query", - "description": "maximum number of results to return", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/response_body_format_now_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/response_body_format_now_supported.json deleted file mode 100644 index 4b24751..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/response_body_format_now_supported.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "1.0" - }, - "paths": { - "/pets": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#components/schemas/Pet" - } - } - } - } - } - } - } - }, - "/pets/{id}": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "404": { - "$ref": "#/components/responses/ErrorResponse" - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - }, - "Error": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "responses": { - "ErrorResponse": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/server_no_longer_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/server_no_longer_supported.json deleted file mode 100644 index 24a02ec..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/server_no_longer_supported.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "1.0" - }, - "servers": [ - { - "url": "https://development.gigantic-server.com/v1", - "description": "Development server" - }, - { - "url": "https://staging.gigantic-server.com/v1", - "description": "Staging server" - }, - { - "url": "https://api.gigantic-server.com/v1", - "description": "Production server" - } - ] -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_changed.json deleted file mode 100644 index ebcfc5e..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_changed.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "description": "Error schema", - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "integer" - }, - "tag": { - "type": "string" - } - } - }, - "UnreferencedSchema": { - "type": "integer" - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_format_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_format_changed.json deleted file mode 100644 index 5785353..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/type_format_changed.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "openapi": "3.0", - "info": { - "version": "1.0.0", - "title": "Pet store", - "description": "Pet store." - }, - "paths": { - "/pets": { - "get": { - "parameters:": [ - { - "$ref": "#/components/parameters/skipParam" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "description": "Just a Pet.", - "type": "object", - "properties": { - "sleepTime": { - "description": "How much time does he sleep.", - "type": "integer", - "format": "int32" - }, - "numberOfEyes": { - "description": "No question asked.", - "type": "string", - "format": "email" - } - } - } - }, - "parameters": { - "skipParam": { - "name": "skip", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/valid_oas.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/valid_oas.json deleted file mode 100644 index 4ab6ec1..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/valid_oas.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "1.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "Swagger API Team", - "email": "apiteam@swagger.io", - "url": "http://swagger.io" - }, - "license": { - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "tags to filter by", - "required": false, - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "limit", - "in": "query", - "description": "maximum number of results to return", - "required": false, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "post": { - "description": "Creates a new pet in the store. Duplicates are allowed", - "operationId": "addPet", - "requestBody": { - "description": "Pet to add to the store", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NewPet" - } - } - } - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/pets/{id}": { - "get": { - "description": "Returns a user based on a single ID, if the user does not have access to the pet", - "operationId": "find pet by id", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to fetch", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "delete": { - "description": "deletes a single pet based on the ID supplied", - "operationId": "deletePet", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to delete", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "204": { - "description": "pet deleted" - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "allOf": [ - { - "$ref": "#/components/schemas/NewPet" - }, - { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - } - } - } - ] - }, - "NewPet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "Error": { - "type": "object", - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/version_reversed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/version_reversed.json deleted file mode 100644 index 16b079d..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/version_reversed.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "version_check_02", - "version": "2.0" - }, - "paths": { } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/x-ms-paths.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/old/x-ms-paths.json deleted file mode 100644 index 0e91362..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/old/x-ms-paths.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "X-ms-paths", - "version": "1.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - } - }, - "x-ms-paths": { - "/myPath/query-drive?op=folder": { - "get": { - "parameters": [ - { - "name": "id", - "in": "query", - "description": "ID of pet to use", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "style": "simple" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Dog" - } - } - } - } - } - } - }, - "/myPath/query-drive?op=file": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Cat" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Dog": { - "type": "object", - "properties": { - "playWith": { - "type": "string" - }, - "enjoyWalk": { - "type": "boolean" - } - } - }, - "Cat": { - "type": "object", - "properties": { - "food": { - "type": "string" - }, - "sleepTime": { - "type": "integer" - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/diff.json new file mode 100644 index 0000000..ed0367f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "How the parameter is passed has changed -- it used to be \u0027query\u0027, now it is \u0027header\u0027.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/in", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/in", + "Id": 1015, + "Code": "ParameterInHasChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "How the parameter is passed has changed -- it used to be \u0027query\u0027, now it is \u0027header\u0027.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/in", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/in", + "Id": 1015, + "Code": "ParameterInHasChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/old.yaml new file mode 100644 index 0000000..12a5175 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/old.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/diff.json new file mode 100644 index 0000000..946c7a1 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "Parameter \u0027pageParam\u0027 has a different style value in the new version.", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/style", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/style", + "Id": 10281, + "Code": "ParameterStyleChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "Parameter \u0027PetId\u0027 has a different style value in the new version.", + "OldJsonRef": "#/paths/~1pets~1{id}/parameters/0/style", + "NewJsonRef": "#/paths/~1pets~1{id}/parameters/0/style", + "Id": 10281, + "Code": "ParameterStyleChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "Parameter \u0027PetParameter\u0027 has a different style value in the new version.", + "OldJsonRef": "#/paths/~1pets~1{id}/post/parameters/0/style", + "NewJsonRef": "#/paths/~1pets~1{id}/post/parameters/0/style", + "Id": 10281, + "Code": "ParameterStyleChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/old.yaml new file mode 100644 index 0000000..393a473 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/old.yaml @@ -0,0 +1,52 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "1.0" +paths: + /pets: + get: + description: Get all pets from Petstore + parameters: + - name: pageParam + in: query + style: spaceDelimited + responses: + "200": + description: OK + content: + application/json: + schema: + type: string + /pets/{id}: + parameters: + - name: PetId + in: path + required: true + style: label + post: + description: Register a new pet + parameters: + - $ref: '#/components/parameters/PetParameter' + responses: + "200": + description: OK + content: + application/json: + schema: + type: string +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + parameters: + PetParameter: + name: PetParameter + in: query + style: form + schema: + $ref: '#/components/schemas/Pet' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/diff.json new file mode 100644 index 0000000..a897b2d --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a new optional property \u0027breed\u0027 that was not found in the old version.", + "OldJsonRef": "#/schemas/Dog/properties/breed", + "NewJsonRef": "#/schemas/Dog/properties/breed", + "Id": 1045, + "Code": "AddedOptionalProperty", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/old.yaml new file mode 100644 index 0000000..4dbfe01 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/old.yaml @@ -0,0 +1,76 @@ +openapi: 3.0.0 +info: + version: "1.0" + title: OpenApi Petstore +servers: + - url: https://petstore.openapi.io/v1 +paths: + /pets: + put: + summary: Add a pet + operationId: addPet + tags: + - pets + parameters: + - name: Pet parameter + in: query + schema: + $ref: '#/components/schemas/Pet' + responses: + "200": + description: OK + content: + application/json: + schema: + type: string +components: + schemas: + PetWithoutDiscriminator: + properties: + petKind: + type: string + name: + type: string + required: + - name + - petKind + Pet: + discriminator: + propertyName: petKind + properties: + petKind: + type: string + name: + type: string + required: + - name + - petKind + Cat: + description: A representation of a cat + allOf: + - $ref: '#/components/schemas/PetWithoutDiscriminator' + - properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: + description: A representation of a dog + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/diff.json new file mode 100644 index 0000000..68acc14 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The read only property has changed from \u0027false\u0027 to \u0027true\u0027.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/readOnly", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/readOnly", + "Id": 1029, + "Code": "ReadonlyPropertyChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The read only property has changed from \u0027true\u0027 to \u0027false\u0027.", + "OldJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/readOnly", + "NewJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/readOnly", + "Id": 1029, + "Code": "ReadonlyPropertyChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The read only property has changed from \u0027false\u0027 to \u0027true\u0027.", + "OldJsonRef": "#/schemas/Pet/properties/name/readOnly", + "NewJsonRef": "#/schemas/Pet/properties/name/readOnly", + "Id": 1029, + "Code": "ReadonlyPropertyChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/old.yaml new file mode 100644 index 0000000..9e71dad --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: default response + content: + application/json: + schema: + description: Error schema + type: string + readOnly: true +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + readOnly: true diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/diff.json new file mode 100644 index 0000000..79b064e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing a property found in the old version. Was \u0027target\u0027 renamed or removed?", + "OldJsonRef": "#/paths/~1api~1Operations/post/parameters/0/schema/properties/error/properties/target", + "NewJsonRef": "#/paths/~1api~1Operations/post/parameters/0/schema/properties/error/properties/target", + "Id": 1033, + "Code": "RemovedProperty", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The read only property has changed from \u0027false\u0027 to \u0027true\u0027.", + "OldJsonRef": "#/paths/~1api~1Operations/post/responses/default/content/application~1json/schema/properties/error/properties/message/readOnly", + "NewJsonRef": "#/paths/~1api~1Operations/post/responses/default/content/application~1json/schema/properties/error/properties/message/readOnly", + "Id": 1029, + "Code": "ReadonlyPropertyChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The read only property has changed from \u0027false\u0027 to \u0027true\u0027.", + "OldJsonRef": "#/schemas/CloudError/properties/error/properties/message/readOnly", + "NewJsonRef": "#/schemas/CloudError/properties/error/properties/message/readOnly", + "Id": 1029, + "Code": "ReadonlyPropertyChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is missing a property found in the old version. Was \u0027target\u0027 renamed or removed?", + "OldJsonRef": "#/schemas/CreateParam/properties/error/properties/target", + "NewJsonRef": "#/schemas/CreateParam/properties/error/properties/target", + "Id": 1033, + "Code": "RemovedProperty", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/old.yaml new file mode 100644 index 0000000..f7d5e10 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/old.yaml @@ -0,0 +1,74 @@ +openapi: 3.0 +info: + title: recursive_model + version: "1.0" +servers: + - url: http:localhost:8000 +paths: + /api/Operations: + post: + tag: + - Operations + operationId: Operations_Post + parameters: + - name: accountName + in: path + required: true + schema: + $ref: '#/components/schemas/CreateParam' + description: Create Param. + responses: + "200": + description: OK + default: + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/CloudError' +components: + schemas: + CloudError: + description: Error from a REST request. + type: object + properties: + error: + $ref: '#/components/schemas/CloudErrorBody' + x-ms-external: true + CloudErrorBody: + description: Body of an error from a REST request. + type: object + properties: + code: + type: string + message: + type: string + target: + type: string + details: + description: Inner errors. + type: array + items: + $ref: '#/components/schemas/CloudErrorBody' + CreateParam: + description: Create Param a REST request. + type: object + properties: + error: + $ref: '#/components/schemas/CreateParamBody' + x-ms-external: true + CreateParamBody: + description: Create Param Body a REST request. + type: object + properties: + code: + type: string + message: + type: string + target: + type: string + details: + description: Inner errors. + type: array + items: + $ref: '#/components/schemas/CreateParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/diff.json new file mode 100644 index 0000000..90039df --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The \u0027$ref\u0027 property points to different models in the old and new versions.", + "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/items", + "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/items", + "Id": 1017, + "Code": "ReferenceRedirection", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The \u0027$ref\u0027 property points to different models in the old and new versions.", + "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/400/content/application~1json/schema/items", + "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/400/content/application~1json/schema/items", + "Id": 1017, + "Code": "ReferenceRedirection", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/old.yaml new file mode 100644 index 0000000..e6097aa --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection/old.yaml @@ -0,0 +1,63 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + get: + responses: + "200": + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "400": + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Dog' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Dog: + type: object + properties: + breed: + type: string + required: + - name + - petType + Cat: + description: A representation of a cat. Note that `Cat` will be used as the discriminator value. + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/diff.json new file mode 100644 index 0000000..52a300f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version removes the \u0027additionalProperties\u0027 element.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/additionalProperties", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/additionalProperties", + "Id": 1022, + "Code": "RemovedAdditionalProperties", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version removes the \u0027additionalProperties\u0027 element.", + "OldJsonRef": "#/schemas/Pet/additionalProperties", + "NewJsonRef": "#/schemas/Pet/additionalProperties", + "Id": 1022, + "Code": "RemovedAdditionalProperties", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/old.yaml new file mode 100644 index 0000000..3f45d6f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/old.yaml @@ -0,0 +1,50 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + - bird + additionalProperties: + type: string + required: + - name + - petType + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/diff.json new file mode 100644 index 0000000..5a5ddc2 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing a client parameter that was found in the old version. Was \u0027limitParam\u0027 removed or renamed?", + "OldJsonRef": "#/parameters/limitParam", + "NewJsonRef": "#/parameters/limitParam", + "Id": 1007, + "Code": "RemovedClientParameter", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/old.yaml new file mode 100644 index 0000000..24a29a9 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/old.yaml @@ -0,0 +1,29 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/diff.json new file mode 100644 index 0000000..3a4e69a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/diff.json @@ -0,0 +1,56 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/petType/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/petType/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/petType/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/petType/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version is removing enum value(s) \u0027Microsoft.OpenApi.Any.OpenApiString\u0027 from the old version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "Id": 1019, + "Code": "RemovedEnumValue", + "Mode": "Removal" + }, + { + "Severity": "Info", + "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/properties/petType/enum", + "Id": 1024, + "Code": "ConstraintIsStronger", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/old.yaml new file mode 100644 index 0000000..591063e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_enum_value/old.yaml @@ -0,0 +1,56 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/limitParam' + - name: skipParam + in: query + description: max records to skip + required: true + schema: + $ref: '#/components/schemas/Pet' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + - bird + required: + - name + - petType + parameters: + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: string + enum: + - clueless + - lazy + - adventurous diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/diff.json new file mode 100644 index 0000000..b9b9467 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version removes a required header \u0027x-d\u0027.", + "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", + "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", + "Id": 1014, + "Code": "RemovingHeader", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version removes a required header \u0027x-c\u0027.", + "OldJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", + "NewJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", + "Id": 1014, + "Code": "RemovingHeader", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/old.yaml new file mode 100644 index 0000000..05328c8 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/old.yaml @@ -0,0 +1,27 @@ +openapi: 3.0.1 +info: + title: operation_check_03 + version: "1.0" +paths: + /api/Parameters: + get: + operationId: Responses_Get + responses: + "200": + description: null + headers: + x-b: + schema: + type: integer + x-d: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + headers: + x-a: + schema: + type: integer + x-c: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/diff.json new file mode 100644 index 0000000..57049cd --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing an operation that was found in the old version. Was operationId \u0027Operations_Post\u0027 removed or restructured?", + "OldJsonRef": "#/paths/~1api~1Operations/post", + "NewJsonRef": "#/paths/~1api~1Operations/post", + "Id": 1035, + "Code": "RemovedOperation", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/old.yaml new file mode 100644 index 0000000..7de743f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/old.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: removed_operation + version: "1.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/diff.json new file mode 100644 index 0000000..f570d74 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing a path that was found in the old version. Was path \u0027/api/Parameters/{a}\u0027 removed or restructured?", + "OldJsonRef": "#/paths/~1api~1Parameters~1{a}", + "NewJsonRef": null, + "Id": 1005, + "Code": "RemovedPath", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version is missing a path that was found in the old version. Was path \u0027/api/Responses\u0027 removed or restructured?", + "OldJsonRef": "#/paths/~1api~1Responses", + "NewJsonRef": null, + "Id": 1005, + "Code": "RemovedPath", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/old.yaml new file mode 100644 index 0000000..e3ad34a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/old.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.1 +info: + title: removed_path + version: "1.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} + /api/Parameters/{a}: + get: + operationId: Parameters_Get + responses: {} + /api/Responses: + get: + operationId: Responses_Get + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/diff.json new file mode 100644 index 0000000..e62dc07 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing a property found in the old version. Was \u0027petType\u0027 renamed or removed?", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/petType", + "Id": 1033, + "Code": "RemovedProperty", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version is missing a property found in the old version. Was \u0027message\u0027 renamed or removed?", + "OldJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/properties/message", + "NewJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema/properties/message", + "Id": 1033, + "Code": "RemovedProperty", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version is missing a property found in the old version. Was \u0027status\u0027 renamed or removed?", + "OldJsonRef": "#/paths/~1pets/get/requestBody/content/application~1json/schema/properties/status", + "NewJsonRef": "#/paths/~1pets/get/requestBody/content/application~1json/schema/properties/status", + "Id": 1033, + "Code": "RemovedProperty", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/old.yaml new file mode 100644 index 0000000..9e478cb --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_property/old.yaml @@ -0,0 +1,59 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + required: + - status + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/diff.json new file mode 100644 index 0000000..450a70d --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is removing a requestBody that was found in the old version.", + "OldJsonRef": "#/paths/~1pets/post/requestBody", + "NewJsonRef": "#/paths/~1pets/post/requestBody", + "Id": 1047, + "Code": "RemovedRequestBody", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/old.yaml new file mode 100644 index 0000000..35bd43e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/old.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.0" +paths: + /pets: + post: + description: Post multiple pets + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string + responses: + "200": + content: + text/plain: + schema: + type: integer + /pets/{id}: + post: + description: Post one pet according to its id + requestBody: + $ref: '#/components/requestBodies/PetBody' + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + requestBodies: + PetBody: + content: + application/json: + schema: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/diff.json new file mode 100644 index 0000000..f61f8f9 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The required parameter \u0027limitParam\u0027 was removed in the new version.", + "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1", + "NewJsonRef": null, + "Id": 1009, + "Code": "RemovedRequiredParameter", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/old.yaml new file mode 100644 index 0000000..12a5175 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/old.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/diff.json new file mode 100644 index 0000000..8f8232a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version removes the response code \u0027200\u0027", + "OldJsonRef": "#/paths/~1api~1Operations/post/responses/200", + "NewJsonRef": "#/paths/~1api~1Operations/post/responses/200", + "Id": 1012, + "Code": "RemovedResponseCode", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version removes the response code \u0027202\u0027", + "OldJsonRef": "#/paths/~1api~1Responses/get/responses/202", + "NewJsonRef": "#/paths/~1api~1Responses/get/responses/202", + "Id": 1012, + "Code": "RemovedResponseCode", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/old.yaml new file mode 100644 index 0000000..ac3c547 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/old.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.1 +info: + title: operation_check_01 + version: "1.0" +paths: + /api/Path: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: + "200": + description: null + /api/Parameters/{a}: + get: + operationId: Parameters_Get + responses: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + "202": + description: null + "400": + description: null diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/diff.json new file mode 100644 index 0000000..e53dd63 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing a definition that was found in the old version. Was \u0027Pet\u0027 removed or renamed?", + "OldJsonRef": "#/schemas/Pet", + "NewJsonRef": "#/schemas/Pet", + "Id": 1006, + "Code": "RemovedDefinition", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/old.yaml new file mode 100644 index 0000000..5dd10c7 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/old.yaml @@ -0,0 +1,55 @@ +openapi: 3.0 +info: + title: removed_definition + version: "1.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Database' + get: + tags: + - Parameters + operationId: Parameters_Get + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Database' +components: + schemas: + Database: + description: Database schema + properties: + a: + type: string + readOnly: true + description: |- + This is a system generated property. + The _rid value is empty for this operation. + b: + type: integer + readOnly: true + default: 0 + description: This property shows the number of databases returned. + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/diff.json new file mode 100644 index 0000000..b64028f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing a definition that was found in the old version. Was \u0027\u0027 removed or renamed?", + "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", + "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", + "Id": 1006, + "Code": "RemovedDefinition", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/old.yaml new file mode 100644 index 0000000..3791b94 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/old.yaml @@ -0,0 +1,36 @@ +openapi: 3.0 +info: + title: Added Schema in response + version: "1.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: [] + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + required: + - name + - petType diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/diff.json new file mode 100644 index 0000000..3cfce7b --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version does not support \u0027text/plain\u0027 as a request body format.", + "OldJsonRef": "#/paths/~1pets/post/requestBody/content/text~1plain", + "NewJsonRef": "#/paths/~1pets/post/requestBody/content/text~1plain", + "Id": 1003, + "Code": "RequestBodyFormatNoLongerSupported", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version does not support \u0027application/xml\u0027 as a request body format.", + "OldJsonRef": "#/paths/~1pets/post/requestBody/content/application~1xml", + "NewJsonRef": "#/paths/~1pets/post/requestBody/content/application~1xml", + "Id": 1003, + "Code": "RequestBodyFormatNoLongerSupported", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version does not support \u0027text/plain\u0027 as a request body format.", + "OldJsonRef": "#/paths/~1pets~1{id}/post/requestBody/content/text~1plain", + "NewJsonRef": "#/paths/~1pets~1{id}/post/requestBody/content/text~1plain", + "Id": 1003, + "Code": "RequestBodyFormatNoLongerSupported", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version does not support \u0027application/xml\u0027 as a request body format.", + "OldJsonRef": "#/paths/~1pets~1{id}/post/requestBody/content/application~1xml", + "NewJsonRef": "#/paths/~1pets~1{id}/post/requestBody/content/application~1xml", + "Id": 1003, + "Code": "RequestBodyFormatNoLongerSupported", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/old.yaml new file mode 100644 index 0000000..97aa775 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_no_longer_supported/old.yaml @@ -0,0 +1,71 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "1.0" +paths: + /pets: + post: + description: Post multiple pets + requestBody: + content: + text/plain: + schema: + type: string + application/json: + schema: + type: array + items: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: array + items: + $ref: '#/components/schema/Pet' + responses: + "200": + content: + text/plain: + schema: + type: integer + /pets/{id}: + post: + description: Post one pet according to its id + requestBody: + $ref: '#/components/requestBodies/PetBody' + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + Error: + type: object + properties: + error: + type: string + message: + type: string + requestBodies: + PetBody: + content: + text/plain: + schema: + type: string + application/json: + schema: + $ref: '#/components/schema/Pet' + application/xml: + schema: + $ref: '#/components/schema/Pet' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/diff.json new file mode 100644 index 0000000..35ef4ce --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Info", + "Message": "The old version did not support \u0027application/xml\u0027 as a request body format.", + "OldJsonRef": "#/paths/~1pets/post/requestBody/content/application~1xml", + "NewJsonRef": "#/paths/~1pets/post/requestBody/content/application~1xml", + "Id": 1018, + "Code": "RequestBodyFormatNowSupported", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/old.yaml new file mode 100644 index 0000000..de7721f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/old.yaml @@ -0,0 +1,39 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.0" +paths: + /pets: + post: + description: Post multiple pets + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schema/Pet' + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + requestBodies: + PetBody: + content: + application/json: + schema: + $ref: '#/components/schema/Pet' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/diff.json new file mode 100644 index 0000000..2b12053 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Info", + "Message": "The \u0027required\u0027 status changed from the old version(\u0027True\u0027) to the new version(\u0027False\u0027).", + "OldJsonRef": "#/paths/~1pets/get/parameters/0/required", + "NewJsonRef": "#/paths/~1pets/get/parameters/0/required", + "Id": 1025, + "Code": "RequiredStatusChange", + "Mode": "Update" + }, + { + "Severity": "Info", + "Message": "The \u0027required\u0027 status changed from the old version(\u0027True\u0027) to the new version(\u0027False\u0027).", + "OldJsonRef": "#/paths/~1pets/get/parameters/1/required", + "NewJsonRef": "#/paths/~1pets/get/parameters/1/required", + "Id": 1025, + "Code": "RequiredStatusChange", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The \u0027required\u0027 status changed from the old version(\u0027False\u0027) to the new version(\u0027True\u0027).", + "OldJsonRef": "#/paths/~1pets/get/requestBody/required", + "NewJsonRef": "#/paths/~1pets/get/requestBody/required", + "Id": 1025, + "Code": "RequiredStatusChange", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/old.yaml new file mode 100644 index 0000000..d653c7a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/required_status_changed/old.yaml @@ -0,0 +1,67 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: true + style: form + schema: + type: array + items: + type: string + - $ref: '#/components/parameters/limit' + requestBody: + description: Pets payload + content: + application/json: + schema: + description: body description + properties: + eyesColor: + type: string + petType: + type: string + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + parameters: + limit: + name: limit + in: query + description: maximum number of results to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/diff.json new file mode 100644 index 0000000..fa5b8c7 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/diff.json @@ -0,0 +1,47 @@ +[ + { + "Severity": "Info", + "Message": "The old version did not support \u0027application/xml\u0027 as a response body format.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1xml", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1xml", + "Id": 1004, + "Code": "ResponseBodyFormatNowSupported", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The old version did not support \u0027text/plain\u0027 as a response body format.", + "OldJsonRef": "#/paths/~1pets~1{id}/get/responses/200/content/text~1plain", + "NewJsonRef": "#/paths/~1pets~1{id}/get/responses/200/content/text~1plain", + "Id": 1004, + "Code": "ResponseBodyFormatNowSupported", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The old version did not support \u0027application/xml\u0027 as a response body format.", + "OldJsonRef": "#/paths/~1pets~1{id}/get/responses/200/content/application~1xml", + "NewJsonRef": "#/paths/~1pets~1{id}/get/responses/200/content/application~1xml", + "Id": 1004, + "Code": "ResponseBodyFormatNowSupported", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The old version did not support \u0027text/plain\u0027 as a response body format.", + "OldJsonRef": "#/paths/~1pets~1{id}/get/responses/404/content/text~1plain", + "NewJsonRef": "#/paths/~1pets~1{id}/get/responses/404/content/text~1plain", + "Id": 1004, + "Code": "ResponseBodyFormatNowSupported", + "Mode": "Addition" + }, + { + "Severity": "Info", + "Message": "The old version did not support \u0027text/plain\u0027 as a response body format.", + "OldJsonRef": "#/responses/ErrorResponse/content/text~1plain", + "NewJsonRef": "#/responses/ErrorResponse/content/text~1plain", + "Id": 1004, + "Code": "ResponseBodyFormatNowSupported", + "Mode": "Addition" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/old.yaml new file mode 100644 index 0000000..e6a21f0 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/old.yaml @@ -0,0 +1,50 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "1.0" +paths: + /pets: + get: + responses: + "200": + content: + application/json: + schema: + type: array + items: + $ref: '#components/schemas/Pet' + /pets/{id}: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + "404": + $ref: '#/components/responses/ErrorResponse' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + Error: + type: object + properties: + error: + type: string + message: + type: string + responses: + ErrorResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/diff.json new file mode 100644 index 0000000..96c1c67 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/diff.json @@ -0,0 +1,20 @@ +[ + { + "Severity": "Warning", + "Message": "The new version does not support the server with url \u0027https://staging.gigantic-server.com/v1\u0027 anymore", + "OldJsonRef": "#/servers/1", + "NewJsonRef": null, + "Id": 10021, + "Code": "ServerNoLongerSupported", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The new version does not support the server with url \u0027https://api.gigantic-server.com/v1\u0027 anymore", + "OldJsonRef": "#/servers/2", + "NewJsonRef": null, + "Id": 10021, + "Code": "ServerNoLongerSupported", + "Mode": "Removal" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/old.yaml new file mode 100644 index 0000000..72c7811 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/old.yaml @@ -0,0 +1,11 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "1.0" +servers: + - url: https://development.gigantic-server.com/v1 + description: Development server + - url: https://staging.gigantic-server.com/v1 + description: Staging server + - url: https://api.gigantic-server.com/v1 + description: Production server diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/diff.json new file mode 100644 index 0000000..0364dee --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a different type \u0027string\u0027 than the previous one \u0027integer\u0027.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/type", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/type", + "Id": 1026, + "Code": "TypeChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different type \u0027string\u0027 than the previous one \u0027integer\u0027.", + "OldJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/type", + "NewJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/type", + "Id": 1026, + "Code": "TypeChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different type \u0027string\u0027 than the previous one \u0027integer\u0027.", + "OldJsonRef": "#/schemas/Pet/properties/name/type", + "NewJsonRef": "#/schemas/Pet/properties/name/type", + "Id": 1026, + "Code": "TypeChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different type \u0027string\u0027 than the previous one \u0027integer\u0027.", + "OldJsonRef": "#/schemas/UnreferencedSchema/type", + "NewJsonRef": "#/schemas/UnreferencedSchema/type", + "Id": 1026, + "Code": "TypeChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/old.yaml new file mode 100644 index 0000000..d62eefd --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_changed/old.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: default response + content: + application/json: + schema: + description: Error schema + type: integer +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: integer + tag: + type: string + UnreferencedSchema: + type: integer diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/diff.json new file mode 100644 index 0000000..056d61c --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/diff.json @@ -0,0 +1,38 @@ +[ + { + "Severity": "Warning", + "Message": "The new version has a different format than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/sleepTime/format", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/sleepTime/format", + "Id": 1023, + "Code": "TypeFormatChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different format than the previous one.", + "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/numberOfEyes/format", + "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/numberOfEyes/format", + "Id": 1023, + "Code": "TypeFormatChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different format than the previous one.", + "OldJsonRef": "#/schemas/Pet/properties/sleepTime/format", + "NewJsonRef": "#/schemas/Pet/properties/sleepTime/format", + "Id": 1023, + "Code": "TypeFormatChanged", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different format than the previous one.", + "OldJsonRef": "#/schemas/Pet/properties/numberOfEyes/format", + "NewJsonRef": "#/schemas/Pet/properties/numberOfEyes/format", + "Id": 1023, + "Code": "TypeFormatChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/old.yaml new file mode 100644 index 0000000..d8f7f8a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/old.yaml @@ -0,0 +1,39 @@ +openapi: "3.0" +info: + version: 1.0.0 + title: Pet store + description: Pet store. +paths: + /pets: + get: + 'parameters:': + - $ref: '#/components/parameters/skipParam' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + description: Just a Pet. + type: object + properties: + sleepTime: + description: How much time does he sleep. + type: integer + format: int32 + numberOfEyes: + description: No question asked. + type: string + format: email + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/diff.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/diff.json @@ -0,0 +1 @@ +[] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/old.yaml new file mode 100644 index 0000000..b813746 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/old.yaml @@ -0,0 +1,156 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification + termsOfService: http://swagger.io/terms/ + contact: + name: Swagger API Team + email: apiteam@swagger.io + url: http://swagger.io + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + style: form + schema: + type: array + items: + type: string + - name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + description: Creates a new pet in the store. Duplicates are allowed + operationId: addPet + requestBody: + description: Pet to add to the store + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NewPet' + responses: + "200": + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /pets/{id}: + get: + description: Returns a user based on a single ID, if the user does not have access to the pet + operationId: find pet by id + parameters: + - name: id + in: path + description: ID of pet to fetch + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + description: deletes a single pet based on the ID supplied + operationId: deletePet + parameters: + - name: id + in: path + description: ID of pet to delete + required: true + schema: + type: integer + format: int64 + responses: + "204": + description: pet deleted + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' +components: + schemas: + Pet: + allOf: + - $ref: '#/components/schemas/NewPet' + - type: object + required: + - id + properties: + id: + type: integer + format: int64 + NewPet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + Error: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/diff.json new file mode 100644 index 0000000..2c05f0e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/diff.json @@ -0,0 +1,11 @@ +[ + { + "Severity": "Error", + "Message": "The new version has a lower value than the old: System.String[] -\u003E System.String[]", + "OldJsonRef": "#/info/version", + "NewJsonRef": "#/info/version", + "Id": 1000, + "Code": "VersionsReversed", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/new.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/new.yaml new file mode 100644 index 0000000..cbcb1af --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/new.yaml @@ -0,0 +1,5 @@ +openapi: 3.0.1 +info: + title: version_check_02 + version: "1.0" +paths: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/old.yaml new file mode 100644 index 0000000..dd79bdb --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/old.yaml @@ -0,0 +1,5 @@ +openapi: 3.0.1 +info: + title: version_check_02 + version: "2.0" +paths: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/diff.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/diff.json new file mode 100644 index 0000000..492e3f1 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/diff.json @@ -0,0 +1,29 @@ +[ + { + "Severity": "Warning", + "Message": "The new version is missing a path that was found in the old version. Was path \u0027/myPath/query-drive?op=file\u0027 removed or restructured?", + "OldJsonRef": "#/x-ms-paths/~1myPath~1query-drive?op=file", + "NewJsonRef": "#/x-ms-paths/~1myPath~1query-drive?op=file", + "Id": 1005, + "Code": "RemovedPath", + "Mode": "Removal" + }, + { + "Severity": "Warning", + "Message": "The \u0027required\u0027 status changed from the old version(\u0027False\u0027) to the new version(\u0027True\u0027).", + "OldJsonRef": "#/x-ms-paths/~1myPath~1query-drive?op=folder/get/parameters/0/required", + "NewJsonRef": "#/x-ms-paths/~1myPath~1query-drive?op=folder/get/parameters/0/required", + "Id": 1025, + "Code": "RequiredStatusChange", + "Mode": "Update" + }, + { + "Severity": "Warning", + "Message": "The new version has a different type \u0027string\u0027 than the previous one \u0027integer\u0027.", + "OldJsonRef": "#/schemas/Cat/properties/sleepTime/type", + "NewJsonRef": "#/schemas/Cat/properties/sleepTime/type", + "Id": 1026, + "Code": "TypeChanged", + "Mode": "Update" + } +] diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/new.yaml similarity index 100% rename from src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.yaml rename to src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/new.yaml diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/old.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/old.yaml new file mode 100644 index 0000000..68ecb1a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/old.yaml @@ -0,0 +1,59 @@ +openapi: 3.0.1 +info: + title: X-ms-paths + version: "1.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} +x-ms-paths: + /myPath/query-drive?op=folder: + get: + parameters: + - name: id + in: query + description: ID of pet to use + required: false + schema: + type: array + items: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Dog' + /myPath/query-drive?op=file: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Cat' +components: + schemas: + Dog: + type: object + properties: + playWith: + type: string + enjoyWalk: + type: boolean + Cat: + type: object + properties: + food: + type: string + sleepTime: + type: integer