├── .devcontainer └── devcontainer.json ├── .github ├── dependabot.yml └── workflows │ ├── publish.yml │ └── test.yml ├── .gitignore ├── Criteo.OpenApi.Comparator.sln ├── LICENSE ├── README.md ├── documentation ├── README.md └── rules │ ├── 1000.md │ ├── 1001.md │ ├── 1002.md │ ├── 1003.md │ ├── 1004.md │ ├── 1005.md │ ├── 1006.md │ ├── 1007.md │ ├── 1008.md │ ├── 1009.md │ ├── 1010.md │ ├── 1011.md │ ├── 1012.md │ ├── 1013.md │ ├── 1014.md │ ├── 1015.md │ ├── 1016.md │ ├── 1017.md │ ├── 1018.md │ ├── 1019.md │ ├── 1020.md │ ├── 1021.md │ ├── 1022.md │ ├── 1023.md │ ├── 1024.md │ ├── 1025.md │ ├── 1026.md │ ├── 1027.md │ ├── 1028.md │ ├── 1029.md │ ├── 1030.md │ ├── 1032.md │ ├── 1033.md │ ├── 1034.md │ ├── 1035.md │ ├── 1036.md │ ├── 1037.md │ ├── 1038.md │ ├── 1039.md │ ├── 1040.md │ ├── 1041.md │ ├── 1042.md │ ├── 1043.md │ ├── 1044.md │ ├── 1045.md │ ├── 1046.md │ ├── 1047.md │ ├── 1048.md │ └── 2000.md ├── prepare_version.sh └── src ├── Criteo.OpenApi.Comparator.Cli ├── Criteo.OpenApi.Comparator.Cli.csproj ├── Options.cs └── Program.cs ├── Criteo.OpenApi.Comparator.UTest ├── Criteo.OpenApi.Comparator.UTest.csproj ├── OpenApiParserTests.cs ├── OpenApiSpecificationsCompareTests.cs ├── PrimitiveTypesExtensionTests.cs └── Resource │ ├── added_additional_properties │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_enum_value │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_header │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_operation │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_optional_parameter │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_optional_property │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_path │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_property_in_response │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_readOnly_property_in_response │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_request_body │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_required_parameter │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_required_property │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_response_code │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── added_schema_in_response │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── changed_parameter_order │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── constant_status_has_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── constraint_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── constraint_is_stronger │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── constraint_is_weaker │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── default_value_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── different_allOf │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── different_discriminator │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction │ ├── body_add.yaml │ ├── body_remove.yaml │ ├── both_ref_add.yaml │ ├── both_ref_remove.yaml │ ├── old_with_refs.json │ ├── old_without_refs.json │ ├── path_add.yaml │ ├── path_remove.yaml │ ├── query_add.yaml │ ├── query_remove.yaml │ ├── request_ref_add.yaml │ ├── request_ref_remove.yaml │ ├── response_add.yaml │ ├── response_ref_add.yaml │ ├── response_ref_remove.yaml │ └── response_remove.yaml │ ├── enum_direction_body_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_body_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_both_ref_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_both_ref_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_path_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_path_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_query_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_query_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_request_ref_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_request_ref_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_response_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_response_ref_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_response_ref_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── enum_direction_response_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── invalid_json_file.txt │ ├── issue_49_false_1015_equal_schemas │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── issue_49_false_1015_out_of_order_parameters │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── issue_59_case1 │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── issue_59_case2 │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── long_running_operation │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── modified_operation_id │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── no_version_change │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── nullable_property_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── oneof_add │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── oneof_add_ref │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── oneof_ref_inner_change │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── oneof_remove │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── oneof_remove_ref │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── oneof_reorder_refs │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── openapi_specification.json │ ├── openapi_specification.yaml │ ├── parameter_in_has_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── parameter_style_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── polymorphic_schema │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── readonly_property_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── recursive_model │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── reference_redirection │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── reference_redirection_type_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_additional_properties │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_client_parameter │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_enum_value │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_header │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_operation │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_path │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_property │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_request_body │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_required_parameter │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_response_code │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_schema │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── removed_schema_in_response │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── request_body_format_no_longer_supported │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── request_body_format_now_supported │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── required_status_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── response_body_format_now_supported │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── server_no_longer_supported │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── type_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── type_format_changed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── valid_oas │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ ├── version_reversed │ ├── diff.json │ ├── new.yaml │ └── old.yaml │ └── x-ms-paths │ ├── diff.json │ ├── new.yaml │ └── old.yaml └── Criteo.OpenApi.Comparator ├── Comparators ├── ComponentComparator.cs ├── ContentComparator.cs ├── Extensions │ ├── OpenApiParameterExtension.cs │ ├── OpenApiPathsExtensions.cs │ ├── OpenApiReferenceExtensions.cs │ ├── OpenApiSchemaExtensions.cs │ └── PrimitiveTypesExtensions.cs ├── OpenApiDocumentComparator.cs ├── OperationComparator.cs ├── ParameterComparator.cs ├── RequestBodyComparator.cs ├── ResponseComparator.cs └── SchemaComparator.cs ├── ComparisonContext.cs ├── ComparisonMessage.cs ├── ComparisonRule.cs ├── ComparisonRules.cs ├── Criteo.OpenApi.Comparator.csproj ├── Logging ├── LogMessageSeverity.cs └── ObjectPath.cs ├── MessageType.cs ├── OpenApiComparator.cs ├── Parser ├── JsonDocument.cs ├── OpenApiParser.cs └── PathLevelParameterConverter.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs └── Resources.resx └── Settings.cs /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet 3 | { 4 | "name": "C# (.NET)", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "mcr.microsoft.com/devcontainers/dotnet:0-6.0", 7 | "features": { 8 | "ghcr.io/devcontainers/features/dotnet:2": {} 9 | } 10 | 11 | // Features to add to the dev container. More info: https://containers.dev/features. 12 | // "features": {}, 13 | 14 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 15 | // "forwardPorts": [5000, 5001], 16 | // "portsAttributes": { 17 | // "5001": { 18 | // "protocol": "https" 19 | // } 20 | // } 21 | 22 | // Use 'postCreateCommand' to run commands after the container is created. 23 | // "postCreateCommand": "dotnet restore", 24 | 25 | // Configure tool-specific properties. 26 | // "customizations": {}, 27 | 28 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 29 | // "remoteUser": "root" 30 | } 31 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/.github/workflows" 10 | schedule: 11 | interval: "monthly" 12 | - package-ecosystem: "nuget" 13 | directory: "/" 14 | schedule: 15 | interval: "monthly" 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Usual stuff 2 | bin 3 | obj 4 | 5 | # Gradle 6 | .build/ 7 | 8 | # IDE 9 | .idea/ 10 | 11 | # NUnit 12 | Criteo.OpenApi.Comparator.sln.DotSettings.user 13 | -------------------------------------------------------------------------------- /documentation/rules/1000.md: -------------------------------------------------------------------------------- 1 | ### 1000 - VersionsReversed 2 | 3 | **Description**: Checks whether the [semantic version number](http://semver.org/) is reversed from the previous specification. 4 | 5 | **Cause**: This is considered an unexpected change. 6 | 7 | **Example**: Version is changed from `2.0.0` to `1.0.0`. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "openapi": "3.0", 13 | "info": { 14 | "title": "swagger", 15 | "description": "The Azure Management API.", 16 | "version": "2.0.0", 17 | } 18 | } 19 | ``` 20 | 21 | New specification 22 | ```json5 23 | { 24 | "openapi": "3.0", 25 | "info": { 26 | "title": "swagger", 27 | "description": "The Azure Management API.", 28 | "version": "1.0.0", 29 | } 30 | } 31 | ``` 32 | -------------------------------------------------------------------------------- /documentation/rules/1001.md: -------------------------------------------------------------------------------- 1 | ### 1001 - NoVersionChange 2 | 3 | **Description**: Checks whether version is changed from the previous specification. 4 | 5 | **Cause**: This is considered a not worthy change. 6 | 7 | **Example**: Version is changed from `2017-05-01` to `2017-07-01`. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "openapi": "3.0", 13 | "info": { 14 | "title": "swagger", 15 | "description": "The Azure Management API.", 16 | "version": "2021-04-09", 17 | } 18 | } 19 | ``` 20 | 21 | New specification 22 | ```json5 23 | { 24 | "openapi": "3.0", 25 | "info": { 26 | "title": "swagger", 27 | "description": "The Azure Management API.", 28 | "version": "2021-04-09", 29 | } 30 | } 31 | ``` 32 | -------------------------------------------------------------------------------- /documentation/rules/1002.md: -------------------------------------------------------------------------------- 1 | ### 1002 - ServerNoLongerSupported 2 | 3 | **Description**: Checks whether any supported `servers` is changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: `Staging` server is no longer supported in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "servers": [ 13 | { 14 | "url": "https://development.gigantic-server.com/v1", 15 | "description": "Development server" 16 | }, 17 | { 18 | "url": "https://staging.gigantic-server.com/v1", 19 | "description": "Staging server" 20 | } 21 | ] 22 | } 23 | ``` 24 | 25 | New specification 26 | ```json5 27 | { 28 | "servers": [ 29 | { 30 | "url": "https://development.gigantic-server.com/v1", 31 | "description": "Development server" 32 | } 33 | ] 34 | } 35 | ``` 36 | -------------------------------------------------------------------------------- /documentation/rules/1005.md: -------------------------------------------------------------------------------- 1 | ### 1005 - RemovedPath 2 | 3 | **Description**: Checks whether an existing path is removed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Path `/pets/{id}` is being removed without revising api-version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | ... 16 | }, 17 | "post": { 18 | ... 19 | } 20 | }, 21 | "/pets/{id}": { 22 | "get": { 23 | ... 24 | } 25 | } 26 | } 27 | } 28 | ``` 29 | 30 | New specification 31 | ```json5 32 | { 33 | "paths": { 34 | "/pets": { 35 | "get": { 36 | ... 37 | }, 38 | "post": { 39 | ... 40 | } 41 | } 42 | } 43 | } 44 | ``` 45 | -------------------------------------------------------------------------------- /documentation/rules/1008.md: -------------------------------------------------------------------------------- 1 | ### 1008 - ModifiedOperationId 2 | 3 | **Description**: Checks whether an existing operation's `operationId` is changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: `operationId` of Operation `get` from Path `/pets` is updated from `getPets` to `getAllPets`. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | "operationId": "getPets", 16 | ... 17 | }, 18 | "post": { 19 | ... 20 | } 21 | } 22 | } 23 | } 24 | ``` 25 | 26 | New specification 27 | ```json5 28 | { 29 | "paths": { 30 | "/pets": { 31 | "get": { 32 | "operationId": "getAllPets", 33 | ... 34 | }, 35 | "post": { 36 | ... 37 | } 38 | } 39 | } 40 | } 41 | ``` 42 | -------------------------------------------------------------------------------- /documentation/rules/1009.md: -------------------------------------------------------------------------------- 1 | ### 1009 - RemovedRequiredParameter 2 | 3 | **Description**: Checks whether required parameter is removed / made optional from the previous specification. 4 | 5 | **Cause**: TBD. 6 | 7 | **Example**: Required parameter `skip` is made optional in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "parameters": [ 15 | { 16 | "name": "skip", 17 | "in": "query", 18 | "description": "number of items to skip", 19 | "required": true, 20 | "schema": { 21 | "type": "integer", 22 | "format": "int32" 23 | } 24 | } 25 | ] 26 | } 27 | } 28 | } 29 | ``` 30 | 31 | New specification 32 | ```json5 33 | { 34 | "paths": { 35 | "/pets": { 36 | "parameters": [ 37 | { 38 | "name": "skip", 39 | "in": "query", 40 | "description": "number of items to skip", 41 | "required": false, 42 | "schema": { 43 | "type": "integer", 44 | "format": "int32" 45 | } 46 | } 47 | ] 48 | } 49 | } 50 | } 51 | ``` 52 | -------------------------------------------------------------------------------- /documentation/rules/1011.md: -------------------------------------------------------------------------------- 1 | ### 1011 - AddedResponseCode 2 | 3 | **Description**: Checks whether any new response code is added from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Response code `204` is added to existing `delete` operation in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets/{id}": { 14 | "delete": { 15 | ... 16 | "responses": { 17 | "200" : { ... } 18 | } 19 | } 20 | } 21 | } 22 | } 23 | ``` 24 | 25 | New specification 26 | ```json5 27 | { 28 | "paths": { 29 | "/pets/{id}": { 30 | "delete": { 31 | ... 32 | "responses": { 33 | "200" : { ... }, 34 | "204" : { ... } 35 | } 36 | } 37 | } 38 | } 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /documentation/rules/1012.md: -------------------------------------------------------------------------------- 1 | ### 1012 - RemovedResponseCode 2 | 3 | **Description**: Checks whether any existing response code is removed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Response code `204` is removed from existing `delete` operation in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets/{id}": { 14 | "delete": { 15 | ... 16 | "responses": { 17 | "200" : { ... }, 18 | "204" : { ... } 19 | } 20 | } 21 | } 22 | } 23 | } 24 | ``` 25 | 26 | New specification 27 | ```json5 28 | { 29 | "paths": { 30 | "/pets/{id}": { 31 | "delete": { 32 | ... 33 | "responses": { 34 | "200" : { ... } 35 | } 36 | } 37 | } 38 | } 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /documentation/rules/1013.md: -------------------------------------------------------------------------------- 1 | ### 1013 - AddedHeader 2 | 3 | **Description**: Checks whether any new header is added from the previous specification. 4 | 5 | **Cause**: This is considered a not worthy change. 6 | 7 | **Example**: Response code `200` adds header `x-b` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | ... 16 | "responses": { 17 | "200" : { 18 | ... 19 | "headers": { 20 | "x-a": { "type": "string" } 21 | } 22 | }, 23 | } 24 | } 25 | } 26 | } 27 | } 28 | ``` 29 | 30 | New specification 31 | ```json5 32 | { 33 | "paths": { 34 | "/pets": { 35 | "get": { 36 | ... 37 | "responses": { 38 | "200" : { 39 | ... 40 | "headers": { 41 | "x-a": { "type": "string" }, 42 | "x-b": { "type": "integer" } 43 | } 44 | }, 45 | } 46 | } 47 | } 48 | } 49 | } 50 | ``` 51 | -------------------------------------------------------------------------------- /documentation/rules/1014.md: -------------------------------------------------------------------------------- 1 | ### 1014 - RemovedHeader 2 | 3 | **Description**: Checks whether any existing header is removed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Response code `200` removed header `x-b` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | ... 16 | "responses": { 17 | "200" : { 18 | ... 19 | "headers": { 20 | "x-a": { "type": "string" }, 21 | "x-b": { "type": "integer" } 22 | } 23 | }, 24 | } 25 | } 26 | } 27 | } 28 | } 29 | ``` 30 | 31 | New specification 32 | ```json5 33 | { 34 | "paths": { 35 | "/pets": { 36 | "get": { 37 | ... 38 | "responses": { 39 | "200" : { 40 | ... 41 | "headers": { 42 | "x-a": { "type": "string" } 43 | } 44 | }, 45 | } 46 | } 47 | } 48 | } 49 | } 50 | ``` 51 | -------------------------------------------------------------------------------- /documentation/rules/1015.md: -------------------------------------------------------------------------------- 1 | ### 1015 - ParameterInHasChanged 2 | 3 | **Description**: Checks whether any parameter `in` is changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Parameter `skip` is changed from being `query` parameter to `path` parameter in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | ... 16 | "parameters": [ 17 | { 18 | "name": "skip", 19 | "in": "query", 20 | "description": "number of items to skip", 21 | "required": true, 22 | "schema": { 23 | "type": "integer", 24 | "format": "int32" 25 | } 26 | } 27 | ] 28 | } 29 | } 30 | } 31 | } 32 | ``` 33 | 34 | New specification 35 | ```json5 36 | { 37 | "paths": { 38 | "/pets": { 39 | "get": { 40 | ... 41 | "parameters": [ 42 | { 43 | "name": "skip", 44 | "in": "path", 45 | "description": "number of items to skip", 46 | "required": true, 47 | "schema": { 48 | "type": "integer", 49 | "format": "int32" 50 | } 51 | } 52 | ] 53 | } 54 | } 55 | } 56 | } 57 | ``` 58 | -------------------------------------------------------------------------------- /documentation/rules/1017.md: -------------------------------------------------------------------------------- 1 | ### 1017 - ReferenceRedirection 2 | 3 | **Description**: Checks whether any `$ref` property points to different models from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Schema of response `200` points to `Dog` instead of `Cat` in the new specification. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets/{id}": { 14 | "get": { 15 | ... 16 | "responses": { 17 | "200": { 18 | "schema": { 19 | "$ref": "#/components/schemas/Cat" 20 | } 21 | } 22 | } 23 | } 24 | } 25 | } 26 | } 27 | ``` 28 | 29 | New specification 30 | ```json5 31 | { 32 | "paths": { 33 | "/pets/{id}": { 34 | "get": { 35 | ... 36 | "responses": { 37 | "200": { 38 | "schema": { 39 | "$ref": "#/components/schemas/Dog" 40 | } 41 | } 42 | } 43 | } 44 | } 45 | } 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /documentation/rules/1021.md: -------------------------------------------------------------------------------- 1 | ### 1021 - AddedAdditionalProperties 2 | 3 | **Description**: Checks whether any property adds `additionalProperties` element from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: The `Pet` schema sees its `additionalProperties` attribute added in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "Pet": { 13 | "type": "object", 14 | "properties": { 15 | "name": { 16 | "type": "string" 17 | }, 18 | "petType": { 19 | "readOnly": true, 20 | "type": "string" 21 | } 22 | } 23 | } 24 | } 25 | ``` 26 | 27 | New specification 28 | ```json5 29 | { 30 | "Pet": { 31 | "type": "object", 32 | "properties": { 33 | "name": { 34 | "type": "string" 35 | }, 36 | "petType": { 37 | "readOnly": true, 38 | "type": "string" 39 | } 40 | }, 41 | "additionalProperties": { 42 | "type": "string" 43 | } 44 | } 45 | } 46 | ``` 47 | -------------------------------------------------------------------------------- /documentation/rules/1022.md: -------------------------------------------------------------------------------- 1 | ### 1022 - RemovedAdditionalProperties 2 | 3 | **Description**: Checks whether any existing property removes `additionalProperties` element from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: The `Pet` schema sees its `additionalProperties` attribute removed in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "Pet": { 13 | "type": "object", 14 | "properties": { 15 | "name": { 16 | "type": "string" 17 | }, 18 | "petType": { 19 | "readOnly": true, 20 | "type": "string" 21 | } 22 | }, 23 | "additionalProperties": { 24 | "type": "string" 25 | } 26 | } 27 | } 28 | ``` 29 | 30 | New specification 31 | ```json5 32 | { 33 | "Pet": { 34 | "type": "object", 35 | "properties": { 36 | "name": { 37 | "type": "string" 38 | }, 39 | "petType": { 40 | "readOnly": true, 41 | "type": "string" 42 | } 43 | } 44 | } 45 | } 46 | ``` 47 | -------------------------------------------------------------------------------- /documentation/rules/1023.md: -------------------------------------------------------------------------------- 1 | ### 1023 - TypeFormatChanged 2 | 3 | **Description**: Checks whether any existing property's [format](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#dataTypeFormat) element has changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change except when widening integer("int32" -> "int64") in request and narrowing integer ("int64" -> "int32") in response. 6 | 7 | **Example**: Property `a` of the `Category` schema changed format from `int64` to `int32` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "Category": { 13 | "properties": { 14 | "a": { 15 | "type": "integer", 16 | "description": "Property a.", 17 | "format": "int64" 18 | } 19 | } 20 | } 21 | } 22 | ``` 23 | 24 | New specification 25 | ```json5 26 | { 27 | "Category": { 28 | "properties": { 29 | "a": { 30 | "type": "integer", 31 | "description": "Property a.", 32 | "format": "int32" 33 | } 34 | } 35 | } 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /documentation/rules/1024.md: -------------------------------------------------------------------------------- 1 | ### 1024 - ConstraintIsStronger 2 | 3 | **Description**: Checks whether any constraining in requests like `maximum`, `minimum`, `minLength`, `maxLength` etc. has been stronger from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Value of `maximum` element of parameter `code` is changed from `500` to `400` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "components": { 13 | "schemas": { 14 | "ErrorModel": { 15 | "type": "object", 16 | "properties": { 17 | "message": { 18 | "type": "string" 19 | }, 20 | "code": { 21 | "type": "integer", 22 | "minimum": 100, 23 | "maximum": 500 24 | } 25 | } 26 | } 27 | } 28 | } 29 | } 30 | ``` 31 | 32 | New specification 33 | ```json5 34 | { 35 | "components": { 36 | "schemas": { 37 | "ErrorModel": { 38 | "type": "object", 39 | "properties": { 40 | "message": { 41 | "type": "string" 42 | }, 43 | "code": { 44 | "type": "integer", 45 | "minimum": 100, 46 | "maximum": 500 47 | } 48 | } 49 | } 50 | } 51 | } 52 | } 53 | ``` 54 | -------------------------------------------------------------------------------- /documentation/rules/1025.md: -------------------------------------------------------------------------------- 1 | ### 1025 - RequiredStatusChange 2 | 3 | **Description**: Checks whether an existing property's `required` status is changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: `required` status for parameter `b` is changed from `false` to `true`. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets/{id}": { 14 | "get": { 15 | ... 16 | "parameters": [ 17 | { 18 | "name": "a", 19 | "in": "path", 20 | "required": true, 21 | "type": "string" 22 | }, 23 | { 24 | "name": "b", 25 | "in": "query", 26 | "required": false, 27 | "type": "string" 28 | } 29 | ] 30 | } 31 | } 32 | ... 33 | } 34 | ``` 35 | 36 | New specification 37 | ```json5 38 | { 39 | "paths": { 40 | "/pets/{id}": { 41 | "get": { 42 | ... 43 | "parameters": [ 44 | { 45 | "name": "a", 46 | "in": "path", 47 | "required": true, 48 | "type": "string" 49 | }, 50 | { 51 | "name": "b", 52 | "in": "query", 53 | "required": true, 54 | "type": "string" 55 | } 56 | ] 57 | } 58 | } 59 | } 60 | ``` 61 | -------------------------------------------------------------------------------- /documentation/rules/1026.md: -------------------------------------------------------------------------------- 1 | ### 1026 - TypeChanged 2 | 3 | **Description**: Checks whether an existing property has changed the type from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: The `petType` attribute in `Pet` schema is being changed from `string` to `integer` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "Pet": { 13 | "type": "object", 14 | "properties": { 15 | "name": { 16 | "type": "string" 17 | }, 18 | "petType": { 19 | "readOnly": true, 20 | "type": "string" 21 | } 22 | } 23 | } 24 | } 25 | ``` 26 | 27 | New specification 28 | ```json5 29 | { 30 | "Pet": { 31 | "type": "object", 32 | "properties": { 33 | "name": { 34 | "type": "string" 35 | }, 36 | "petType": { 37 | "readOnly": true, 38 | "type": "integer" 39 | } 40 | } 41 | } 42 | } 43 | ``` 44 | -------------------------------------------------------------------------------- /documentation/rules/1028.md: -------------------------------------------------------------------------------- 1 | ### 1028 - ParameterStyleChanged 2 | 3 | **Description**: Checks whether parameter's `style` property has changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Value of `style` property of parameter `token` changed from `simple` to `label` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "token": { 13 | "name": "token", 14 | "in": "header", 15 | "description": "token to be passed as a header", 16 | "required": true, 17 | "schema": { 18 | "type": "array", 19 | "items": { 20 | "type": "integer", 21 | "format": "int64" 22 | } 23 | }, 24 | "style": "simple" 25 | } 26 | } 27 | ``` 28 | 29 | New specification 30 | ```json5 31 | { 32 | "token": { 33 | "name": "token", 34 | "in": "header", 35 | "description": "token to be passed as a header", 36 | "required": true, 37 | "schema": { 38 | "type": "array", 39 | "items": { 40 | "type": "integer", 41 | "format": "int64" 42 | } 43 | }, 44 | "style": "label" 45 | } 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /documentation/rules/1029.md: -------------------------------------------------------------------------------- 1 | ### 1029 - ReadonlyPropertyChanged 2 | 3 | **Description**: Checks whether property's readOnly has changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Attribute readOnly of property `name` added in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "type": "object", 13 | "required": [ 14 | "name" 15 | ], 16 | "properties": { 17 | "name": { 18 | "type": "string", 19 | "readOnly": false 20 | }, 21 | "address": { 22 | "$ref": "#/definitions/Address" 23 | }, 24 | "age": { 25 | "type": "integer", 26 | "format": "int32", 27 | "minimum": 0 28 | } 29 | } 30 | } 31 | ``` 32 | 33 | New specification 34 | ```json5 35 | { 36 | "type": "object", 37 | "required": [ 38 | "name" 39 | ], 40 | "properties": { 41 | "name": { 42 | "type": "string", 43 | "readOnly": true 44 | }, 45 | "address": { 46 | "$ref": "#/definitions/Address" 47 | }, 48 | "age": { 49 | "type": "integer", 50 | "format": "int32", 51 | "minimum": 0 52 | } 53 | } 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /documentation/rules/1030.md: -------------------------------------------------------------------------------- 1 | ### 1030 - DifferentDiscriminator 2 | 3 | **Description**: Checks whether value of `discriminator`'s `propertyName` has changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Value of `discriminator`'s `propertyName` property changed from `petType` to `name` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "type": "object", 13 | "discriminator": { 14 | "propertyName": "petType" 15 | }, 16 | "properties": { 17 | "name": { 18 | "type": "string" 19 | }, 20 | "petType": { 21 | "type": "string" 22 | } 23 | }, 24 | "required": [ 25 | "name", 26 | "petType" 27 | ] 28 | } 29 | ``` 30 | 31 | New specification 32 | ```json5 33 | { 34 | "type": "object", 35 | "discriminator": { 36 | "propertyName": "name" 37 | }, 38 | "properties": { 39 | "name": { 40 | "type": "string" 41 | }, 42 | "petType": { 43 | "type": "string" 44 | } 45 | }, 46 | "required": [ 47 | "name", 48 | "petType" 49 | ] 50 | } 51 | ``` 52 | -------------------------------------------------------------------------------- /documentation/rules/1033.md: -------------------------------------------------------------------------------- 1 | ### 1033 - RemovedProperty 2 | 3 | **Description**: Checks whether an existing property is removed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Property `name` of schema `Person` is removed in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "Person": { 13 | "type": "object", 14 | "properties": { 15 | "id": { 16 | "type": "integer", 17 | "format": "int32", 18 | "xml": { 19 | "attribute": true 20 | } 21 | }, 22 | "name": { 23 | "type": "string", 24 | "xml": { 25 | "namespace": "http://example.com/schema/sample", 26 | "prefix": "sample" 27 | } 28 | } 29 | } 30 | } 31 | } 32 | ``` 33 | 34 | New specification 35 | ```json5 36 | { 37 | "Person": { 38 | "type": "object", 39 | "properties": { 40 | "id": { 41 | "type": "integer", 42 | "format": "int32", 43 | "xml": { 44 | "attribute": true 45 | } 46 | } 47 | } 48 | } 49 | } 50 | ``` 51 | -------------------------------------------------------------------------------- /documentation/rules/1034.md: -------------------------------------------------------------------------------- 1 | ### 1034 - AddedRequiredProperty 2 | 3 | **Description**: Checks whether a new required property is added from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Required property `name` of schema `Person` is added in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "Person": { 13 | "type": "object", 14 | "properties": { 15 | "id": { 16 | "type": "integer", 17 | "format": "int32", 18 | "xml": { 19 | "attribute": true 20 | } 21 | } 22 | } 23 | } 24 | } 25 | ``` 26 | 27 | New specification 28 | ```json5 29 | { 30 | "Person": { 31 | "type": "object", 32 | "properties": { 33 | "id": { 34 | "type": "integer", 35 | "format": "int32", 36 | "xml": { 37 | "attribute": true 38 | } 39 | }, 40 | "name": { 41 | "type": "string", 42 | "required": true, 43 | "xml": { 44 | "namespace": "http://example.com/schema/sample", 45 | "prefix": "sample" 46 | } 47 | } 48 | } 49 | } 50 | } 51 | ``` 52 | -------------------------------------------------------------------------------- /documentation/rules/1035.md: -------------------------------------------------------------------------------- 1 | ### 1035 - RemovedOperation 2 | 3 | **Description**: Checks whether an existing operation from a path is removed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Operation `post` from Path `/pets` is removed in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | ... 16 | }, 17 | "post": { 18 | ... 19 | } 20 | } 21 | } 22 | } 23 | ``` 24 | 25 | New specification 26 | ```json5 27 | { 28 | "paths": { 29 | "/pets": { 30 | "get": { 31 | ... 32 | } 33 | } 34 | } 35 | } 36 | ``` 37 | -------------------------------------------------------------------------------- /documentation/rules/1037.md: -------------------------------------------------------------------------------- 1 | ### 1037 - ConstraintIsWeaker 2 | 3 | **Description**: Checks whether any constraining in responses like `maximum`, `minimum`, `minLength`, `maxLength` etc. has been weaker from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Value of `maximum` element of property `code` is changed from `500` to `600` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "components": { 13 | "schemas": { 14 | "ErrorModel": { 15 | "type": "object", 16 | "properties": { 17 | "message": { 18 | "type": "string" 19 | }, 20 | "code": { 21 | "type": "integer", 22 | "minimum": 100, 23 | "maximum": 500 24 | } 25 | } 26 | } 27 | } 28 | } 29 | } 30 | ``` 31 | 32 | New specification 33 | ```json5 34 | { 35 | "components": { 36 | "schemas": { 37 | "ErrorModel": { 38 | "type": "object", 39 | "properties": { 40 | "message": { 41 | "type": "string" 42 | }, 43 | "code": { 44 | "type": "integer", 45 | "minimum": 100, 46 | "maximum": 600 47 | } 48 | } 49 | } 50 | } 51 | } 52 | } 53 | ``` 54 | -------------------------------------------------------------------------------- /documentation/rules/1038.md: -------------------------------------------------------------------------------- 1 | ### 1038 - AddedPath 2 | 3 | **Description**: Checks whether a new path is added from the previous specification. 4 | 5 | **Cause**: This is considered an additive change. 6 | 7 | **Example**: New path `/pets/{id}` is being added in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | ... 16 | }, 17 | "post": { 18 | ... 19 | } 20 | } 21 | } 22 | } 23 | ``` 24 | 25 | New specification 26 | ```json5 27 | { 28 | "paths": { 29 | "/pets": { 30 | "get": { 31 | ... 32 | }, 33 | "post": { 34 | ... 35 | } 36 | }, 37 | "/pets/{id}": { 38 | "get": { 39 | ... 40 | } 41 | } 42 | } 43 | } 44 | ``` 45 | -------------------------------------------------------------------------------- /documentation/rules/1039.md: -------------------------------------------------------------------------------- 1 | ### 1039 - AddedOperation 2 | 3 | **Description**: Checks whether a new operation in an existing path is added from the previous specification. 4 | 5 | **Cause**: This is considered an additive change. 6 | 7 | **Example**: Operation `post` in Path `/pets` is added in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | "/pets": { 14 | "get": { 15 | ... 16 | } 17 | } 18 | } 19 | } 20 | ``` 21 | 22 | New specification 23 | ```json5 24 | { 25 | "paths": { 26 | "/pets": { 27 | "get": { 28 | ... 29 | }, 30 | "post": { 31 | ... 32 | } 33 | } 34 | } 35 | } 36 | ``` 37 | -------------------------------------------------------------------------------- /documentation/rules/1041.md: -------------------------------------------------------------------------------- 1 | ### 1041 - AddedPropertyInResponse 2 | 3 | **Description**: Checks whether a property is added to the response model from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Property `petType` is being added into a response model in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths:" { 13 | "/pets/{id}": { 14 | "get": { 15 | ... 16 | "responses": { 17 | "200": { 18 | "schema": { 19 | "type": "object", 20 | "properties": { 21 | "name": { 22 | "type": "string" 23 | } 24 | } 25 | } 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | ``` 33 | 34 | New specification 35 | ```json5 36 | { 37 | "paths:" { 38 | "/pets/{id}": { 39 | "get": { 40 | ... 41 | "responses": { 42 | "200": { 43 | "schema": { 44 | "type": "object", 45 | "properties": { 46 | "name": { 47 | "type": "string" 48 | }, 49 | "petType": { 50 | "type": "string" 51 | } 52 | } 53 | } 54 | } 55 | } 56 | } 57 | } 58 | } 59 | } 60 | ``` 61 | -------------------------------------------------------------------------------- /documentation/rules/1043.md: -------------------------------------------------------------------------------- 1 | ### 1043 - AddedOptionalParameter 2 | 3 | **Description**: Checks whether new optional parameter is introduced from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: New optional parameter `skip` is introduced without revising api-version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "parameters": [ 13 | { 14 | "name": "limit", 15 | "in": "query", 16 | "description": "max records to return", 17 | "required": true, 18 | "schema" : { 19 | "type": "integer", 20 | "format": "int32" 21 | } 22 | } 23 | ] 24 | } 25 | ``` 26 | 27 | New specification 28 | ```json5 29 | { 30 | "parameters": [ 31 | { 32 | "name": "limit", 33 | "in": "query", 34 | "description": "max records to return", 35 | "required": true, 36 | "schema" : { 37 | "type": "integer", 38 | "format": "int32" 39 | } 40 | }, 41 | { 42 | "name": "skip", 43 | "in": "query", 44 | "description": "number of items to skip", 45 | "schema": { 46 | "type": "integer", 47 | "format": "int32" 48 | } 49 | } 50 | ] 51 | } 52 | ``` 53 | -------------------------------------------------------------------------------- /documentation/rules/1044.md: -------------------------------------------------------------------------------- 1 | ### 1044 - XmsLongRunningOperationChanged 2 | 3 | **Description**: Checks whether any operation's 'x-ms-long-running-operation' has changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: The `x-ms-long-running-operation` is changed from `false` to `true` in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "paths": { 13 | ... 14 | "put": { 15 | "x-ms-long-running-operation": false, 16 | ... 17 | ``` 18 | 19 | New specification 20 | ```json5 21 | { 22 | "paths": { 23 | ... 24 | "put": { 25 | "x-ms-long-running-operation": true, 26 | ... 27 | ``` 28 | -------------------------------------------------------------------------------- /documentation/rules/2000.md: -------------------------------------------------------------------------------- 1 | ### 2000 - NullablePropertyChanged 2 | 3 | **Description**: Checks if a property's nullability has changed from the previous specification. 4 | 5 | **Cause**: This is considered a breaking change. 6 | 7 | **Example**: Attribute nullable of property `name` added in the new version. 8 | 9 | Old specification 10 | ```json5 11 | { 12 | "type": "object", 13 | "required": [ 14 | "name" 15 | ], 16 | "properties": { 17 | "name": { 18 | "type": "string", 19 | "nullable": false 20 | }, 21 | "address": { 22 | "$ref": "#/definitions/Address" 23 | }, 24 | "age": { 25 | "type": "integer", 26 | "format": "int32", 27 | "minimum": 0 28 | } 29 | } 30 | } 31 | ``` 32 | 33 | New specification 34 | ```json5 35 | { 36 | "type": "object", 37 | "required": [ 38 | "name" 39 | ], 40 | "properties": { 41 | "name": { 42 | "type": "string", 43 | "nullable": true 44 | }, 45 | "address": { 46 | "$ref": "#/definitions/Address" 47 | }, 48 | "age": { 49 | "type": "integer", 50 | "format": "int32", 51 | "minimum": 0 52 | } 53 | } 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /prepare_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Run from the root of the repository, with target version to prepare as argument 3 | _version=$1 4 | 5 | echo "Updating .csproj..." 6 | for csproj in ./src/**/*.csproj; do 7 | echo "${csproj}" 8 | sed -i "s@[0-9\.]\+@${_version}@g" "${csproj}" 9 | done 10 | 11 | git add ./src/**/*.csproj && \ 12 | git commit -v --edit -m "Bump to ${_version}" && \ 13 | git tag "v${_version}" && \ 14 | echo "Tagging version: 'v${_version}'" 15 | git push origin main --tags -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Criteo.OpenApi.Comparator.UTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net6;net8; 4 | false 5 | Criteo.OpenApi.Comparator.UTest 6 | 1591 7 | 8 | 9 | 10 | Always 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version adds an 'additionalProperties' element.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/additionalProperties", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/200/content/application~1json/schema/additionalProperties", 7 | "OldJsonPath": "#/components/schemas/Pet/additionalProperties", 8 | "NewJsonPath": "#/components/schemas/Pet/additionalProperties", 9 | "Id": 1021, 10 | "Code": "AddedAdditionalProperties", 11 | "Mode": "Addition" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | get: 10 | responses: 11 | "200": 12 | content: 13 | application/json: 14 | schema: 15 | $ref: '#/components/schemas/Pet' 16 | components: 17 | schemas: 18 | Pet: 19 | type: object 20 | discriminator: 21 | propertyName: petType 22 | properties: 23 | name: 24 | type: string 25 | petType: 26 | type: string 27 | enum: 28 | - cat 29 | - dot 30 | - bird 31 | additionalProperties: 32 | type: string 33 | required: 34 | - name 35 | - petType 36 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_additional_properties/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | get: 10 | responses: 11 | "200": 12 | content: 13 | application/json: 14 | schema: 15 | $ref: '#/components/schemas/Pet' 16 | components: 17 | schemas: 18 | Pet: 19 | type: object 20 | discriminator: 21 | propertyName: petType 22 | properties: 23 | name: 24 | type: string 25 | petType: 26 | type: string 27 | enum: 28 | - cat 29 | - dot 30 | - bird 31 | required: 32 | - name 33 | - petType 34 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The new version adds a required header \u0027x-d\u0027.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 7 | "OldJsonPath": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 8 | "NewJsonPath": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 9 | "Id": 1013, 10 | "Code": "AddingHeader", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version adds a required header \u0027x-c\u0027.", 16 | "OldJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 17 | "NewJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 18 | "OldJsonPath": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 19 | "NewJsonPath": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 20 | "Id": 1013, 21 | "Code": "AddingHeader", 22 | "Mode": "Addition" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_03 4 | version: "2.0" 5 | paths: 6 | /api/Parameters: 7 | get: 8 | operationId: Responses_Get 9 | responses: 10 | "200": 11 | description: dummy response 12 | content: 13 | application/json: 14 | schema: 15 | type: integer 16 | headers: 17 | x-d: {} 18 | /api/Responses: 19 | get: 20 | operationId: Responses_Get 21 | responses: 22 | "200": 23 | description: null 24 | headers: 25 | x-a: {} 26 | x-b: {} 27 | x-c: {} 28 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_header/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_03 4 | version: "1.0" 5 | paths: 6 | /api/Parameters: 7 | get: 8 | operationId: Responses_Get 9 | responses: 10 | "200": 11 | description: dummy response 12 | content: 13 | application/json: 14 | schema: 15 | type: integer 16 | /api/Responses: 17 | get: 18 | operationId: Responses_Get 19 | responses: 20 | "200": 21 | description: null 22 | headers: 23 | x-a: {} 24 | x-b: {} 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The new version is adding an operation that was not found in the old version.", 5 | "OldJsonRef": "#/paths/~1api~1Paths/post", 6 | "NewJsonRef": "#/paths/~1api~1Paths/post", 7 | "OldJsonPath": "#/paths/~1api~1Paths/post", 8 | "NewJsonPath": "#/paths/~1api~1Paths/post", 9 | "Id": 1039, 10 | "Code": "AddedOperation", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version is adding an operation that was not found in the old version.", 16 | "OldJsonRef": "#/paths/~1api~1Operations/head", 17 | "NewJsonRef": "#/paths/~1api~1Operations/head", 18 | "OldJsonPath": "#/paths/~1api~1Operations/head", 19 | "NewJsonPath": "#/paths/~1api~1Operations/head", 20 | "Id": 1039, 21 | "Code": "AddedOperation", 22 | "Mode": "Addition" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: removed_path 4 | version: "2.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | post: 11 | operationId: Paths_Post 12 | responses: {} 13 | /api/Operations: 14 | get: 15 | operationId: Operations_Get 16 | responses: {} 17 | post: 18 | operationId: Operations_Post 19 | responses: {} 20 | head: 21 | operationId: Operations_Head 22 | responses: {} 23 | /api/Parameters/{a}: 24 | get: 25 | operationId: Parameters_Get 26 | responses: {} 27 | /api/Responses: 28 | get: 29 | operationId: Responses_Get 30 | responses: 31 | "200": 32 | description: null 33 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_operation/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: removed_path 4 | version: "1.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: {} 17 | /api/Parameters/{a}: 18 | get: 19 | operationId: Parameters_Get 20 | responses: {} 21 | /api/Responses: 22 | get: 23 | operationId: Responses_Get 24 | responses: 25 | "200": 26 | description: null 27 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The optional parameter \u0027limitParam\u0027 was added in the new version.", 5 | "OldJsonRef": null, 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1", 7 | "OldJsonPath": null, 8 | "NewJsonPath": "#/paths/~1api~1Parameters/put/parameters/1", 9 | "Id": 1043, 10 | "Code": "AddingOptionalParameter", 11 | "Mode": "Addition" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | schema: 24 | type: integer 25 | format: int32 26 | limitParam: 27 | name: limitParam 28 | in: query 29 | description: max records to return 30 | schema: 31 | type: integer 32 | format: int32 33 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_parameter/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | components: 17 | parameters: 18 | skipParam: 19 | name: skipParam 20 | in: query 21 | description: number of items to skip 22 | schema: 23 | type: integer 24 | format: int32 25 | limitParam: 26 | name: limitParam 27 | in: query 28 | description: max records to return 29 | schema: 30 | type: integer 31 | format: int32 32 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version has a new optional property \u0027message\u0027 that was not found in the old version.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/properties/message", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/schema/properties/message", 7 | "OldJsonPath": "#/components/parameters/skipParam/schema/properties/message", 8 | "NewJsonPath": "#/components/parameters/skipParam/schema/properties/message", 9 | "Id": 1045, 10 | "Code": "AddedOptionalProperty", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version has a new optional property \u0027end\u0027 that was not found in the old version.", 16 | "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/end", 17 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/schema/properties/end", 18 | "OldJsonPath": "#/components/parameters/limitParam/schema/properties/end", 19 | "NewJsonPath": "#/components/parameters/limitParam/schema/properties/end", 20 | "Id": 1045, 21 | "Code": "AddedOptionalProperty", 22 | "Mode": "Addition" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: object 26 | properties: 27 | error: 28 | type: string 29 | message: 30 | type: string 31 | limitParam: 32 | name: limitParam 33 | in: query 34 | description: max records to return 35 | required: true 36 | schema: 37 | type: object 38 | properties: 39 | begin: 40 | type: integer 41 | end: 42 | type: integer 43 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_optional_property/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: object 26 | properties: 27 | error: 28 | type: string 29 | limitParam: 30 | name: limitParam 31 | in: query 32 | description: max records to return 33 | required: true 34 | schema: 35 | type: object 36 | properties: 37 | begin: 38 | type: integer 39 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The new version is adding a path that was not found in the old version.", 5 | "OldJsonRef": null, 6 | "NewJsonRef": "#/paths/~1api~1Paths", 7 | "OldJsonPath": null, 8 | "NewJsonPath": "#/paths/~1api~1Paths", 9 | "Id": 1038, 10 | "Code": "AddedPath", 11 | "Mode": "Addition" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: added_path 4 | version: "2.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_path/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: added_path 4 | version: "1.0" 5 | paths: 6 | /api/Operations: 7 | get: 8 | operationId: Operations_Get 9 | responses: {} 10 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is adding a requestBody that was not found in the old version.", 5 | "OldJsonRef": "#/paths/~1pets/post/requestBody", 6 | "NewJsonRef": "#/paths/~1pets/post/requestBody", 7 | "OldJsonPath": "#/paths/~1pets/post/requestBody", 8 | "NewJsonPath": "#/paths/~1pets/post/requestBody", 9 | "Id": 1046, 10 | "Code": "AddedRequestBody", 11 | "Mode": "Addition" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_request_body/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "2.0" 5 | paths: 6 | /pets: 7 | post: 8 | description: Post multiple pets 9 | responses: 10 | "200": 11 | content: 12 | text/plain: 13 | schema: 14 | type: integer 15 | /pets/{id}: 16 | post: 17 | description: Post one pet according to its id 18 | requestBody: 19 | $ref: '#/components/requestBodies/PetBody' 20 | responses: 21 | "200": 22 | content: 23 | text/plain: 24 | schema: 25 | type: integer 26 | components: 27 | schemas: 28 | Pet: 29 | type: object 30 | properties: 31 | name: 32 | type: string 33 | petType: 34 | type: string 35 | enum: 36 | - cat 37 | - dog 38 | requestBodies: 39 | PetBody: 40 | content: 41 | application/json: 42 | schema: 43 | $ref: '#/components/schema/Pet' 44 | application/xml: 45 | schema: 46 | type: string 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The required parameter \u0027limitParam\u0027 was added in the new version.", 5 | "OldJsonRef": null, 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1", 7 | "OldJsonPath": null, 8 | "NewJsonPath": "#/paths/~1api~1Parameters/put/parameters/1", 9 | "Id": 1010, 10 | "Code": "AddingRequiredParameter", 11 | "Mode": "Addition" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: query 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: integer 34 | format: int32 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_parameter/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | components: 17 | parameters: 18 | skipParam: 19 | name: skipParam 20 | in: query 21 | description: number of items to skip 22 | required: true 23 | schema: 24 | type: integer 25 | format: int32 26 | limitParam: 27 | name: limitParam 28 | in: query 29 | description: max records to return 30 | required: true 31 | schema: 32 | type: integer 33 | format: int32 34 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version has new required property 'petType' that was not found in the old version.", 5 | "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items", 6 | "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items", 7 | "OldJsonPath": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items", 8 | "NewJsonPath": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items", 9 | "Id": 1034, 10 | "Code": "AddedRequiredProperty", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version has new required property 'message' that was not found in the old version.", 16 | "OldJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema", 17 | "NewJsonRef": "#/paths/~1pets/get/responses/404/content/application~1json/schema", 18 | "OldJsonPath": "#/paths/~1pets/get/responses/404/content/application~1json/schema", 19 | "NewJsonPath": "#/paths/~1pets/get/responses/404/content/application~1json/schema", 20 | "Id": 1034, 21 | "Code": "AddedRequiredProperty", 22 | "Mode": "Addition" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_required_property/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | version: 2.0.0 4 | title: Swagger PetStore 5 | description: A sample API that uses a petStore as an example to demonstrate features in the OpenAPI 3.0 specification 6 | servers: 7 | - url: http://petstore.swagger.io/api 8 | paths: 9 | /pets: 10 | get: 11 | description: Returns all pets from the system. 12 | operationId: findPets 13 | responses: 14 | "200": 15 | description: pet response 16 | content: 17 | application/json: 18 | schema: 19 | type: array 20 | items: 21 | $ref: '#/components/schemas/Pet' 22 | "404": 23 | description: not found response 24 | content: 25 | application/json: 26 | schema: 27 | type: object 28 | required: 29 | - message 30 | properties: 31 | error: 32 | type: string 33 | message: 34 | type: string 35 | components: 36 | schemas: 37 | Pet: 38 | type: object 39 | required: 40 | - petType 41 | properties: 42 | name: 43 | type: string 44 | petType: 45 | type: string 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version adds a response code \u0027200\u0027.", 5 | "OldJsonRef": "#/paths/~1api~1Operations/post/responses/200", 6 | "NewJsonRef": "#/paths/~1api~1Operations/post/responses/200", 7 | "OldJsonPath": "#/paths/~1api~1Operations/post/responses/200", 8 | "NewJsonPath": "#/paths/~1api~1Operations/post/responses/200", 9 | "Id": 1011, 10 | "Code": "AddingResponseCode", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version adds a response code \u0027202\u0027.", 16 | "OldJsonRef": "#/paths/~1api~1Responses/get/responses/202", 17 | "NewJsonRef": "#/paths/~1api~1Responses/get/responses/202", 18 | "OldJsonPath": "#/paths/~1api~1Responses/get/responses/202", 19 | "NewJsonPath": "#/paths/~1api~1Responses/get/responses/202", 20 | "Id": 1011, 21 | "Code": "AddingResponseCode", 22 | "Mode": "Addition" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_01 4 | version: "2.0" 5 | paths: 6 | /api/Path: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: 17 | "200": 18 | description: null 19 | /api/Parameters/{a}: 20 | get: 21 | operationId: Parameters_Get 22 | responses: {} 23 | /api/Responses: 24 | get: 25 | operationId: Responses_Get 26 | responses: 27 | "200": 28 | description: null 29 | "202": 30 | description: null 31 | "400": 32 | description: null 33 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_response_code/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_01 4 | version: "1.0" 5 | paths: 6 | /api/Path: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: {} 17 | /api/Parameters/{a}: 18 | get: 19 | operationId: Parameters_Get 20 | responses: {} 21 | /api/Responses: 22 | get: 23 | operationId: Responses_Get 24 | responses: 25 | "200": 26 | description: null 27 | "400": 28 | description: null 29 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Error", 4 | "Message": "The new version is adding a new schema that was not found in the old version.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 7 | "OldJsonPath": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 8 | "NewJsonPath": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 9 | "Id": 1048, 10 | "Code": "AddedSchema", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: Added Schema in response 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | put: 10 | tags: 11 | - Parameters 12 | operationId: Parameters_Put 13 | parameters: [] 14 | responses: 15 | "200": 16 | content: 17 | application/json: 18 | schema: 19 | $ref: '#/components/schemas/Pet' 20 | components: 21 | schemas: 22 | Pet: 23 | type: object 24 | discriminator: 25 | propertyName: petType 26 | properties: 27 | name: 28 | type: string 29 | petType: 30 | type: string 31 | enum: 32 | - cat 33 | - dot 34 | required: 35 | - name 36 | - petType 37 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/added_schema_in_response/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: Added Schema in response 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | put: 10 | tags: 11 | - Parameters 12 | operationId: Parameters_Put 13 | parameters: [] 14 | responses: 15 | "200": 16 | content: 17 | application/json: {} 18 | components: 19 | schemas: 20 | Pet: 21 | type: object 22 | discriminator: 23 | propertyName: petType 24 | properties: 25 | name: 26 | type: string 27 | petType: 28 | type: string 29 | enum: 30 | - cat 31 | - dot 32 | required: 33 | - name 34 | - petType 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The order of parameter \u0027skipParam\u0027 was changed. ", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters", 7 | "OldJsonPath": "#/paths/~1api~1Parameters/put/parameters", 8 | "NewJsonPath": "#/paths/~1api~1Parameters/put/parameters", 9 | "Id": 1042, 10 | "Code": "ChangedParameterOrder", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The order of parameter \u0027limitParam\u0027 was changed. ", 16 | "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters", 17 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters", 18 | "OldJsonPath": "#/paths/~1api~1Parameters/put/parameters", 19 | "NewJsonPath": "#/paths/~1api~1Parameters/put/parameters", 20 | "Id": 1042, 21 | "Code": "ChangedParameterOrder", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: query 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: integer 34 | format: int32 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/changed_parameter_order/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/limitParam' 16 | - $ref: '#/components/parameters/skipParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: query 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: integer 34 | format: int32 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: query 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: string 34 | enum: 35 | - clueless 36 | - lazy 37 | - adventurous 38 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/constant_status_has_changed/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: query 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: string 34 | enum: 35 | - clueless 36 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /pets: 10 | get: 11 | parameters: 12 | - $ref: '#/components/parameters/limitParam' 13 | responses: 14 | "200": 15 | content: 16 | application/json: 17 | schema: 18 | type: object 19 | properties: 20 | maxRequest: 21 | type: integer 22 | multipleOf: 200 23 | components: 24 | schemas: 25 | limitParam: 26 | type: object 27 | properties: 28 | accessKey: 29 | type: string 30 | pattern: ^\d{3}-\d{2}-\d{4}$ 31 | redirectUrl: 32 | type: array 33 | items: 34 | type: string 35 | constrainsItems: 36 | type: string 37 | enum: 38 | - item1 39 | - item2 40 | - item4 41 | parameters: 42 | limitParam: 43 | name: limit 44 | in: query 45 | required: true 46 | schema: 47 | $ref: '#/components/schemas/limitParam' 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/constraint_changed/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /pets: 10 | get: 11 | parameters: 12 | - $ref: '#/components/parameters/limitParam' 13 | responses: 14 | "200": 15 | content: 16 | application/json: 17 | schema: 18 | type: object 19 | properties: 20 | maxRequest: 21 | type: integer 22 | multipleOf: 100 23 | components: 24 | schemas: 25 | limitParam: 26 | type: object 27 | properties: 28 | accessKey: 29 | type: string 30 | redirectUrl: 31 | type: array 32 | uniqueItems: true 33 | items: 34 | type: string 35 | constrainsItems: 36 | type: string 37 | enum: 38 | - item1 39 | - item2 40 | - item3 41 | parameters: 42 | limitParam: 43 | name: limit 44 | in: query 45 | required: true 46 | schema: 47 | $ref: '#/components/schemas/limitParam' 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/default_value_changed/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version has a different default value than the previous one.", 5 | "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/default", 6 | "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/default", 7 | "OldJsonPath": "#/components/schemas/Pet/properties/name/default", 8 | "NewJsonPath": "#/components/schemas/Pet/properties/name/default", 9 | "Id": 1027, 10 | "Code": "DefaultValueChanged", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version has a different default value than the previous one.", 16 | "OldJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/default", 17 | "NewJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/default", 18 | "OldJsonPath": "#/paths/~1pets/get/responses/default/content/application~1json/schema/default", 19 | "NewJsonPath": "#/paths/~1pets/get/responses/default/content/application~1json/schema/default", 20 | "Id": 1027, 21 | "Code": "DefaultValueChanged", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/body_add.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - zzzzzz 33 | - mno 34 | - pqr 35 | responses: 36 | "200": 37 | description: Successful Response 38 | content: 39 | application/json: 40 | schema: 41 | properties: 42 | bar: 43 | type: string 44 | enum: 45 | - stu 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/body_remove.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - pqr 33 | responses: 34 | "200": 35 | description: Successful Response 36 | content: 37 | application/json: 38 | schema: 39 | properties: 40 | bar: 41 | type: string 42 | enum: 43 | - stu 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/both_ref_add.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - zzzzzz 48 | - mno 49 | - pqr 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/both_ref_remove.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - pqr 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/path_add.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - zzzzzz 17 | - def 18 | - name: query 19 | in: query 20 | schema: 21 | type: string 22 | enum: 23 | - ghi 24 | - jkl 25 | requestBody: 26 | content: 27 | application/json: 28 | schema: 29 | properties: 30 | foo: 31 | type: string 32 | enum: 33 | - mno 34 | - pqr 35 | responses: 36 | "200": 37 | description: Successful Response 38 | content: 39 | application/json: 40 | schema: 41 | properties: 42 | bar: 43 | type: string 44 | enum: 45 | - stu 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/path_remove.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - name: query 17 | in: query 18 | schema: 19 | type: string 20 | enum: 21 | - ghi 22 | - jkl 23 | requestBody: 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | type: string 30 | enum: 31 | - mno 32 | - pqr 33 | responses: 34 | "200": 35 | description: Successful Response 36 | content: 37 | application/json: 38 | schema: 39 | properties: 40 | bar: 41 | type: string 42 | enum: 43 | - stu 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/query_add.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | - zzzzzz 25 | requestBody: 26 | content: 27 | application/json: 28 | schema: 29 | properties: 30 | foo: 31 | type: string 32 | enum: 33 | - mno 34 | - pqr 35 | responses: 36 | "200": 37 | description: Successful Response 38 | content: 39 | application/json: 40 | schema: 41 | properties: 42 | bar: 43 | type: string 44 | enum: 45 | - stu 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/query_remove.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - jkl 23 | requestBody: 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | type: string 30 | enum: 31 | - mno 32 | - pqr 33 | responses: 34 | "200": 35 | description: Successful Response 36 | content: 37 | application/json: 38 | schema: 39 | properties: 40 | bar: 41 | type: string 42 | enum: 43 | - stu 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/request_ref_add.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - zzzzzz 39 | - def 40 | ResponseOnlyEnum: 41 | type: string 42 | enum: 43 | - ghi 44 | - jkl 45 | RequestResponseEnum: 46 | type: string 47 | enum: 48 | - mno 49 | - pqr 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/request_ref_remove.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | ResponseOnlyEnum: 39 | type: string 40 | enum: 41 | - ghi 42 | - jkl 43 | RequestResponseEnum: 44 | type: string 45 | enum: 46 | - mno 47 | - pqr 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/response_add.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - zzzzzz 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/response_ref_add.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | - zzzzzz 45 | RequestResponseEnum: 46 | type: string 47 | enum: 48 | - mno 49 | - pqr 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/response_ref_remove.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - jkl 43 | RequestResponseEnum: 44 | type: string 45 | enum: 46 | - mno 47 | - pqr 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction/response_remove.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - zzzzzz 33 | - mno 34 | - pqr 35 | responses: 36 | "200": 37 | description: Successful Response 38 | content: 39 | application/json: 40 | schema: 41 | properties: 42 | bar: 43 | type: string 44 | enum: 45 | - stu 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_add/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - pqr 33 | responses: 34 | "200": 35 | description: Successful Response 36 | content: 37 | application/json: 38 | schema: 39 | properties: 40 | bar: 41 | type: string 42 | enum: 43 | - stu 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_body_remove/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - zzzzzz 48 | - mno 49 | - pqr 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_add/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: '#/components/schemas/RequestOnlyEnum' 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: '#/components/schemas/RequestResponseEnum' 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: '#/components/schemas/RequestResponseEnum' 30 | bar: 31 | $ref: '#/components/schemas/ResponseOnlyEnum' 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - mno 48 | - pqr 49 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - pqr 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_both_ref_remove/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: '#/components/schemas/RequestOnlyEnum' 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: '#/components/schemas/RequestResponseEnum' 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: '#/components/schemas/RequestResponseEnum' 30 | bar: 31 | $ref: '#/components/schemas/ResponseOnlyEnum' 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - mno 48 | - pqr 49 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is adding enum value(s) \u0027zzzzzz\u0027 from the old version.", 5 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 6 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 7 | "OldJsonPath": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 8 | "NewJsonPath": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 9 | "Id": 1020, 10 | "Code": "AddedEnumValue", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 17 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 18 | "OldJsonPath": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 19 | "NewJsonPath": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 20 | "Id": 1037, 21 | "Code": "ConstraintIsWeaker", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - zzzzzz 17 | - def 18 | - name: query 19 | in: query 20 | schema: 21 | type: string 22 | enum: 23 | - ghi 24 | - jkl 25 | requestBody: 26 | content: 27 | application/json: 28 | schema: 29 | properties: 30 | foo: 31 | type: string 32 | enum: 33 | - mno 34 | - pqr 35 | responses: 36 | "200": 37 | description: Successful Response 38 | content: 39 | application/json: 40 | schema: 41 | properties: 42 | bar: 43 | type: string 44 | enum: 45 | - stu 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_add/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - name: query 17 | in: query 18 | schema: 19 | type: string 20 | enum: 21 | - ghi 22 | - jkl 23 | requestBody: 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | type: string 30 | enum: 31 | - mno 32 | - pqr 33 | responses: 34 | "200": 35 | description: Successful Response 36 | content: 37 | application/json: 38 | schema: 39 | properties: 40 | bar: 41 | type: string 42 | enum: 43 | - stu 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_path_remove/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is adding enum value(s) \u0027zzzzzz\u0027 from the old version.", 5 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 6 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 7 | "OldJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 8 | "NewJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 9 | "Id": 1020, 10 | "Code": "AddedEnumValue", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 17 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 18 | "OldJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 19 | "NewJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 20 | "Id": 1037, 21 | "Code": "ConstraintIsWeaker", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | - zzzzzz 25 | requestBody: 26 | content: 27 | application/json: 28 | schema: 29 | properties: 30 | foo: 31 | type: string 32 | enum: 33 | - mno 34 | - pqr 35 | responses: 36 | "200": 37 | description: Successful Response 38 | content: 39 | application/json: 40 | schema: 41 | properties: 42 | bar: 43 | type: string 44 | enum: 45 | - stu 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_add/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is removing enum value(s) \u0027ghi\u0027 from the old version.", 5 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 6 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 7 | "OldJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 8 | "NewJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 9 | "Id": 1019, 10 | "Code": "RemovedEnumValue", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 17 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 18 | "OldJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 19 | "NewJsonPath": "#/paths/~1order~1{path}/post/parameters/1/schema/enum", 20 | "Id": 1024, 21 | "Code": "ConstraintIsStronger", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - jkl 23 | requestBody: 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | type: string 30 | enum: 31 | - mno 32 | - pqr 33 | responses: 34 | "200": 35 | description: Successful Response 36 | content: 37 | application/json: 38 | schema: 39 | properties: 40 | bar: 41 | type: string 42 | enum: 43 | - stu 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_query_remove/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is adding enum value(s) \u0027zzzzzz\u0027 from the old version.", 5 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 6 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 7 | "OldJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 8 | "NewJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 9 | "Id": 1020, 10 | "Code": "AddedEnumValue", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 17 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 18 | "OldJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 19 | "NewJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 20 | "Id": 1037, 21 | "Code": "ConstraintIsWeaker", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - zzzzzz 39 | - def 40 | ResponseOnlyEnum: 41 | type: string 42 | enum: 43 | - ghi 44 | - jkl 45 | RequestResponseEnum: 46 | type: string 47 | enum: 48 | - mno 49 | - pqr 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_add/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: '#/components/schemas/RequestOnlyEnum' 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: '#/components/schemas/RequestResponseEnum' 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: '#/components/schemas/RequestResponseEnum' 30 | bar: 31 | $ref: '#/components/schemas/ResponseOnlyEnum' 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - mno 48 | - pqr 49 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is removing enum value(s) \u0027def\u0027 from the old version.", 5 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 6 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 7 | "OldJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 8 | "NewJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 9 | "Id": 1019, 10 | "Code": "RemovedEnumValue", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 17 | "NewJsonRef": "#/paths/~1order~1{path}/post/parameters/0/schema/enum", 18 | "OldJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 19 | "NewJsonPath": "#/components/schemas/RequestOnlyEnum/enum", 20 | "Id": 1024, 21 | "Code": "ConstraintIsStronger", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | ResponseOnlyEnum: 39 | type: string 40 | enum: 41 | - ghi 42 | - jkl 43 | RequestResponseEnum: 44 | type: string 45 | enum: 46 | - mno 47 | - pqr 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_request_ref_remove/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: '#/components/schemas/RequestOnlyEnum' 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: '#/components/schemas/RequestResponseEnum' 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: '#/components/schemas/RequestResponseEnum' 30 | bar: 31 | $ref: '#/components/schemas/ResponseOnlyEnum' 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - mno 48 | - pqr 49 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - zzzzzz 46 | - vwx 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_add/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is adding enum value(s) \u0027zzzzzz\u0027 from the old version.", 5 | "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 6 | "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 7 | "OldJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 8 | "NewJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 9 | "Id": 1020, 10 | "Code": "AddedEnumValue", 11 | "Mode": "Addition" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version has a less constraining \u0027enum\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 17 | "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 18 | "OldJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 19 | "NewJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 20 | "Id": 1037, 21 | "Code": "ConstraintIsWeaker", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | - zzzzzz 45 | RequestResponseEnum: 46 | type: string 47 | enum: 48 | - mno 49 | - pqr 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_add/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: '#/components/schemas/RequestOnlyEnum' 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: '#/components/schemas/RequestResponseEnum' 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: '#/components/schemas/RequestResponseEnum' 30 | bar: 31 | $ref: '#/components/schemas/ResponseOnlyEnum' 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - mno 48 | - pqr 49 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is removing enum value(s) \u0027ghi\u0027 from the old version.", 5 | "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 6 | "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 7 | "OldJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 8 | "NewJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 9 | "Id": 1019, 10 | "Code": "RemovedEnumValue", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Info", 15 | "Message": "The new version has a more constraining \u0027enum\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 17 | "NewJsonRef": "#/paths/~1order~1{path}/post/responses/200/content/application~1json/schema/properties/bar/enum", 18 | "OldJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 19 | "NewJsonPath": "#/components/schemas/ResponseOnlyEnum/enum", 20 | "Id": 1024, 21 | "Code": "ConstraintIsStronger", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: "#/components/schemas/RequestOnlyEnum" 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: "#/components/schemas/RequestResponseEnum" 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: "#/components/schemas/RequestResponseEnum" 30 | bar: 31 | $ref: "#/components/schemas/ResponseOnlyEnum" 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - jkl 43 | RequestResponseEnum: 44 | type: string 45 | enum: 46 | - mno 47 | - pqr 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_ref_remove/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | $ref: '#/components/schemas/RequestOnlyEnum' 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | properties: 19 | foo: 20 | $ref: '#/components/schemas/RequestResponseEnum' 21 | responses: 22 | "200": 23 | description: Successful Response 24 | content: 25 | application/json: 26 | schema: 27 | properties: 28 | foo: 29 | $ref: '#/components/schemas/RequestResponseEnum' 30 | bar: 31 | $ref: '#/components/schemas/ResponseOnlyEnum' 32 | components: 33 | schemas: 34 | RequestOnlyEnum: 35 | type: string 36 | enum: 37 | - abc 38 | - def 39 | ResponseOnlyEnum: 40 | type: string 41 | enum: 42 | - ghi 43 | - jkl 44 | RequestResponseEnum: 45 | type: string 46 | enum: 47 | - mno 48 | - pqr 49 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - vwx 45 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/enum_direction_response_remove/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /order/{path}: 7 | post: 8 | parameters: 9 | - name: path 10 | in: path 11 | required: true 12 | schema: 13 | type: string 14 | enum: 15 | - abc 16 | - def 17 | - name: query 18 | in: query 19 | schema: 20 | type: string 21 | enum: 22 | - ghi 23 | - jkl 24 | requestBody: 25 | content: 26 | application/json: 27 | schema: 28 | properties: 29 | foo: 30 | type: string 31 | enum: 32 | - mno 33 | - pqr 34 | responses: 35 | "200": 36 | description: Successful Response 37 | content: 38 | application/json: 39 | schema: 40 | properties: 41 | bar: 42 | type: string 43 | enum: 44 | - stu 45 | - vwx 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/invalid_json_file.txt: -------------------------------------------------------------------------------- 1 | { 2 | "invalid_json" 3 | } -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/issue_49_false_1015_equal_schemas/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The versions have not changed.", 5 | "OldJsonRef": "#/info/version", 6 | "NewJsonRef": "#/info/version", 7 | "OldJsonPath": "#/info/version", 8 | "NewJsonPath": "#/info/version", 9 | "Id": 1001, 10 | "Code": "NoVersionChange", 11 | "Mode": "Update" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/issue_49_false_1015_equal_schemas/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.2" 2 | info: 3 | title: "Api" 4 | version: "1.0.1" 5 | paths: 6 | /example: 7 | get: 8 | parameters: 9 | - name: "access_token" 10 | in: "query" 11 | required: false 12 | schema: 13 | anyOf: 14 | - type: "string" 15 | - type: "null" 16 | title: "Access Token" 17 | - name: "access_token" 18 | in: "header" 19 | required: false 20 | schema: 21 | anyOf: 22 | - type: "string" 23 | - type: "null" 24 | title: "Access Token" 25 | responses: 26 | "200": 27 | description: "Successful Response" -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/issue_49_false_1015_equal_schemas/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.2" 2 | info: 3 | title: "Api" 4 | version: "1.0.0" 5 | paths: 6 | /example: 7 | get: 8 | parameters: 9 | - name: "access_token" 10 | in: "query" 11 | required: false 12 | schema: 13 | anyOf: 14 | - type: "string" 15 | - type: "null" 16 | title: "Access Token" 17 | - name: "access_token" 18 | in: "header" 19 | required: false 20 | schema: 21 | anyOf: 22 | - type: "string" 23 | - type: "null" 24 | title: "Access Token" 25 | responses: 26 | "200": 27 | description: "Successful Response" -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/issue_49_false_1015_out_of_order_parameters/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The versions have not changed.", 5 | "OldJsonRef": "#/info/version", 6 | "NewJsonRef": "#/info/version", 7 | "OldJsonPath": "#/info/version", 8 | "NewJsonPath": "#/info/version", 9 | "Id": 1001, 10 | "Code": "NoVersionChange", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Error", 15 | "Message": "The order of parameter 'access_token' was changed. ", 16 | "OldJsonRef": "#/paths/~1example/get/parameters", 17 | "NewJsonRef": "#/paths/~1example/get/parameters", 18 | "OldJsonPath": "#/paths/~1example/get/parameters", 19 | "NewJsonPath": "#/paths/~1example/get/parameters", 20 | "Id": 1042, 21 | "Code": "ChangedParameterOrder", 22 | "Mode": "Update" 23 | }, 24 | { 25 | "Severity": "Error", 26 | "Message": "The order of parameter 'access_token' was changed. ", 27 | "OldJsonRef": "#/paths/~1example/get/parameters", 28 | "NewJsonRef": "#/paths/~1example/get/parameters", 29 | "OldJsonPath": "#/paths/~1example/get/parameters", 30 | "NewJsonPath": "#/paths/~1example/get/parameters", 31 | "Id": 1042, 32 | "Code": "ChangedParameterOrder", 33 | "Mode": "Update" 34 | } 35 | ] 36 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/issue_49_false_1015_out_of_order_parameters/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.2" 2 | info: 3 | title: "Api" 4 | version: "1.0.1" 5 | paths: 6 | /example: 7 | get: 8 | parameters: 9 | - name: "access_token" 10 | in: "query" 11 | required: false 12 | schema: 13 | anyOf: 14 | - type: "string" 15 | - type: "null" 16 | title: "Access Token" 17 | - name: "access_token" 18 | in: "header" 19 | required: false 20 | schema: 21 | anyOf: 22 | - type: "string" 23 | - type: "null" 24 | title: "Access Token" 25 | responses: 26 | "200": 27 | description: "Successful Response" -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/issue_49_false_1015_out_of_order_parameters/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.2" 2 | info: 3 | title: "Api" 4 | version: "1.0.0" 5 | paths: 6 | /example: 7 | get: 8 | parameters: 9 | - name: "access_token" 10 | in: "header" 11 | required: false 12 | schema: 13 | anyOf: 14 | - type: "string" 15 | - type: "null" 16 | title: "Access Token" 17 | - name: "access_token" 18 | in: "query" 19 | required: false 20 | schema: 21 | anyOf: 22 | - type: "string" 23 | - type: "null" 24 | title: "Access Token" 25 | responses: 26 | "200": 27 | description: "Successful Response" -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version has a different \u0027x-ms-long-running-operation\u0027 value than the previous one.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/get/x-ms-long-running-operation", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/get/x-ms-long-running-operation", 7 | "OldJsonPath": "#/paths/~1api~1Parameters/get/x-ms-long-running-operation", 8 | "NewJsonPath": "#/paths/~1api~1Parameters/get/x-ms-long-running-operation", 9 | "Id": 1044, 10 | "Code": "LongRunningOperationExtensionChanged", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version has a different \u0027x-ms-long-running-operation\u0027 value than the previous one.", 16 | "OldJsonRef": "#/paths/~1api~1Parameters/put/x-ms-long-running-operation", 17 | "NewJsonRef": "#/paths/~1api~1Parameters/put/x-ms-long-running-operation", 18 | "OldJsonPath": "#/paths/~1api~1Parameters/put/x-ms-long-running-operation", 19 | "NewJsonPath": "#/paths/~1api~1Parameters/put/x-ms-long-running-operation", 20 | "Id": 1044, 21 | "Code": "LongRunningOperationExtensionChanged", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: type_changed 4 | version: "2.0" 5 | paths: 6 | /api/Parameters: 7 | get: 8 | operationId: Parameters_Get 9 | responses: {} 10 | put: 11 | operationId: Parameters_Put 12 | parameters: 13 | - name: database 14 | required: true 15 | responses: {} 16 | x-ms-long-running-operation: true 17 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/long_running_operation/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: type_changed 4 | version: "1.0" 5 | paths: 6 | /api/Parameters: 7 | get: 8 | operationId: Parameters_Get 9 | responses: {} 10 | x-ms-long-running-operation: true 11 | put: 12 | operationId: Parameters_Put 13 | parameters: 14 | - name: database 15 | required: true 16 | responses: {} 17 | x-ms-long-running-operation: false 18 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: changed_operation_id 4 | version: "2.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_List 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | responses: {} 16 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/modified_operation_id/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: changed_operation_id 4 | version: "1.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | responses: {} 13 | post: 14 | operationId: Operations_Post 15 | responses: {} 16 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The versions have not changed.", 5 | "OldJsonRef": "#/info/version", 6 | "NewJsonRef": "#/info/version", 7 | "OldJsonPath": "#/info/version", 8 | "NewJsonPath": "#/info/version", 9 | "Id": 1001, 10 | "Code": "NoVersionChange", 11 | "Mode": "Update" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: version_check_02 4 | version: "1.0" 5 | paths: {} 6 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/no_version_change/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: version_check_02 4 | version: "1.0" 5 | paths: {} 6 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/nullable_property_changed/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The nullable property has changed from 'true' to 'false'.", 5 | "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/tag/nullable", 6 | "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/tag/nullable", 7 | "OldJsonPath": "#/components/schemas/Pet/properties/tag/nullable", 8 | "NewJsonPath": "#/components/schemas/Pet/properties/tag/nullable", 9 | "Id": 2000, 10 | "Code": "NullablePropertyChanged", 11 | "Mode": "Update" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_add/new.yaml: -------------------------------------------------------------------------------- 1 | x-generator: NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0)) 2 | openapi: 3.0.0 3 | info: 4 | title: My Title 5 | version: "1.0" 6 | paths: 7 | /api/public/form: 8 | post: 9 | operationId: PostTicket 10 | requestBody: 11 | x-name: request 12 | content: 13 | application/json: 14 | schema: 15 | oneOf: 16 | - $ref: '#/components/schemas/TicketPostRequest' 17 | required: true 18 | x-position: 1 19 | responses: 20 | "200": 21 | description: "" 22 | content: 23 | application/json: 24 | schema: 25 | $ref: '#/components/schemas/TicketResponse' 26 | components: 27 | schemas: 28 | TicketResponse: 29 | type: object 30 | properties: 31 | ticket: 32 | oneOf: 33 | - $ref: '#/components/schemas/TicketObject' 34 | TicketObject: 35 | type: object 36 | properties: 37 | allow_attachments: 38 | type: boolean 39 | TicketPostRequest: 40 | type: object 41 | additionalProperties: false 42 | required: 43 | - email 44 | properties: 45 | email: 46 | type: string 47 | minLength: 1 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_add/old.yaml: -------------------------------------------------------------------------------- 1 | x-generator: NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0)) 2 | openapi: 3.0.0 3 | info: 4 | title: My Title 5 | version: "1.0" 6 | paths: 7 | /api/public/form: 8 | post: 9 | operationId: PostTicket 10 | requestBody: 11 | x-name: request 12 | content: 13 | application/json: 14 | schema: 15 | $ref: '#/components/schemas/TicketPostRequest' 16 | required: true 17 | x-position: 1 18 | responses: 19 | "200": 20 | description: "" 21 | content: 22 | application/json: 23 | schema: 24 | $ref: '#/components/schemas/TicketResponse' 25 | components: 26 | schemas: 27 | TicketResponse: 28 | type: object 29 | properties: 30 | ticket: 31 | $ref: '#/components/schemas/TicketObject' 32 | TicketObject: 33 | type: object 34 | properties: 35 | allow_attachments: 36 | type: boolean 37 | TicketPostRequest: 38 | type: object 39 | additionalProperties: false 40 | required: 41 | - email 42 | properties: 43 | email: 44 | type: string 45 | minLength: 1 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_add_ref/old.yaml: -------------------------------------------------------------------------------- 1 | x-generator: NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0)) 2 | openapi: 3.0.0 3 | info: 4 | title: My Title 5 | version: "1.0" 6 | paths: 7 | /api/public/form: 8 | post: 9 | operationId: PostTicket 10 | requestBody: 11 | x-name: request 12 | content: 13 | application/json: 14 | schema: 15 | nullable: false 16 | oneOf: 17 | - $ref: '#/components/schemas/TicketPostRequest' 18 | required: true 19 | x-position: 1 20 | responses: 21 | "200": 22 | description: "" 23 | content: 24 | application/json: 25 | schema: 26 | $ref: '#/components/schemas/TicketResponse' 27 | components: 28 | schemas: 29 | TicketResponse: 30 | type: object 31 | properties: 32 | ticket: 33 | nullable: true 34 | oneOf: 35 | - $ref: '#/components/schemas/TicketObject' 36 | TicketObject: 37 | type: object 38 | properties: 39 | allow_attachments: 40 | type: boolean 41 | TicketPostRequest: 42 | type: object 43 | additionalProperties: false 44 | required: 45 | - email 46 | properties: 47 | email: 48 | type: string 49 | minLength: 1 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_ref_inner_change/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The versions have not changed.", 5 | "OldJsonRef": "#/info/version", 6 | "NewJsonRef": "#/info/version", 7 | "OldJsonPath": "#/info/version", 8 | "NewJsonPath": "#/info/version", 9 | "Id": 1001, 10 | "Code": "NoVersionChange", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Error", 15 | "Message": "The new version has new required property 'testNullableProperty' that was not found in the old version.", 16 | "OldJsonRef": "#/paths/~1api~1public~1form/post/requestBody/content/application~1json/schema/oneOf/0", 17 | "NewJsonRef": "#/paths/~1api~1public~1form/post/requestBody/content/application~1json/schema/oneOf/0", 18 | "OldJsonPath": "#/paths/~1api~1public~1form/post/requestBody/content/application~1json/schema/oneOf/0", 19 | "NewJsonPath": "#/paths/~1api~1public~1form/post/requestBody/content/application~1json/schema/oneOf/0", 20 | "Id": 1034, 21 | "Code": "AddedRequiredProperty", 22 | "Mode": "Addition" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_ref_inner_change/old.yaml: -------------------------------------------------------------------------------- 1 | x-generator: NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0)) 2 | openapi: 3.0.0 3 | info: 4 | title: My Title 5 | version: "1.0" 6 | paths: 7 | /api/public/form: 8 | post: 9 | operationId: PostTicket 10 | requestBody: 11 | x-name: request 12 | content: 13 | application/json: 14 | schema: 15 | nullable: false 16 | oneOf: 17 | - $ref: '#/components/schemas/TicketPostRequest' 18 | required: true 19 | x-position: 1 20 | responses: 21 | "200": 22 | description: "" 23 | content: 24 | application/json: 25 | schema: 26 | $ref: '#/components/schemas/TicketResponse' 27 | components: 28 | schemas: 29 | TicketResponse: 30 | type: object 31 | properties: 32 | ticket: 33 | nullable: true 34 | oneOf: 35 | - $ref: '#/components/schemas/TicketObject' 36 | TicketObject: 37 | type: object 38 | properties: 39 | allow_attachments: 40 | type: boolean 41 | TicketPostRequest: 42 | type: object 43 | additionalProperties: false 44 | required: 45 | - email 46 | properties: 47 | email: 48 | type: string 49 | minLength: 1 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_remove/new.yaml: -------------------------------------------------------------------------------- 1 | x-generator: NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0)) 2 | openapi: 3.0.0 3 | info: 4 | title: My Title 5 | version: "1.0" 6 | paths: 7 | /api/public/form: 8 | post: 9 | operationId: PostTicket 10 | requestBody: 11 | x-name: request 12 | content: 13 | application/json: 14 | schema: 15 | $ref: '#/components/schemas/TicketPostRequest' 16 | required: true 17 | x-position: 1 18 | responses: 19 | "200": 20 | description: "" 21 | content: 22 | application/json: 23 | schema: 24 | $ref: '#/components/schemas/TicketResponse' 25 | components: 26 | schemas: 27 | TicketResponse: 28 | type: object 29 | properties: 30 | ticket: 31 | $ref: '#/components/schemas/TicketObject' 32 | TicketObject: 33 | type: object 34 | properties: 35 | allow_attachments: 36 | type: boolean 37 | TicketPostRequest: 38 | type: object 39 | additionalProperties: false 40 | required: 41 | - email 42 | properties: 43 | email: 44 | type: string 45 | minLength: 1 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_remove/old.yaml: -------------------------------------------------------------------------------- 1 | x-generator: NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0)) 2 | openapi: 3.0.0 3 | info: 4 | title: My Title 5 | version: "1.0" 6 | paths: 7 | /api/public/form: 8 | post: 9 | operationId: PostTicket 10 | requestBody: 11 | x-name: request 12 | content: 13 | application/json: 14 | schema: 15 | oneOf: 16 | - $ref: '#/components/schemas/TicketPostRequest' 17 | required: true 18 | x-position: 1 19 | responses: 20 | "200": 21 | description: "" 22 | content: 23 | application/json: 24 | schema: 25 | $ref: '#/components/schemas/TicketResponse' 26 | components: 27 | schemas: 28 | TicketResponse: 29 | type: object 30 | properties: 31 | ticket: 32 | oneOf: 33 | - $ref: '#/components/schemas/TicketObject' 34 | TicketObject: 35 | type: object 36 | properties: 37 | allow_attachments: 38 | type: boolean 39 | TicketPostRequest: 40 | type: object 41 | additionalProperties: false 42 | required: 43 | - email 44 | properties: 45 | email: 46 | type: string 47 | minLength: 1 48 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_remove_ref/new.yaml: -------------------------------------------------------------------------------- 1 | x-generator: NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0)) 2 | openapi: 3.0.0 3 | info: 4 | title: My Title 5 | version: "1.0" 6 | paths: 7 | /api/public/form: 8 | post: 9 | operationId: PostTicket 10 | requestBody: 11 | x-name: request 12 | content: 13 | application/json: 14 | schema: 15 | nullable: false 16 | oneOf: 17 | - $ref: '#/components/schemas/TicketPostRequest' 18 | required: true 19 | x-position: 1 20 | responses: 21 | "200": 22 | description: "" 23 | content: 24 | application/json: 25 | schema: 26 | $ref: '#/components/schemas/TicketResponse' 27 | components: 28 | schemas: 29 | TicketResponse: 30 | type: object 31 | properties: 32 | ticket: 33 | nullable: true 34 | oneOf: 35 | - $ref: '#/components/schemas/TicketObject' 36 | TicketObject: 37 | type: object 38 | properties: 39 | allow_attachments: 40 | type: boolean 41 | TicketPostRequest: 42 | type: object 43 | additionalProperties: false 44 | required: 45 | - email 46 | properties: 47 | email: 48 | type: string 49 | minLength: 1 50 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/oneof_reorder_refs/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The versions have not changed.", 5 | "OldJsonRef": "#/info/version", 6 | "NewJsonRef": "#/info/version", 7 | "OldJsonPath": "#/info/version", 8 | "NewJsonPath": "#/info/version", 9 | "Id": 1001, 10 | "Code": "NoVersionChange", 11 | "Mode": "Update" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "How the parameter is passed has changed -- it used to be \u0027query\u0027, now it is \u0027header\u0027.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/in", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/0/in", 7 | "OldJsonPath": "#/components/parameters/skipParam/in", 8 | "NewJsonPath": "#/components/parameters/skipParam/in", 9 | "Id": 1015, 10 | "Code": "ParameterInHasChanged", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "How the parameter is passed has changed -- it used to be \u0027query\u0027, now it is \u0027header\u0027.", 16 | "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/in", 17 | "NewJsonRef": "#/paths/~1api~1Parameters/put/parameters/1/in", 18 | "OldJsonPath": "#/components/parameters/limitParam/in", 19 | "NewJsonPath": "#/components/parameters/limitParam/in", 20 | "Id": 1015, 21 | "Code": "ParameterInHasChanged", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: header 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: header 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: integer 34 | format: int32 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_in_has_changed/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: query 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: integer 34 | format: int32 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "2.0" 5 | paths: 6 | /pets: 7 | get: 8 | description: Get all pets from Petstore 9 | parameters: 10 | - name: pageParam 11 | in: query 12 | style: pipeDelimited 13 | responses: 14 | "200": 15 | description: OK 16 | content: 17 | application/json: 18 | schema: 19 | type: string 20 | /pets/{id}: 21 | parameters: 22 | - name: PetId 23 | in: path 24 | required: true 25 | style: matrix 26 | post: 27 | description: Register a new pet 28 | parameters: 29 | - $ref: '#/components/parameters/PetParameter' 30 | responses: 31 | "200": 32 | description: OK 33 | content: 34 | application/json: 35 | schema: 36 | type: string 37 | components: 38 | schemas: 39 | Pet: 40 | type: object 41 | properties: 42 | name: 43 | type: string 44 | petType: 45 | type: string 46 | parameters: 47 | PetParameter: 48 | name: PetParameter 49 | in: query 50 | style: deepObject 51 | schema: 52 | $ref: '#/components/schemas/Pet' 53 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/parameter_style_changed/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "1.0" 5 | paths: 6 | /pets: 7 | get: 8 | description: Get all pets from Petstore 9 | parameters: 10 | - name: pageParam 11 | in: query 12 | style: spaceDelimited 13 | responses: 14 | "200": 15 | description: OK 16 | content: 17 | application/json: 18 | schema: 19 | type: string 20 | /pets/{id}: 21 | parameters: 22 | - name: PetId 23 | in: path 24 | required: true 25 | style: label 26 | post: 27 | description: Register a new pet 28 | parameters: 29 | - $ref: '#/components/parameters/PetParameter' 30 | responses: 31 | "200": 32 | description: OK 33 | content: 34 | application/json: 35 | schema: 36 | type: string 37 | components: 38 | schemas: 39 | Pet: 40 | type: object 41 | properties: 42 | name: 43 | type: string 44 | petType: 45 | type: string 46 | parameters: 47 | PetParameter: 48 | name: PetParameter 49 | in: query 50 | style: form 51 | schema: 52 | $ref: '#/components/schemas/Pet' 53 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/polymorphic_schema/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version has a new optional property \u0027breed\u0027 that was not found in the old version.", 5 | "OldJsonRef": "#/components/schemas/Dog/properties/breed", 6 | "NewJsonRef": "#/components/schemas/Dog/properties/breed", 7 | "OldJsonPath": "#/components/schemas/Dog/properties/breed", 8 | "NewJsonPath": "#/components/schemas/Dog/properties/breed", 9 | "Id": 1045, 10 | "Code": "AddedOptionalProperty", 11 | "Mode": "Addition" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/readonly_property_changed/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The read only property has changed from 'false' to 'true'.", 5 | "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/readOnly", 6 | "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/items/properties/name/readOnly", 7 | "OldJsonPath": "#/components/schemas/Pet/properties/name/readOnly", 8 | "NewJsonPath": "#/components/schemas/Pet/properties/name/readOnly", 9 | "Id": 1029, 10 | "Code": "ReadonlyPropertyChanged", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The read only property has changed from 'true' to 'false'.", 16 | "OldJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/readOnly", 17 | "NewJsonRef": "#/paths/~1pets/get/responses/default/content/application~1json/schema/readOnly", 18 | "OldJsonPath": "#/paths/~1pets/get/responses/default/content/application~1json/schema/readOnly", 19 | "NewJsonPath": "#/paths/~1pets/get/responses/default/content/application~1json/schema/readOnly", 20 | "Id": 1029, 21 | "Code": "ReadonlyPropertyChanged", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/recursive_model/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is missing a property found in the old version. Was 'target' renamed or removed?", 5 | "OldJsonRef": "#/paths/~1api~1Operations/post/parameters/0/schema/properties/error/properties/target", 6 | "NewJsonRef": "#/paths/~1api~1Operations/post/parameters/0/schema/properties/error/properties/target", 7 | "OldJsonPath": "#/components/schemas/CreateParamBody/properties/target", 8 | "NewJsonPath": "#/components/schemas/CreateParamBody/properties/target", 9 | "Id": 1033, 10 | "Code": "RemovedProperty", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The read only property has changed from 'false' to 'true'.", 16 | "OldJsonRef": "#/paths/~1api~1Operations/post/responses/default/content/application~1json/schema/properties/error/properties/message/readOnly", 17 | "NewJsonRef": "#/paths/~1api~1Operations/post/responses/default/content/application~1json/schema/properties/error/properties/message/readOnly", 18 | "OldJsonPath": "#/components/schemas/CloudErrorBody/properties/message/readOnly", 19 | "NewJsonPath": "#/components/schemas/CloudErrorBody/properties/message/readOnly", 20 | "Id": 1029, 21 | "Code": "ReadonlyPropertyChanged", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection_type_changed/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.2.0 5 | paths: 6 | /orders: 7 | get: 8 | responses: 9 | "200": 10 | description: Successful Response 11 | content: 12 | application/json: 13 | schema: 14 | type: array 15 | items: 16 | $ref: "#/components/schemas/Cart" 17 | components: 18 | schemas: 19 | Cart: 20 | type: object 21 | properties: 22 | id: 23 | type: string 24 | name: 25 | type: string 26 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/reference_redirection_type_changed/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: My API 4 | version: 0.1.0 5 | paths: 6 | /orders: 7 | get: 8 | responses: 9 | "200": 10 | description: Successful Response 11 | content: 12 | application/json: 13 | schema: 14 | type: array 15 | items: 16 | $ref: "#/components/schemas/Order" 17 | components: 18 | schemas: 19 | Order: 20 | type: object 21 | properties: 22 | id: 23 | type: integer 24 | name: 25 | type: string 26 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version removes the 'additionalProperties' element.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/additionalProperties", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema/additionalProperties", 7 | "OldJsonPath": "#/components/schemas/Pet/additionalProperties", 8 | "NewJsonPath": "#/components/schemas/Pet/additionalProperties", 9 | "Id": 1022, 10 | "Code": "RemovedAdditionalProperties", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | responses: 17 | "200": 18 | content: 19 | application/json: 20 | schema: 21 | $ref: '#/components/schemas/Pet' 22 | components: 23 | schemas: 24 | Pet: 25 | type: object 26 | discriminator: 27 | propertyName: petType 28 | properties: 29 | name: 30 | type: string 31 | petType: 32 | type: string 33 | enum: 34 | - cat 35 | - dot 36 | - bird 37 | required: 38 | - name 39 | - petType 40 | parameters: 41 | skipParam: 42 | name: skipParam 43 | in: query 44 | description: number of items to skip 45 | required: true 46 | schema: 47 | type: integer 48 | format: int32 49 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_additional_properties/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | responses: 17 | "200": 18 | content: 19 | application/json: 20 | schema: 21 | $ref: '#/components/schemas/Pet' 22 | components: 23 | schemas: 24 | Pet: 25 | type: object 26 | discriminator: 27 | propertyName: petType 28 | properties: 29 | name: 30 | type: string 31 | petType: 32 | type: string 33 | enum: 34 | - cat 35 | - dot 36 | - bird 37 | additionalProperties: 38 | type: string 39 | required: 40 | - name 41 | - petType 42 | parameters: 43 | skipParam: 44 | name: skipParam 45 | in: query 46 | description: number of items to skip 47 | required: true 48 | schema: 49 | type: integer 50 | format: int32 51 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is missing a client parameter that was found in the old version. Was \u0027limitParam\u0027 removed or renamed?", 5 | "OldJsonRef": "#/components/parameters/limitParam", 6 | "NewJsonRef": "#/components/parameters/limitParam", 7 | "OldJsonPath": "#/components/parameters/limitParam", 8 | "NewJsonPath": "#/components/parameters/limitParam", 9 | "Id": 1007, 10 | "Code": "RemovedClientParameter", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | put: 10 | parameters: 11 | - $ref: '#/components/parameters/skipParam' 12 | components: 13 | parameters: 14 | skipParam: 15 | name: skip 16 | in: query 17 | description: number of items to skip 18 | schema: 19 | type: integer 20 | format: int32 21 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_client_parameter/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | put: 10 | parameters: 11 | - $ref: '#/components/parameters/skipParam' 12 | - $ref: '#/components/parameters/skipParam' 13 | - $ref: '#/components/parameters/limitParam' 14 | components: 15 | parameters: 16 | skipParam: 17 | name: skip 18 | in: query 19 | description: number of items to skip 20 | schema: 21 | type: integer 22 | format: int32 23 | limitParam: 24 | name: limitParam 25 | in: query 26 | description: max records to return 27 | schema: 28 | type: integer 29 | format: int32 30 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version removes a required header \u0027x-d\u0027.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 7 | "OldJsonPath": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 8 | "NewJsonPath": "#/paths/~1api~1Parameters/get/responses/200/headers/x-d", 9 | "Id": 1014, 10 | "Code": "RemovingHeader", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version removes a required header \u0027x-c\u0027.", 16 | "OldJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 17 | "NewJsonRef": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 18 | "OldJsonPath": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 19 | "NewJsonPath": "#/paths/~1api~1Responses/get/responses/200/headers/x-c", 20 | "Id": 1014, 21 | "Code": "RemovingHeader", 22 | "Mode": "Removal" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_03 4 | version: "2.0" 5 | paths: 6 | /api/Parameters: 7 | get: 8 | operationId: Responses_Get 9 | responses: 10 | "200": 11 | description: null 12 | headers: 13 | x-b: 14 | schema: 15 | type: integer 16 | /api/Responses: 17 | get: 18 | operationId: Responses_Get 19 | responses: 20 | "200": 21 | description: null 22 | headers: 23 | x-a: 24 | schema: 25 | type: integer 26 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_header/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_03 4 | version: "1.0" 5 | paths: 6 | /api/Parameters: 7 | get: 8 | operationId: Responses_Get 9 | responses: 10 | "200": 11 | description: null 12 | headers: 13 | x-b: 14 | schema: 15 | type: integer 16 | x-d: {} 17 | /api/Responses: 18 | get: 19 | operationId: Responses_Get 20 | responses: 21 | "200": 22 | description: null 23 | headers: 24 | x-a: 25 | schema: 26 | type: integer 27 | x-c: {} 28 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is missing an operation that was found in the old version. Was operationId \u0027Operations_Post\u0027 removed or restructured?", 5 | "OldJsonRef": "#/paths/~1api~1Operations/post", 6 | "NewJsonRef": "#/paths/~1api~1Operations/post", 7 | "OldJsonPath": "#/paths/~1api~1Operations/post", 8 | "NewJsonPath": "#/paths/~1api~1Operations/post", 9 | "Id": 1035, 10 | "Code": "RemovedOperation", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: removed_operation 4 | version: "2.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_operation/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: removed_operation 4 | version: "1.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: {} 17 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "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?", 5 | "OldJsonRef": "#/paths/~1api~1Parameters~1{a}", 6 | "NewJsonRef": null, 7 | "OldJsonPath": "#/paths/~1api~1Parameters~1{a}", 8 | "NewJsonPath": null, 9 | "Id": 1005, 10 | "Code": "RemovedPath", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version is missing a path that was found in the old version. Was path \u0027/api/Responses\u0027 removed or restructured?", 16 | "OldJsonRef": "#/paths/~1api~1Responses", 17 | "NewJsonRef": null, 18 | "OldJsonPath": "#/paths/~1api~1Responses", 19 | "NewJsonPath": null, 20 | "Id": 1005, 21 | "Code": "RemovedPath", 22 | "Mode": "Removal" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: removed_path 4 | version: "2.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: {} 17 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_path/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: removed_path 4 | version: "1.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: {} 17 | /api/Parameters/{a}: 18 | get: 19 | operationId: Parameters_Get 20 | responses: {} 21 | /api/Responses: 22 | get: 23 | operationId: Responses_Get 24 | responses: {} 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is removing a requestBody that was found in the old version.", 5 | "OldJsonRef": "#/paths/~1pets/post/requestBody", 6 | "NewJsonRef": "#/paths/~1pets/post/requestBody", 7 | "OldJsonPath": "#/paths/~1pets/post/requestBody", 8 | "NewJsonPath": "#/paths/~1pets/post/requestBody", 9 | "Id": 1047, 10 | "Code": "RemovedRequestBody", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_request_body/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "2.1" 5 | paths: 6 | /pets: 7 | post: 8 | description: Post multiple pets 9 | responses: 10 | "200": 11 | content: 12 | text/plain: 13 | schema: 14 | type: integer 15 | /pets/{id}: 16 | post: 17 | description: Post one pet according to its id 18 | requestBody: 19 | $ref: '#/components/requestBodies/PetBody' 20 | responses: 21 | "200": 22 | content: 23 | text/plain: 24 | schema: 25 | type: integer 26 | components: 27 | schemas: 28 | Pet: 29 | type: object 30 | properties: 31 | name: 32 | type: string 33 | petType: 34 | type: string 35 | enum: 36 | - cat 37 | - dog 38 | requestBodies: 39 | PetBody: 40 | content: 41 | application/json: 42 | schema: 43 | $ref: '#/components/schema/Pet' 44 | application/xml: 45 | schema: 46 | type: string 47 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The required parameter \u0027limitParam\u0027 was removed in the new version.", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/put/parameters/1", 6 | "NewJsonRef": null, 7 | "OldJsonPath": "#/paths/~1api~1Parameters/put/parameters/1", 8 | "NewJsonPath": null, 9 | "Id": 1009, 10 | "Code": "RemovedRequiredParameter", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | components: 17 | parameters: 18 | skipParam: 19 | name: skipParam 20 | in: query 21 | description: number of items to skip 22 | required: true 23 | schema: 24 | type: integer 25 | format: int32 26 | limitParam: 27 | name: limitParam 28 | in: query 29 | description: max records to return 30 | required: true 31 | schema: 32 | type: integer 33 | format: int32 34 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_required_parameter/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | parameters: 15 | - $ref: '#/components/parameters/skipParam' 16 | - $ref: '#/components/parameters/limitParam' 17 | components: 18 | parameters: 19 | skipParam: 20 | name: skipParam 21 | in: query 22 | description: number of items to skip 23 | required: true 24 | schema: 25 | type: integer 26 | format: int32 27 | limitParam: 28 | name: limitParam 29 | in: query 30 | description: max records to return 31 | required: true 32 | schema: 33 | type: integer 34 | format: int32 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version removes the response code \u0027200\u0027", 5 | "OldJsonRef": "#/paths/~1api~1Operations/post/responses/200", 6 | "NewJsonRef": "#/paths/~1api~1Operations/post/responses/200", 7 | "OldJsonPath": "#/paths/~1api~1Operations/post/responses/200", 8 | "NewJsonPath": "#/paths/~1api~1Operations/post/responses/200", 9 | "Id": 1012, 10 | "Code": "RemovedResponseCode", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version removes the response code \u0027202\u0027", 16 | "OldJsonRef": "#/paths/~1api~1Responses/get/responses/202", 17 | "NewJsonRef": "#/paths/~1api~1Responses/get/responses/202", 18 | "OldJsonPath": "#/paths/~1api~1Responses/get/responses/202", 19 | "NewJsonPath": "#/paths/~1api~1Responses/get/responses/202", 20 | "Id": 1012, 21 | "Code": "RemovedResponseCode", 22 | "Mode": "Removal" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_01 4 | version: "2.0" 5 | paths: 6 | /api/Path: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: {} 17 | /api/Parameters/{a}: 18 | get: 19 | operationId: Parameters_Get 20 | responses: {} 21 | /api/Responses: 22 | get: 23 | operationId: Responses_Get 24 | responses: 25 | "200": 26 | description: null 27 | "400": 28 | description: null 29 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_response_code/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: operation_check_01 4 | version: "1.0" 5 | paths: 6 | /api/Path: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: 17 | "200": 18 | description: null 19 | /api/Parameters/{a}: 20 | get: 21 | operationId: Parameters_Get 22 | responses: {} 23 | /api/Responses: 24 | get: 25 | operationId: Responses_Get 26 | responses: 27 | "200": 28 | description: null 29 | "202": 30 | description: null 31 | "400": 32 | description: null 33 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is missing a definition that was found in the old version. Was \u0027Pet\u0027 removed or renamed?", 5 | "OldJsonRef": "#/components/schemas/Pet", 6 | "NewJsonRef": "#/components/schemas/Pet", 7 | "OldJsonPath": "#/components/schemas/Pet", 8 | "NewJsonPath": "#/components/schemas/Pet", 9 | "Id": 1006, 10 | "Code": "RemovedDefinition", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: removed_definition 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | - url: https://localhost:8000 8 | paths: 9 | /api/Parameters: 10 | put: 11 | tags: 12 | - Parameters 13 | operationId: Parameters_Put 14 | requestBody: 15 | content: 16 | application/json: 17 | schema: 18 | $ref: '#/components/schemas/Database' 19 | get: 20 | tags: 21 | - Parameters 22 | operationId: Parameters_Get 23 | requestBody: 24 | content: 25 | application/json: 26 | schema: 27 | $ref: '#/components/schemas/Database' 28 | components: 29 | schemas: 30 | Database: 31 | description: Database schema 32 | properties: 33 | a: 34 | type: string 35 | readOnly: true 36 | description: |- 37 | This is a system generated property. 38 | The _rid value is empty for this operation. 39 | b: 40 | type: integer 41 | readOnly: true 42 | default: 0 43 | description: This property shows the number of databases returned. 44 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version is missing a definition that was found in the old version. Was \u0027\u0027 removed or renamed?", 5 | "OldJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 6 | "NewJsonRef": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 7 | "OldJsonPath": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 8 | "NewJsonPath": "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema", 9 | "Id": 1006, 10 | "Code": "RemovedDefinition", 11 | "Mode": "Removal" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: Added Schema in response 4 | version: "2.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | put: 10 | tags: 11 | - Parameters 12 | operationId: Parameters_Put 13 | parameters: [] 14 | responses: 15 | "200": 16 | content: 17 | application/json: {} 18 | components: 19 | schemas: 20 | Pet: 21 | type: object 22 | discriminator: 23 | propertyName: petType 24 | properties: 25 | name: 26 | type: string 27 | petType: 28 | type: string 29 | enum: 30 | - cat 31 | - dot 32 | required: 33 | - name 34 | - petType 35 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/removed_schema_in_response/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0 2 | info: 3 | title: Added Schema in response 4 | version: "1.0" 5 | servers: 6 | - url: http://localhost:8000 7 | paths: 8 | /api/Parameters: 9 | put: 10 | tags: 11 | - Parameters 12 | operationId: Parameters_Put 13 | parameters: [] 14 | responses: 15 | "200": 16 | content: 17 | application/json: 18 | schema: 19 | $ref: '#/components/schemas/Pet' 20 | components: 21 | schemas: 22 | Pet: 23 | type: object 24 | discriminator: 25 | propertyName: petType 26 | properties: 27 | name: 28 | type: string 29 | petType: 30 | type: string 31 | enum: 32 | - cat 33 | - dot 34 | required: 35 | - name 36 | - petType 37 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Info", 4 | "Message": "The old version did not support \u0027application/xml\u0027 as a request body format.", 5 | "OldJsonRef": "#/paths/~1pets/post/requestBody/content/application~1xml", 6 | "NewJsonRef": "#/paths/~1pets/post/requestBody/content/application~1xml", 7 | "OldJsonPath": "#/paths/~1pets/post/requestBody/content/application~1xml", 8 | "NewJsonPath": "#/paths/~1pets/post/requestBody/content/application~1xml", 9 | "Id": 1018, 10 | "Code": "RequestBodyFormatNowSupported", 11 | "Mode": "Addition" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "2.1" 5 | paths: 6 | /pets: 7 | post: 8 | description: Post multiple pets 9 | requestBody: 10 | content: 11 | application/json: 12 | schema: 13 | type: array 14 | items: 15 | $ref: '#/components/schema/Pet' 16 | application/xml: 17 | schema: 18 | type: string 19 | responses: 20 | "200": 21 | content: 22 | text/plain: 23 | schema: 24 | type: integer 25 | components: 26 | schemas: 27 | Pet: 28 | type: object 29 | properties: 30 | name: 31 | type: string 32 | petType: 33 | type: string 34 | enum: 35 | - cat 36 | - dog 37 | requestBodies: 38 | PetBody: 39 | content: 40 | application/json: 41 | schema: 42 | $ref: '#/components/schema/Pet' 43 | application/xml: 44 | schema: 45 | type: string 46 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/request_body_format_now_supported/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "2.0" 5 | paths: 6 | /pets: 7 | post: 8 | description: Post multiple pets 9 | requestBody: 10 | content: 11 | application/json: 12 | schema: 13 | type: array 14 | items: 15 | $ref: '#/components/schema/Pet' 16 | responses: 17 | "200": 18 | content: 19 | text/plain: 20 | schema: 21 | type: integer 22 | components: 23 | schemas: 24 | Pet: 25 | type: object 26 | properties: 27 | name: 28 | type: string 29 | petType: 30 | type: string 31 | enum: 32 | - cat 33 | - dog 34 | requestBodies: 35 | PetBody: 36 | content: 37 | application/json: 38 | schema: 39 | $ref: '#/components/schema/Pet' 40 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/response_body_format_now_supported/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "1.0" 5 | paths: 6 | /pets: 7 | get: 8 | responses: 9 | "200": 10 | content: 11 | application/json: 12 | schema: 13 | type: array 14 | items: 15 | $ref: '#components/schemas/Pet' 16 | /pets/{id}: 17 | get: 18 | responses: 19 | "200": 20 | content: 21 | application/json: 22 | schema: 23 | $ref: '#/components/schemas/Pet' 24 | "404": 25 | $ref: '#/components/responses/ErrorResponse' 26 | components: 27 | schemas: 28 | Pet: 29 | type: object 30 | properties: 31 | name: 32 | type: string 33 | petType: 34 | type: string 35 | enum: 36 | - cat 37 | - dog 38 | Error: 39 | type: object 40 | properties: 41 | error: 42 | type: string 43 | message: 44 | type: string 45 | responses: 46 | ErrorResponse: 47 | content: 48 | application/json: 49 | schema: 50 | $ref: '#/components/schemas/Error' 51 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version does not support the server with url \u0027https://staging.gigantic-server.com/v1\u0027 anymore", 5 | "OldJsonRef": "#/servers/1", 6 | "NewJsonRef": null, 7 | "OldJsonPath": "#/servers/1", 8 | "NewJsonPath": null, 9 | "Id": 10021, 10 | "Code": "ServerNoLongerSupported", 11 | "Mode": "Removal" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version does not support the server with url \u0027https://api.gigantic-server.com/v1\u0027 anymore", 16 | "OldJsonRef": "#/servers/2", 17 | "NewJsonRef": null, 18 | "OldJsonPath": "#/servers/2", 19 | "NewJsonPath": null, 20 | "Id": 10021, 21 | "Code": "ServerNoLongerSupported", 22 | "Mode": "Removal" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "2.0" 5 | servers: 6 | - url: https://development.gigantic-server.com/v1 7 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/server_no_longer_supported/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Petstore API 4 | version: "1.0" 5 | servers: 6 | - url: https://development.gigantic-server.com/v1 7 | description: Development server 8 | - url: https://staging.gigantic-server.com/v1 9 | description: Staging server 10 | - url: https://api.gigantic-server.com/v1 11 | description: Production server 12 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Warning", 4 | "Message": "The new version has a different format than the previous one.", 5 | "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/sleepTime/format", 6 | "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/sleepTime/format", 7 | "OldJsonPath": "#/components/schemas/Pet/properties/sleepTime/format", 8 | "NewJsonPath": "#/components/schemas/Pet/properties/sleepTime/format", 9 | "Id": 1023, 10 | "Code": "TypeFormatChanged", 11 | "Mode": "Update" 12 | }, 13 | { 14 | "Severity": "Warning", 15 | "Message": "The new version has a different format than the previous one.", 16 | "OldJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/numberOfEyes/format", 17 | "NewJsonRef": "#/paths/~1pets/get/responses/200/content/application~1json/schema/properties/numberOfEyes/format", 18 | "OldJsonPath": "#/components/schemas/Pet/properties/numberOfEyes/format", 19 | "NewJsonPath": "#/components/schemas/Pet/properties/numberOfEyes/format", 20 | "Id": 1023, 21 | "Code": "TypeFormatChanged", 22 | "Mode": "Update" 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0" 2 | info: 3 | version: 2.0.0 4 | title: Pet store 5 | description: Pet store. 6 | paths: 7 | /pets: 8 | get: 9 | 'parameters:': 10 | - $ref: '#/components/parameters/skipParam' 11 | responses: 12 | "200": 13 | content: 14 | application/json: 15 | schema: 16 | $ref: '#/components/schemas/Pet' 17 | components: 18 | schemas: 19 | Pet: 20 | description: Just a Pet. 21 | type: object 22 | properties: 23 | sleepTime: 24 | description: How much time does he sleep. 25 | type: integer 26 | format: int64 27 | numberOfEyes: 28 | description: No question asked. 29 | type: string 30 | format: url 31 | parameters: 32 | skipParam: 33 | name: skip 34 | in: query 35 | description: number of items to skip 36 | required: true 37 | schema: 38 | type: integer 39 | format: int64 40 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/type_format_changed/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0" 2 | info: 3 | version: 1.0.0 4 | title: Pet store 5 | description: Pet store. 6 | paths: 7 | /pets: 8 | get: 9 | 'parameters:': 10 | - $ref: '#/components/parameters/skipParam' 11 | responses: 12 | "200": 13 | content: 14 | application/json: 15 | schema: 16 | $ref: '#/components/schemas/Pet' 17 | components: 18 | schemas: 19 | Pet: 20 | description: Just a Pet. 21 | type: object 22 | properties: 23 | sleepTime: 24 | description: How much time does he sleep. 25 | type: integer 26 | format: int32 27 | numberOfEyes: 28 | description: No question asked. 29 | type: string 30 | format: email 31 | parameters: 32 | skipParam: 33 | name: skip 34 | in: query 35 | description: number of items to skip 36 | required: true 37 | schema: 38 | type: integer 39 | format: int32 40 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/valid_oas/diff.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Severity": "Error", 4 | "Message": "The new version has a lower value than the old: 2.0 -> 1.0", 5 | "OldJsonRef": "#/info/version", 6 | "NewJsonRef": "#/info/version", 7 | "OldJsonPath": "#/info/version", 8 | "NewJsonPath": "#/info/version", 9 | "Id": 1000, 10 | "Code": "VersionsReversed", 11 | "Mode": "Update" 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: version_check_02 4 | version: "1.0" 5 | paths: {} 6 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/version_reversed/old.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: version_check_02 4 | version: "2.0" 5 | paths: {} 6 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator.UTest/Resource/x-ms-paths/new.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: X-ms-paths 4 | version: "2.0" 5 | paths: 6 | /api/Paths: 7 | get: 8 | operationId: Paths_Get 9 | responses: {} 10 | /api/Operations: 11 | get: 12 | operationId: Operations_Get 13 | responses: {} 14 | post: 15 | operationId: Operations_Post 16 | responses: {} 17 | x-ms-paths: 18 | /myPath/query-drive?op=folder: 19 | get: 20 | parameters: 21 | - name: id 22 | in: query 23 | description: ID of pet to use 24 | required: true 25 | schema: 26 | type: array 27 | items: 28 | type: string 29 | style: simple 30 | responses: 31 | "200": 32 | content: 33 | application/json: 34 | schema: 35 | $ref: '#/components/schemas/Dog' 36 | components: 37 | schemas: 38 | Dog: 39 | type: object 40 | properties: 41 | playWith: 42 | type: string 43 | enjoyWalk: 44 | type: boolean 45 | Cat: 46 | type: object 47 | properties: 48 | food: 49 | type: string 50 | sleepTime: 51 | type: string 52 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/Comparators/ComponentComparator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.OpenApi.Interfaces; 6 | using Microsoft.OpenApi.Models; 7 | 8 | namespace Criteo.OpenApi.Comparator.Comparators 9 | { 10 | internal static class ComponentComparator where T : IOpenApiReferenceable 11 | { 12 | internal static void Compare(ComparisonContext context, T oldComponent, T newComponent) 13 | { 14 | if (oldComponent == null) 15 | throw new ArgumentNullException(nameof(oldComponent)); 16 | 17 | if (newComponent == null) 18 | throw new ArgumentNullException(nameof(newComponent)); 19 | 20 | CompareReference(context, oldComponent.Reference, newComponent.Reference); 21 | } 22 | 23 | private static void CompareReference(ComparisonContext context, 24 | OpenApiReference oldReference, 25 | OpenApiReference newReference) 26 | { 27 | if (newReference?.ReferenceV3 != null && !newReference.ReferenceV3.Equals(oldReference?.ReferenceV3)) 28 | { 29 | context.LogBreakingChange(ComparisonRules.ReferenceRedirection); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/Comparators/Extensions/OpenApiParameterExtension.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | using Microsoft.OpenApi.Models; 5 | 6 | namespace Criteo.OpenApi.Comparator.Comparators.Extensions 7 | { 8 | internal static class OpenApiParameterExtension 9 | { 10 | internal static bool IsConstant(this OpenApiParameter parameter) => 11 | parameter.IsRequired() && parameter.HasEnumWithSingleValue(); 12 | 13 | internal static bool IsRequired(this OpenApiParameter parameter) => 14 | parameter.Required || parameter.In == ParameterLocation.Path; 15 | 16 | private static bool HasEnumWithSingleValue(this OpenApiParameter parameter) => 17 | parameter.Schema?.Enum != null && parameter.Schema.Enum.Count == 1; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/Comparators/Extensions/OpenApiSchemaExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | using Microsoft.OpenApi.Any; 5 | using Microsoft.OpenApi.Models; 6 | 7 | namespace Criteo.OpenApi.Comparator.Comparators.Extensions 8 | { 9 | internal static class OpenApiSchemaExtensions 10 | { 11 | internal static bool IsPropertyRequired(this OpenApiSchema schema, string propertyName) => 12 | schema.Required != null && schema.Required.Contains(propertyName); 13 | 14 | internal static string StringValue(this IOpenApiAny openApiAny) => 15 | openApiAny switch 16 | { 17 | OpenApiString openApiString => openApiString.Value, 18 | _ => openApiAny.ToString(), 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/ComparisonRule.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | namespace Criteo.OpenApi.Comparator 5 | { 6 | /// 7 | /// Describes an atomic type of difference 8 | /// 9 | public class ComparisonRule 10 | { 11 | /// Unique identifier 12 | public int Id { get; set; } 13 | 14 | /// Verbose identifier of the rule 15 | public string Code { get; set; } 16 | 17 | /// Rule message, giving more details about the difference 18 | public string Message { get; set; } 19 | 20 | /// Difference type (Addition, Update, Removal) 21 | public MessageType Type { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/Logging/LogMessageSeverity.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | namespace Criteo.OpenApi.Comparator.Logging 5 | { 6 | /// 7 | /// Used to express to severity of detected change. 8 | /// this property is defined according to our own interpretation of the 9 | /// comparison rules and may differ according to your own interpretation. 10 | /// 11 | public enum Severity 12 | { 13 | /// 14 | /// The change hasn't any impact on the API (i.e. the version of the OAS is updated) 15 | /// 16 | Info, 17 | 18 | /// 19 | /// The change has an impact on the API, but should not break client's integration (i.e. adding an optional parameter) 20 | /// 21 | Warning, 22 | 23 | /// 24 | /// The change should be considered as a breaking change (i.e. updating the format of a response body) 25 | /// 26 | Error 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/MessageType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | namespace Criteo.OpenApi.Comparator 5 | { 6 | /// 7 | /// Types of differences that can be found 8 | /// 9 | public enum MessageType 10 | { 11 | /// 12 | /// If an OpenAPI element is added in the new version 13 | /// 14 | Addition, 15 | 16 | /// 17 | /// If an OpenAPI element is updated in the new version 18 | /// 19 | Update, 20 | 21 | /// 22 | /// If an OpenAPI element is removed in the new version 23 | /// 24 | Removal, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/Parser/JsonDocument.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | using Newtonsoft.Json.Linq; 5 | 6 | namespace Criteo.OpenApi.Comparator.Parser 7 | { 8 | internal interface IJsonDocument 9 | { 10 | /// JSON object 11 | JToken Token { get; } 12 | } 13 | 14 | internal sealed class JsonDocument : IJsonDocument 15 | { 16 | /// 17 | /// Untyped raw parsed JSON. The Token also includes information about 18 | /// file location of each item. 19 | /// 20 | public JToken Token { get; } 21 | 22 | /// 23 | /// Deserialized JSON of Type T 24 | /// 25 | public T Typed { get; } 26 | 27 | public JsonDocument(JToken token, T typed) 28 | { 29 | Token = token; 30 | Typed = typed; 31 | } 32 | } 33 | 34 | internal static class JsonDocument 35 | { 36 | /// 37 | /// Creates a `JsonDocument` object. It's a syntax sugar for `new JsonDocument`. 38 | /// 39 | public static JsonDocument ToJsonDocument(this JToken token, T typed) => 40 | new JsonDocument(token, typed); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Criteo Technology. All rights reserved. 2 | // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. 3 | 4 | using System.Runtime.CompilerServices; 5 | 6 | [assembly: InternalsVisibleTo("Criteo.OpenApi.Comparator.UTest")] -------------------------------------------------------------------------------- /src/Criteo.OpenApi.Comparator/Settings.cs: -------------------------------------------------------------------------------- 1 |  --------------------------------------------------------------------------------