diff --git a/src/Criteo.OpenApi.Comparator.UTest/OpenApiParserTests.cs b/src/Criteo.OpenApi.Comparator.UTest/OpenApiParserTests.cs index 43960b9..43dbbee 100644 --- a/src/Criteo.OpenApi.Comparator.UTest/OpenApiParserTests.cs +++ b/src/Criteo.OpenApi.Comparator.UTest/OpenApiParserTests.cs @@ -5,7 +5,7 @@ using System.Reflection; using Criteo.OpenApi.Comparator.Parser; using Microsoft.OpenApi.Models; -using Newtonsoft.Json; +using Microsoft.OpenApi.Readers.Exceptions; using NUnit.Framework; namespace Criteo.OpenApi.Comparator.UTest @@ -29,16 +29,16 @@ public void OpenApiParser_Should_Throw_Exception_When_Invalid_Json() { const string fileName = "invalid_json_file.txt"; var documentAsString = ReadOpenApiFile(fileName); - Assert.Throws(() => OpenApiParser.Parse(documentAsString)); + Assert.Throws(() => OpenApiParser.Parse(documentAsString)); } /// /// Verifies that a valid JsonDocument object is parsed when input is a valid OpenApi /// - [Test] - public void OpenApiParser_Should_Return_Valid_OpenApi_Document_Object() + [TestCase("openapi_specification.json")] + [TestCase("openapi_specification.yaml")] + public void OpenApiParser_Should_Return_Valid_OpenApi_Document_Object(string fileName) { - const string fileName = "openapi_specification.json"; var documentAsString = ReadOpenApiFile(fileName); var validOpenApiDocument = OpenApiParser.Parse(documentAsString); Assert.IsInstanceOf>(validOpenApiDocument); diff --git a/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs b/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs index 307d81f..7c265d8 100644 --- a/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs +++ b/src/Criteo.OpenApi.Comparator.UTest/OpenApiSpecificationsCompareTests.cs @@ -28,14 +28,14 @@ public class OpenApiSpecificationsCompareTests [Test] public void CompareOAS_ShouldNotReturn_Differences() { - var differences = CompareSpecifications("valid_oas.json"); + var differences = CompareSpecifications("valid_oas"); Assert.That(differences, Is.Empty); } [Test] public void CompareOAS_ShouldNotReturn_Warnings_When_NoVersionChanged() { - var differences = CompareSpecifications("no_version_change.json"); + var differences = CompareSpecifications("no_version_change"); differences.AssertContainsOnly(new ExpectedDifference { @@ -48,7 +48,7 @@ public void CompareOAS_ShouldNotReturn_Warnings_When_NoVersionChanged() [Test] public void CompareOAS_ShouldReturn_VersionReversedDifferences() { - var differences = CompareSpecifications("version_reversed.json"); + var differences = CompareSpecifications("version_reversed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -61,7 +61,7 @@ public void CompareOAS_ShouldReturn_VersionReversedDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedPathDifferences() { - var differences = CompareSpecifications("removed_path.json"); + var differences = CompareSpecifications("removed_path"); differences.AssertContainsOnly(new ExpectedDifference { @@ -80,7 +80,7 @@ public void CompareOAS_ShouldReturn_RemovedPathDifferences() [Test] public void CompareOAS_ShouldReturn_AddedPathDifferences() { - var differences = CompareSpecifications("added_path.json"); + var differences = CompareSpecifications("added_path"); differences.AssertContainsOnly(new ExpectedDifference { @@ -93,7 +93,7 @@ public void CompareOAS_ShouldReturn_AddedPathDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedOperationDifferences() { - var differences = CompareSpecifications("removed_operation.json"); + var differences = CompareSpecifications("removed_operation"); differences.AssertContainsOnly(new ExpectedDifference { @@ -106,7 +106,7 @@ public void CompareOAS_ShouldReturn_RemovedOperationDifferences() [Test] public void CompareOAS_ShouldReturn_AddedOperationDifferences() { - var differences = CompareSpecifications("added_operation.json"); + var differences = CompareSpecifications("added_operation"); differences.AssertContainsOnly(new ExpectedDifference { @@ -119,7 +119,7 @@ public void CompareOAS_ShouldReturn_AddedOperationDifferences() [Test] public void CompareOAS_ShouldReturn_ModifiedOperationIdDifferences() { - var differences = CompareSpecifications("modified_operation_id.json"); + var differences = CompareSpecifications("modified_operation_id"); differences.AssertContainsOnly(new ExpectedDifference { @@ -133,7 +133,7 @@ public void CompareOAS_ShouldReturn_ModifiedOperationIdDifferences() [Test] public void CompareOAS_ShouldReturn_AddedResponseCodeDifferences() { - var differences = CompareSpecifications("added_response_code.json"); + var differences = CompareSpecifications("added_response_code"); differences.AssertContainsOnly(new ExpectedDifference { @@ -146,7 +146,7 @@ public void CompareOAS_ShouldReturn_AddedResponseCodeDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedResponseCodeDifferences() { - var differences = CompareSpecifications("removed_response_code.json"); + var differences = CompareSpecifications("removed_response_code"); differences.AssertContainsOnly(new ExpectedDifference { @@ -159,7 +159,7 @@ public void CompareOAS_ShouldReturn_RemovedResponseCodeDifferences() [Test] public void CompareOAS_ShouldReturn_AddedHeaderDifferences() { - var differences = CompareSpecifications("added_header.json"); + var differences = CompareSpecifications("added_header"); differences.AssertContainsOnly(new ExpectedDifference { @@ -172,7 +172,7 @@ public void CompareOAS_ShouldReturn_AddedHeaderDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedHeaderDifferences() { - var differences = CompareSpecifications("removed_header.json"); + var differences = CompareSpecifications("removed_header"); differences.AssertContainsOnly(new ExpectedDifference { @@ -185,7 +185,7 @@ public void CompareOAS_ShouldReturn_RemovedHeaderDifferences() [Test] public void CompareOAS_ShouldReturn_LongRunningOperationDifferences() { - var differences = CompareSpecifications("long_running_operation.json"); + var differences = CompareSpecifications("long_running_operation"); differences.AssertContainsOnly(new ExpectedDifference { @@ -202,7 +202,7 @@ public void CompareOAS_ShouldReturn_LongRunningOperationDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedSchemaDifferences() { - var differences = CompareSpecifications("removed_schema.json"); + var differences = CompareSpecifications("removed_schema"); differences.AssertContainsOnly(new ExpectedDifference { @@ -215,7 +215,7 @@ public void CompareOAS_ShouldReturn_RemovedSchemaDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedClientParameterDifferences() { - var differences = CompareSpecifications("removed_client_parameter.json"); + var differences = CompareSpecifications("removed_client_parameter"); differences.AssertContainsOnly(new ExpectedDifference { @@ -228,7 +228,7 @@ public void CompareOAS_ShouldReturn_RemovedClientParameterDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedRequiredParameterDifferences() { - var differences = CompareSpecifications("removed_required_parameter.json"); + var differences = CompareSpecifications("removed_required_parameter"); differences.AssertContainsOnly(new ExpectedDifference { @@ -241,7 +241,7 @@ public void CompareOAS_ShouldReturn_RemovedRequiredParameterDifferences() [Test] public void CompareOAS_ShouldReturn_AddedRequiredParameterDifferences() { - var differences = CompareSpecifications("added_required_parameter.json"); + var differences = CompareSpecifications("added_required_parameter"); differences.AssertContainsOnly(new ExpectedDifference { @@ -254,7 +254,7 @@ public void CompareOAS_ShouldReturn_AddedRequiredParameterDifferences() [Test] public void CompareOAS_ShouldReturn_ParameterInHasChangedDifferences() { - var differences = CompareSpecifications("parameter_in_has_changed.json"); + var differences = CompareSpecifications("parameter_in_has_changed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -267,7 +267,7 @@ public void CompareOAS_ShouldReturn_ParameterInHasChangedDifferences() [Test] public void CompareOAS_ShouldReturn_ConstantStatusHasChangedDifferences() { - var differences = CompareSpecifications("constant_status_has_changed.json"); + var differences = CompareSpecifications("constant_status_has_changed"); // If the number of values in an enum increases, then a ConstraintIsWeaker message will be raised as well differences.AssertContains(new ExpectedDifference @@ -295,7 +295,7 @@ public void CompareOAS_ShouldReturn_ConstantStatusHasChangedDifferences() [Test] public void CompareOAS_ShouldReturn_ReferenceRedirectionDifferences() { - var differences = CompareSpecifications("reference_redirection.json"); + var differences = CompareSpecifications("reference_redirection"); differences.AssertContainsOnly(new ExpectedDifference { @@ -308,7 +308,7 @@ public void CompareOAS_ShouldReturn_ReferenceRedirectionDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedEnumValueDifferences() { - var differences = CompareSpecifications("removed_enum_value.json"); + var differences = CompareSpecifications("removed_enum_value"); differences.AssertContains(new ExpectedDifference { @@ -326,7 +326,7 @@ public void CompareOAS_ShouldReturn_RemovedEnumValueDifferences() [Test] public void CompareOAS_ShouldReturn_AddedEnumValueDifferences() { - var differences = CompareSpecifications("added_enum_value.json"); + var differences = CompareSpecifications("added_enum_value"); differences.AssertContains(new ExpectedDifference { @@ -344,7 +344,7 @@ public void CompareOAS_ShouldReturn_AddedEnumValueDifferences() [Test] public void CompareOAS_ShouldReturn_AddedAdditionalPropertiesDifferences() { - var differences = CompareSpecifications("added_additional_properties.json"); + var differences = CompareSpecifications("added_additional_properties"); differences.AssertContainsOnly(new ExpectedDifference { @@ -357,7 +357,7 @@ public void CompareOAS_ShouldReturn_AddedAdditionalPropertiesDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedAdditionalPropertiesDifferences() { - var differences = CompareSpecifications("removed_additional_properties.json"); + var differences = CompareSpecifications("removed_additional_properties"); differences.AssertContainsOnly(new ExpectedDifference { @@ -376,7 +376,7 @@ public void CompareOAS_ShouldReturn_RemovedAdditionalPropertiesDifferences() [Test] public void CompareOAS_ShouldReturn_TypeFormatChangedDifferences() { - var differences = CompareSpecifications("type_format_changed.json"); + var differences = CompareSpecifications("type_format_changed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -389,7 +389,7 @@ public void CompareOAS_ShouldReturn_TypeFormatChangedDifferences() [Test] public void CompareOAS_ShouldReturn_RequiredStatusChangedDifferences() { - var differences = CompareSpecifications("required_status_changed.json"); + var differences = CompareSpecifications("required_status_changed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -405,7 +405,7 @@ public void CompareOAS_ShouldReturn_RequiredStatusChangedDifferences() [Test] public void CompareOAS_ShouldReturn_TypeChangedDifferences() { - var differences = CompareSpecifications("type_changed.json"); + var differences = CompareSpecifications("type_changed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -418,7 +418,7 @@ public void CompareOAS_ShouldReturn_TypeChangedDifferences() [Test] public void CompareOAS_ShouldReturn_DefaultValueChangedDifferences() { - var differences = CompareSpecifications("default_value_changed.json"); + var differences = CompareSpecifications("default_value_changed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -431,7 +431,7 @@ public void CompareOAS_ShouldReturn_DefaultValueChangedDifferences() [Test] public void CompareOAS_ShouldReturn_ReadonlyPropertyChangedDifferences() { - var differences = CompareSpecifications("readonly_property_changed.json"); + var differences = CompareSpecifications("readonly_property_changed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -444,7 +444,7 @@ public void CompareOAS_ShouldReturn_ReadonlyPropertyChangedDifferences() [Test] public void CompareOAS_ShouldReturn_DifferentDiscriminatorDifferences() { - var differences = CompareSpecifications("different_discriminator.json"); + var differences = CompareSpecifications("different_discriminator"); differences.AssertContainsOnly(new ExpectedDifference { @@ -457,7 +457,7 @@ public void CompareOAS_ShouldReturn_DifferentDiscriminatorDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedPropertyDifferences() { - var differences = CompareSpecifications("removed_property.json"); + var differences = CompareSpecifications("removed_property"); differences.AssertContainsOnly(new ExpectedDifference { @@ -470,7 +470,7 @@ public void CompareOAS_ShouldReturn_RemovedPropertyDifferences() [Test] public void CompareOAS_ShouldReturn_AddedRequiredPropertyDifferences() { - var differences = CompareSpecifications("added_required_property.json"); + var differences = CompareSpecifications("added_required_property"); differences.AssertContainsOnly(new ExpectedDifference { @@ -483,7 +483,7 @@ public void CompareOAS_ShouldReturn_AddedRequiredPropertyDifferences() [Test] public void CompareOAS_ShouldReturn_AddedOptionalParameterDifferences() { - var differences = CompareSpecifications("added_optional_parameter.json"); + var differences = CompareSpecifications("added_optional_parameter"); differences.AssertContainsOnly(new ExpectedDifference { @@ -496,7 +496,7 @@ public void CompareOAS_ShouldReturn_AddedOptionalParameterDifferences() [Test] public void CompareOAS_ShouldReturn_AddedOptionalPropertyDifferences() { - var differences = CompareSpecifications("added_optional_property.json"); + var differences = CompareSpecifications("added_optional_property"); differences.AssertContainsOnly(new ExpectedDifference { @@ -509,7 +509,7 @@ public void CompareOAS_ShouldReturn_AddedOptionalPropertyDifferences() [Test] public void CompareOAS_ShouldReturn_ChangedParameterOrderDifferences() { - var differences = CompareSpecifications("changed_parameter_order.json"); + var differences = CompareSpecifications("changed_parameter_order"); differences.AssertContainsOnly(new ExpectedDifference { @@ -522,7 +522,7 @@ public void CompareOAS_ShouldReturn_ChangedParameterOrderDifferences() [Test] public void CompareOAS_ShouldReturn_AddedPropertyInResponseDifferences() { - var differences = CompareSpecifications("added_property_in_response.json"); + var differences = CompareSpecifications("added_property_in_response"); differences.AssertContainsOnly(new ExpectedDifference { @@ -535,7 +535,7 @@ public void CompareOAS_ShouldReturn_AddedPropertyInResponseDifferences() [Test] public void CompareOAS_ShouldReturn_AddedReadOnlyPropertyInResponseDifferences() { - var differences = CompareSpecifications("added_readOnly_property_in_response.json"); + var differences = CompareSpecifications("added_readOnly_property_in_response"); differences.AssertContainsOnly(new ExpectedDifference { @@ -548,7 +548,7 @@ public void CompareOAS_ShouldReturn_AddedReadOnlyPropertyInResponseDifferences() [Test] public void CompareOAS_ShouldReturn_ConstraintChangedDifferences() { - var differences = CompareSpecifications("constraint_changed.json"); + var differences = CompareSpecifications("constraint_changed"); differences.AssertContains(new ExpectedDifference { @@ -571,7 +571,7 @@ public void CompareOAS_ShouldReturn_ConstraintChangedDifferences() [Test] public void CompareOAS_ShouldReturn_ConstraintIsStrongerDifferences() { - var differences = CompareSpecifications("constraint_is_stronger.json"); + var differences = CompareSpecifications("constraint_is_stronger"); differences.AssertContains(new ExpectedDifference { @@ -589,7 +589,7 @@ public void CompareOAS_ShouldReturn_ConstraintIsStrongerDifferences() [Test] public void CompareOAS_ShouldReturn_ConstraintIsWeakerDifferences() { - var differences = CompareSpecifications("constraint_is_weaker.json"); + var differences = CompareSpecifications("constraint_is_weaker"); differences.AssertContains(new ExpectedDifference { @@ -607,7 +607,7 @@ public void CompareOAS_ShouldReturn_ConstraintIsWeakerDifferences() [Test] public void CompareOAS_ShouldReturn_DifferentAllOfDifferences() { - var differences = CompareSpecifications("different_allOf.json"); + var differences = CompareSpecifications("different_allOf"); differences.AssertContainsOnly(new ExpectedDifference { @@ -620,7 +620,7 @@ public void CompareOAS_ShouldReturn_DifferentAllOfDifferences() [Test] public void CompareOAS_ShouldReturn_OneMessagePerRule_When_RecursiveModel() { - var differences = CompareSpecifications("recursive_model.json"); + var differences = CompareSpecifications("recursive_model"); differences.AssertContains(new ExpectedDifference { @@ -638,7 +638,7 @@ public void CompareOAS_ShouldReturn_OneMessagePerRule_When_RecursiveModel() [Test] public void CompareOAS_ShouldReturn_RequestBodyFormatNowSupportedDifferences() { - var differences = CompareSpecifications("request_body_format_now_supported.json"); + var differences = CompareSpecifications("request_body_format_now_supported"); differences.AssertContainsOnly(new ExpectedDifference { @@ -651,7 +651,7 @@ public void CompareOAS_ShouldReturn_RequestBodyFormatNowSupportedDifferences() [Test] public void CompareOAS_ShouldReturn_ResponseBodyFormatNowSupportedDifferences() { - var differences = CompareSpecifications("response_body_format_now_supported.json"); + var differences = CompareSpecifications("response_body_format_now_supported"); differences.AssertContainsOnly(new ExpectedDifference { @@ -664,7 +664,7 @@ public void CompareOAS_ShouldReturn_ResponseBodyFormatNowSupportedDifferences() [Test] public void CompareOAS_ShouldReturn_RequestBodyFormatNoLongerSupportedDifferences() { - var differences = CompareSpecifications("request_body_format_no_longer_supported.json"); + var differences = CompareSpecifications("request_body_format_no_longer_supported"); differences.AssertContainsOnly(new ExpectedDifference { @@ -677,7 +677,7 @@ public void CompareOAS_ShouldReturn_RequestBodyFormatNoLongerSupportedDifference [Test] public void CompareOAS_ShouldReturn_ServerNoLongerSupportedDifferences() { - var differences = CompareSpecifications("server_no_longer_supported.json"); + var differences = CompareSpecifications("server_no_longer_supported"); differences.AssertContainsOnly(new ExpectedDifference { @@ -690,7 +690,7 @@ public void CompareOAS_ShouldReturn_ServerNoLongerSupportedDifferences() [Test] public void CompareOAS_ShouldReturn_ParameterStyleChangedDifferences() { - var differences = CompareSpecifications("parameter_style_changed.json"); + var differences = CompareSpecifications("parameter_style_changed"); differences.AssertContainsOnly(new ExpectedDifference { @@ -707,7 +707,7 @@ public void CompareOAS_ShouldReturn_ParameterStyleChangedDifferences() [Test] public void CompareOAS_ShouldReturn_AddedOptionalPropertyDifferences_When_ValidPolymorphicSchema() { - var differences = CompareSpecifications("polymorphic_schema.json"); + var differences = CompareSpecifications("polymorphic_schema"); differences.AssertContainsOnly(new ExpectedDifference { @@ -723,7 +723,7 @@ public void CompareOAS_ShouldReturn_AddedOptionalPropertyDifferences_When_ValidP [Test] public void CompareOAS_ShouldReturn_Differences_When_XMsPathsExtension() { - var differences = CompareSpecifications("x-ms-paths.json"); + var differences = CompareSpecifications("x-ms-paths"); differences.AssertContains(new ExpectedDifference { @@ -748,7 +748,7 @@ public void CompareOAS_ShouldReturn_Differences_When_XMsPathsExtension() [Test] public void CompareOAS_ShouldReturn_AddedRequestBodyDifferences() { - var differences = CompareSpecifications("added_request_body.json"); + var differences = CompareSpecifications("added_request_body"); differences.AssertContainsOnly(new ExpectedDifference { @@ -761,7 +761,7 @@ public void CompareOAS_ShouldReturn_AddedRequestBodyDifferences() [Test] public void CompareOAS_ShouldReturn_RemovedRequestBodyDifferences() { - var differences = CompareSpecifications("removed_request_body.json"); + var differences = CompareSpecifications("removed_request_body"); differences.AssertContainsOnly(new ExpectedDifference { @@ -770,11 +770,11 @@ public void CompareOAS_ShouldReturn_RemovedRequestBodyDifferences() OldJsonRef = "#/paths/~1pets/post/requestBody" }); } - + [Test] public void Compare_OAS_Should_Return_Removed_Schema_When_Schema_Is_Removed_In_Response() { - var differences = CompareSpecifications("removed_schema_in_response.json"); + var differences = CompareSpecifications("removed_schema_in_response"); differences.AssertContainsOnly(new ExpectedDifference { @@ -783,11 +783,11 @@ public void Compare_OAS_Should_Return_Removed_Schema_When_Schema_Is_Removed_In_R OldJsonRef = "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema" }); } - + [Test] public void Compare_OAS_Should_Return_Added_Schema_When_Schema_Is_Added_In_Response() { - var differences = CompareSpecifications("added_schema_in_response.json"); + var differences = CompareSpecifications("added_schema_in_response"); differences.AssertContainsOnly(new ExpectedDifference { @@ -796,12 +796,12 @@ public void Compare_OAS_Should_Return_Added_Schema_When_Schema_Is_Added_In_Respo NewJsonRef = "#/paths/~1api~1Parameters/put/responses/200/content/application~1json/schema" }); } - + [Test] public void Compare_OAS_Should_Return_Nullable_Property_Changed_When_Nullable_Property_Is_Changed() { - var differences = CompareSpecifications("nullable_property_changed.json"); - + var differences = CompareSpecifications("nullable_property_changed"); + differences.AssertContainsOnly(new ExpectedDifference { Rule = ComparisonRules.NullablePropertyChanged, @@ -821,8 +821,8 @@ private static IList CompareSpecifications(string oasName) var baseDirectory = Directory.GetParent(typeof(OpenApiSpecificationsCompareTests).GetTypeInfo().Assembly.Location) .ToString(); - var oldFileName = Path.Combine(baseDirectory, "Resource", "old", oasName); - var newFileName = Path.Combine(baseDirectory, "Resource", "new", oasName); + var oldFileName = Path.Combine(baseDirectory, "Resource", "old", oasName + ".json"); + var newFileName = Path.Combine(baseDirectory, "Resource", "new", oasName + ".yaml"); var differences = OpenApiComparator.Compare( File.ReadAllText(oldFileName), diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.json deleted file mode 100644 index ef034ae..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot", - "bird" - ] - } - }, - "additionalProperties": { - "type": "string" - }, - "required": [ - "name", - "petType" - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.yaml new file mode 100644 index 0000000..5c10296 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_additional_properties.yaml @@ -0,0 +1,35 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + - bird + additionalProperties: + type: string + required: + - name + - petType diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.json deleted file mode 100644 index e2d187f..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot", - "bird" - ] - }, - "accountType": { - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_ZRS", - "Standard_GRS", - "Standard_RAGRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "AccountType", - "modelAsString": true - } - } - }, - "required": [ - "name", - "petType" - ] - } - }, - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "string", - "enum": [ - "clueless", - "adventurous" - ] - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.yaml new file mode 100644 index 0000000..7cb1807 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_enum_value.yaml @@ -0,0 +1,70 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + - bird + accountType: + type: string + enum: + - Standard_LRS + - Standard_ZRS + - Standard_GRS + - Standard_RAGRS + - Premium_LRS + x-ms-enum: + name: AccountType + modelAsString: true + required: + - name + - petType + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: string + enum: + - clueless + - adventurous diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.json deleted file mode 100644 index 26861b0..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_03", - "version": "2.0" - }, - "paths": { - "/api/Parameters": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": "dummy response", - "content": { - "application/json":{ - "schema": { - "type": "integer" - } - } - }, - "headers": { - "x-d": { } - } - } - } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null, - "headers": { - "x-a": { }, - "x-b": { }, - "x-c": { } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.yaml new file mode 100644 index 0000000..92ec5b0 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_header.yaml @@ -0,0 +1,27 @@ +openapi: 3.0.1 +info: + title: operation_check_03 + version: "2.0" +paths: + /api/Parameters: + get: + operationId: Responses_Get + responses: + "200": + description: dummy response + content: + application/json: + schema: + type: integer + headers: + x-d: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + headers: + x-a: {} + x-b: {} + x-c: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.json deleted file mode 100644 index 520b9b1..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "removed_path", - "version": "2.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - }, - "post": { - "operationId": "Paths_Post", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - }, - "head": { - "operationId": "Operations_Head", - "responses": { } - } - }, - "/api/Parameters/{a}": { - "get": { - "operationId": "Parameters_Get", - "responses": { } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.yaml new file mode 100644 index 0000000..cb6e5ac --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_operation.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.1 +info: + title: removed_path + version: "2.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + post: + operationId: Paths_Post + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} + head: + operationId: Operations_Head + responses: {} + /api/Parameters/{a}: + get: + operationId: Parameters_Get + responses: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.json deleted file mode 100644 index e10a4cc..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { "$ref": "#/components/parameters/skipParam" }, - { "$ref": "#/components/parameters/limitParam" } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.yaml new file mode 100644 index 0000000..5845f1b --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_parameter.yaml @@ -0,0 +1,32 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.json deleted file mode 100644 index 70dbe99..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "object", - "properties": { - "begin": { - "type": "integer" - }, - "end": { - "type": "integer" - } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.yaml new file mode 100644 index 0000000..c3672cf --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_optional_property.yaml @@ -0,0 +1,42 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: object + properties: + error: + type: string + message: + type: string + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: object + properties: + begin: + type: integer + end: + type: integer diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.json deleted file mode 100644 index 2e3e7b7..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "added_path", - "version": "2.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.yaml new file mode 100644 index 0000000..388065f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_path.yaml @@ -0,0 +1,13 @@ +openapi: 3.0.1 +info: + title: added_path + version: "2.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.json deleted file mode 100644 index 97117d1..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "500": { - "$ref": "#/components/responses/InternalErrorResponse" - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - }, - "petAge": { - "type": "integer" - } - } - } - }, - "responses": { - "InternalErrorResponse": { - "description": "internal error", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "required": true, - "type": "string" - } - } - } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.yaml new file mode 100644 index 0000000..ef7bfde --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_property_in_response.yaml @@ -0,0 +1,63 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + required: true + type: string + "500": + $ref: '#/components/responses/InternalErrorResponse' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + petAge: + type: integer + responses: + InternalErrorResponse: + description: internal error + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + required: true + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.json deleted file mode 100644 index 9e4163a..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "readOnly": true, - "type": "string" - } - } - } - } - } - }, - "500": { - "$ref": "#/components/responses/InternalErrorResponse" - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "readOnly": true, - "type": "string" - } - } - } - }, - "responses": { - "InternalErrorResponse": { - "description": "internal error", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "readOnly": true, - "type": "string" - } - } - } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.yaml new file mode 100644 index 0000000..35f809b --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_readOnly_property_in_response.yaml @@ -0,0 +1,62 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + readOnly: true + type: string + "500": + $ref: '#/components/responses/InternalErrorResponse' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + readOnly: true + type: string + responses: + InternalErrorResponse: + description: internal error + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + readOnly: true + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.json deleted file mode 100644 index 8bee050..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.1" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schema/Pet" - } - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/pets/{id}": { - "post": { - "description": "Post one pet according to its id", - "requestBody": { - "$ref": "#/components/requestBodies/PetBody" - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.yaml new file mode 100644 index 0000000..7bf8b7e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_request_body.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.1" +paths: + /pets: + post: + description: Post multiple pets + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string + responses: + "200": + content: + text/plain: + schema: + type: integer + /pets/{id}: + post: + description: Post one pet according to its id + requestBody: + $ref: '#/components/requestBodies/PetBody' + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + requestBodies: + PetBody: + content: + application/json: + schema: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.json deleted file mode 100644 index 635e994..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.yaml new file mode 100644 index 0000000..8205ad2 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_parameter.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.json deleted file mode 100644 index 0c0699e..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger PetStore", - "description": "A sample API that uses a petStore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system.", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "petType" - ], - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.yaml new file mode 100644 index 0000000..885faf0 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_required_property.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger PetStore + description: A sample API that uses a petStore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: Returns all pets from the system. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + required: + - message + properties: + error: + type: string + message: + type: string +components: + schemas: + Pet: + type: object + required: + - petType + properties: + name: + type: string + petType: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.json deleted file mode 100644 index a5c9fc8..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_01", - "version": "2.0" - }, - "paths": { - "/api/Path": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { - "200": { - "description": null - } - } - } - }, - "/api/Parameters/{a}": { - "get": { - "operationId": "Parameters_Get", - "responses": { } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null - }, - "202": { - "description": null - }, - "400": { - "description": null - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.yaml new file mode 100644 index 0000000..eb29d6e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_response_code.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.1 +info: + title: operation_check_01 + version: "2.0" +paths: + /api/Path: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: + "200": + description: null + /api/Parameters/{a}: + get: + operationId: Parameters_Get + responses: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + "202": + description: null + "400": + description: null diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.json deleted file mode 100644 index 26d2e52..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "Added Schema in response", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.yaml new file mode 100644 index 0000000..96e1510 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/added_schema_in_response.yaml @@ -0,0 +1,36 @@ +openapi: 3.0 +info: + title: Added Schema in response + version: "2.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: [] + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + required: + - name + - petType diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.json deleted file mode 100644 index 635e994..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.yaml new file mode 100644 index 0000000..8205ad2 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/changed_parameter_order.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.json deleted file mode 100644 index 4f7b485..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "string", - "enum": [ - "clueless", - "lazy", - "adventurous" - ] - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.yaml new file mode 100644 index 0000000..b9bb0bd --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constant_status_has_changed.yaml @@ -0,0 +1,37 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: string + enum: + - clueless + - lazy + - adventurous diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.json deleted file mode 100644 index 72fd35c..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/limitParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "maxRequest": { - "type": "integer", - "multipleOf": 200 - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "limitParam": { - "type": "object", - "properties": { - "accessKey": { - "type": "string", - "pattern": "^\\d{3}-\\d{2}-\\d{4}$" - }, - "redirectUrl": { - "type": "array", - "items": { - "type": "string" - } - }, - "constrainsItems": { - "type": "string", - "enum": [ - "item1", - "item2", - "item4" - ] - } - } - } - }, - "parameters": { - "limitParam": { - "name": "limit", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/limitParam" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.yaml new file mode 100644 index 0000000..352f5e4 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_changed.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + type: object + properties: + maxRequest: + type: integer + multipleOf: 200 +components: + schemas: + limitParam: + type: object + properties: + accessKey: + type: string + pattern: ^\d{3}-\d{2}-\d{4}$ + redirectUrl: + type: array + items: + type: string + constrainsItems: + type: string + enum: + - item1 + - item2 + - item4 + parameters: + limitParam: + name: limit + in: query + required: true + schema: + $ref: '#/components/schemas/limitParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.json deleted file mode 100644 index ad457a9..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/limitParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "maximum": 400 - }, - "constrainsItems": { - "type": "string", - "enum": [ - "item1", - "item3" - ] - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "limitParam": { - "type": "object", - "properties": { - "minLimit": { - "type": "integer", - "maximum": 400 - }, - "maxLimit": { - "type": "integer" - }, - "exclusiveMin": { - "type": "integer", - "minimum": 500 - }, - "maxTextSize": { - "type": "string", - "maxLength": 150 - }, - "minTextSize": { - "type": "string", - "minLength": 200 - }, - "accessKey": { - "type": "string" - }, - "redirectUrl": { - "type": "array", - "minItems": 200, - "maxItems": 400, - "items": { - "type": "string" - } - } - } - } - }, - "parameters": { - "limitParam": { - "name": "limit", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/limitParam" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.yaml new file mode 100644 index 0000000..b9fdfa3 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_stronger.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + type: object + properties: + code: + type: integer + maximum: 400 + constrainsItems: + type: string + enum: + - item1 + - item3 +components: + schemas: + limitParam: + type: object + properties: + minLimit: + type: integer + maximum: 400 + maxLimit: + type: integer + exclusiveMin: + type: integer + minimum: 500 + maxTextSize: + type: string + maxLength: 150 + minTextSize: + type: string + minLength: 200 + accessKey: + type: string + redirectUrl: + type: array + minItems: 200 + maxItems: 400 + items: + type: string + parameters: + limitParam: + name: limit + in: query + required: true + schema: + $ref: '#/components/schemas/limitParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.json deleted file mode 100644 index be76ff0..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/limitParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "maximum": 500 - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "limitParam": { - "type": "object", - "properties": { - "minLimit": { - "type": "integer", - "maximum": 500 - }, - "exclusiveMin": { - "type": "integer", - "minimum": 400 - }, - "maxTextSize": { - "type": "string", - "maxLength": 200 - }, - "minTextSize": { - "type": "string", - "minLength": 100 - }, - "redirectUrl": { - "type": "array", - "maxItems": 500, - "items": { - "type": "string" - } - }, - "constrainsItems": { - "type": "string", - "enum": [ - "item1", - "item2", - "item3" - ] - } - } - } - }, - "parameters": { - "limitParam": { - "name": "limit", - "in": "query", - "required": true, - "schema": { - "$ref": "#/components/schemas/limitParam" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.yaml new file mode 100644 index 0000000..4c66770 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/constraint_is_weaker.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/limitParam' + responses: + "200": + content: + application/json: + schema: + type: object + properties: + code: + type: integer + maximum: 500 +components: + schemas: + limitParam: + type: object + properties: + minLimit: + type: integer + maximum: 500 + exclusiveMin: + type: integer + minimum: 400 + maxTextSize: + type: string + maxLength: 200 + minTextSize: + type: string + minLength: 100 + redirectUrl: + type: array + maxItems: 500 + items: + type: string + constrainsItems: + type: string + enum: + - item1 + - item2 + - item3 + parameters: + limitParam: + name: limit + in: query + required: true + schema: + $ref: '#/components/schemas/limitParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.json deleted file mode 100644 index 2759444..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "description": "Error schema", - "type": "string", - "default": "NewDefaultError" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "default": "newDefaultPetName" - }, - "tag": { - "type": "string", - "default": "DefaultTag" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.yaml new file mode 100644 index 0000000..6f69dbb --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/default_value_changed.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: default response + content: + application/json: + schema: + description: Error schema + type: string + default: NewDefaultError +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + default: newDefaultPetName + tag: + type: string + default: DefaultTag diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.json deleted file mode 100644 index 91c2318..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/pets": { - "get": { - "parameters": [ - { "$ref": "#/components/parameters/petParam" } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "code" - ], - "allOf": [ - { "$ref": "#/components/schemas/Pet" } - ] - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - }, - "required": [ - "name", - "petType" - ] - }, - "Cat": { - "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Dog" - }, - { - "type": "object", - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - } - ] - }, - "Dog": { - "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "type": "object", - "properties": { - "packSize": { - "type": "integer", - "format": "int32", - "description": "the size of the pack the dog is from", - "default": 0, - "minimum": 0 - } - }, - "required": [ - "packSize" - ] - } - ] - } - }, - "parameters": { - "petParam": { - "name": "pet", - "in": "query", - "required": true, - "schema": { - "allOf": [ - { "$ref": "#/components/schemas/Pet" }, - { "$ref": "#/components/schemas/Cat" } - ] - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.yaml new file mode 100644 index 0000000..cca72ad --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_allOf.yaml @@ -0,0 +1,77 @@ +openapi: 3.0.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /pets: + get: + parameters: + - $ref: '#/components/parameters/petParam' + responses: + "200": + content: + application/json: + schema: + type: object + required: + - message + - code + allOf: + - $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Cat: + description: A representation of a cat. Note that `Cat` will be used as the discriminator value. + allOf: + - $ref: '#/components/schemas/Dog' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: + description: A representation of a dog. Note that `Dog` will be used as the discriminator value. + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize + parameters: + petParam: + name: pet + in: query + required: true + schema: + allOf: + - $ref: '#/components/schemas/Pet' + - $ref: '#/components/schemas/Cat' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.json deleted file mode 100644 index f9a8ede..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": { - "type": "object", - "discriminator": { - "propertyName": "newDiscriminator" - }, - "properties": { - "error": { - "type": "string" - } - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "discriminator": { - "propertyName": "error" - }, - "properties": { - "error": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.yaml new file mode 100644 index 0000000..a46bf5a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/different_discriminator.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "201": + description: Created + content: + application/json: + schema: + type: object + discriminator: + propertyName: newDiscriminator + properties: + error: + type: string + "404": + description: not found response + content: + application/json: + schema: + type: object + discriminator: + propertyName: error + properties: + error: + type: string +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.json deleted file mode 100644 index f2cb648..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "type_changed", - "version": "2.0" - }, - "paths": { - "/api/Parameters": { - "get": { - "operationId": "Parameters_Get", - "responses": { } - }, - "put": { - "operationId": "Parameters_Put", - "parameters": [ - { - "name": "database", - "required": true - } - ], - "responses": { }, - "x-ms-long-running-operation": true - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.yaml new file mode 100644 index 0000000..ac0b014 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/long_running_operation.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: type_changed + version: "2.0" +paths: + /api/Parameters: + get: + operationId: Parameters_Get + responses: {} + put: + operationId: Parameters_Put + parameters: + - name: database + required: true + responses: {} + x-ms-long-running-operation: true diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.json deleted file mode 100644 index 531d79e..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "changed_operation_id", - "version": "2.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_List", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "responses": { } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.yaml new file mode 100644 index 0000000..a3700dc --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/modified_operation_id.yaml @@ -0,0 +1,15 @@ +openapi: 3.0.1 +info: + title: changed_operation_id + version: "2.0" +paths: + /api/Paths: + get: + operationId: Paths_List + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.json deleted file mode 100644 index 1f7a8f3..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "version_check_02", - "version": "1.0" - }, - "paths": { } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.yaml new file mode 100644 index 0000000..cbcb1af --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/no_version_change.yaml @@ -0,0 +1,5 @@ +openapi: 3.0.1 +info: + title: version_check_02 + version: "1.0" +paths: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.json deleted file mode 100644 index 1597791..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string", - "nullable": false - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.yaml new file mode 100644 index 0000000..faa359a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/nullable_property_changed.yaml @@ -0,0 +1,35 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + tag: + type: string + nullable: false diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.json deleted file mode 100644 index 54b861c..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - }, - { - "$ref": "#/components/parameters/limitParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "header", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "header", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.yaml new file mode 100644 index 0000000..1af3851 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_in_has_changed.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + - $ref: '#/components/parameters/limitParam' +components: + parameters: + skipParam: + name: skipParam + in: header + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: header + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.json deleted file mode 100644 index 2b10a8f..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.0" - }, - "paths": { - "/pets": { - "get": { - "description": "Get all pets from Petstore", - "parameters": [ - { - "name": "pageParam", - "in": "query", - "style": "pipeDelimited" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - }, - "/pets/{id}": { - "parameters": [ - { - "name": "PetId", - "in": "path", - "required": true, - "style": "matrix" - } - ], - "post": { - "description": "Register a new pet", - "parameters": [ - { - "$ref": "#/components/parameters/PetParameter" - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - }, - "parameters": { - "PetParameter": { - "name": "PetParameter", - "in": "query", - "style": "deepObject", - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.yaml new file mode 100644 index 0000000..a299e5a --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/parameter_style_changed.yaml @@ -0,0 +1,52 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.0" +paths: + /pets: + get: + description: Get all pets from Petstore + parameters: + - name: pageParam + in: query + style: pipeDelimited + responses: + "200": + description: OK + content: + application/json: + schema: + type: string + /pets/{id}: + parameters: + - name: PetId + in: path + required: true + style: matrix + post: + description: Register a new pet + parameters: + - $ref: '#/components/parameters/PetParameter' + responses: + "200": + description: OK + content: + application/json: + schema: + type: string +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + parameters: + PetParameter: + name: PetParameter + in: query + style: deepObject + schema: + $ref: '#/components/schemas/Pet' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.json deleted file mode 100644 index fe43a59..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0", - "title": "OpenApi Petstore" - }, - "servers": [ - { - "url": "https://petstore.openapi.io/v1" - } - ], - "paths": { - "/pets": { - "put": { - "summary": "Add a pet", - "operationId": "addPet", - "tags": [ - "pets" - ], - "parameters": [ - { - "name": "Pet parameter", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "PetWithoutDiscriminator": { - "properties": { - "petKind": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "name", - "petKind" - ] - }, - "Pet": { - "discriminator": { - "propertyName": "petKind" - }, - "properties": { - "petKind": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "name", - "petKind" - ] - }, - "Cat": { - "description": "A representation of a cat", - "allOf": [ - { - "$ref": "#/components/schemas/PetWithoutDiscriminator" - }, - { - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - } - ], - "properties": { - "breed": { - "type": "string" - } - } - }, - "Dog": { - "description": "A representation of a dog", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "properties": { - "packSize": { - "type": "integer", - "format": "int32", - "description": "the size of the pack the dog is from", - "default": 0, - "minimum": 0 - } - }, - "required": [ - "packSize" - ] - } - ], - "properties": { - "breed": { - "type": "string" - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.yaml new file mode 100644 index 0000000..2612538 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/polymorphic_schema.yaml @@ -0,0 +1,82 @@ +openapi: 3.0.0 +info: + version: "2.0" + title: OpenApi Petstore +servers: + - url: https://petstore.openapi.io/v1 +paths: + /pets: + put: + summary: Add a pet + operationId: addPet + tags: + - pets + parameters: + - name: Pet parameter + in: query + schema: + $ref: '#/components/schemas/Pet' + responses: + "200": + description: OK + content: + application/json: + schema: + type: string +components: + schemas: + PetWithoutDiscriminator: + properties: + petKind: + type: string + name: + type: string + required: + - name + - petKind + Pet: + discriminator: + propertyName: petKind + properties: + petKind: + type: string + name: + type: string + required: + - name + - petKind + Cat: + description: A representation of a cat + allOf: + - $ref: '#/components/schemas/PetWithoutDiscriminator' + - properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + properties: + breed: + type: string + Dog: + description: A representation of a dog + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize + properties: + breed: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.json deleted file mode 100644 index ed833d1..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "description": "Error schema", - "type": "string", - "readOnly": false - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "readOnly": true - }, - "tag": { - "type": "string", - "readOnly": true - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.yaml new file mode 100644 index 0000000..fa337a9 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/readonly_property_changed.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: default response + content: + application/json: + schema: + description: Error schema + type: string + readOnly: false +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + readOnly: true + tag: + type: string + readOnly: true diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.json deleted file mode 100644 index 5cfa924..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "recursive_model", - "version": "2.0" - }, - "servers": [{ - "url": "http:localhost:8000" - }], - "paths": { - "/api/Operations": { - "post": { - "tag": [ "Operations" ], - "operationId": "Operations_Post", - "parameters": [ - { - "name": "accountName", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/CreateParam" - }, - "description": "Create Param." - } - ], - "responses": { - "200": { - "description": "OK" - }, - "default": { - "description": "BadRequest", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/CloudError" } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "CloudError": { - "description": "Error from a REST request.", - "type": "object", - "properties": { "error": { "$ref": "#/components/schemas/CloudErrorBody" } }, - "x-ms-external": true - }, - "CloudErrorBody": { - "description": "Body of an error from a REST request.", - "type": "object", - "properties": { - "code": { "type": "string" }, - "message": { "type": "string", "readOnly": true }, - "target": { "type": "string" }, - "details": { - "description": "Inner errors.", - "type": "array", - "items": { "$ref": "#/components/schemas/CloudErrorBody" } - } - } - }, - "CreateParam": { - "description": "Create Param a REST request.", - "type": "object", - "properties": { "error": { "$ref": "#/components/schemas/CreateParamBody" } }, - "x-ms-external": true - }, - "CreateParamBody": { - "description": "Create Param Body a REST request.", - "type": "object", - "properties": { - "code": { "type": "string" }, - "message": { "type": "string" }, - "details": { - "description": "Inner errors.", - "type": "array", - "items": { "$ref": "#/components/schemas/CreateParam" } - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.yaml new file mode 100644 index 0000000..69ba57d --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/recursive_model.yaml @@ -0,0 +1,73 @@ +openapi: 3.0 +info: + title: recursive_model + version: "2.0" +servers: + - url: http:localhost:8000 +paths: + /api/Operations: + post: + tag: + - Operations + operationId: Operations_Post + parameters: + - name: accountName + in: path + required: true + schema: + $ref: '#/components/schemas/CreateParam' + description: Create Param. + responses: + "200": + description: OK + default: + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/CloudError' +components: + schemas: + CloudError: + description: Error from a REST request. + type: object + properties: + error: + $ref: '#/components/schemas/CloudErrorBody' + x-ms-external: true + CloudErrorBody: + description: Body of an error from a REST request. + type: object + properties: + code: + type: string + message: + type: string + readOnly: true + target: + type: string + details: + description: Inner errors. + type: array + items: + $ref: '#/components/schemas/CloudErrorBody' + CreateParam: + description: Create Param a REST request. + type: object + properties: + error: + $ref: '#/components/schemas/CreateParamBody' + x-ms-external: true + CreateParamBody: + description: Create Param Body a REST request. + type: object + properties: + code: + type: string + message: + type: string + details: + description: Inner errors. + type: array + items: + $ref: '#/components/schemas/CreateParam' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.json deleted file mode 100644 index 7d7fc11..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { "url": "http://localhost:8000" } - ], - "paths": { - "/api/Parameters": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Cat" - } - } - } - } - }, - "400": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Cat" - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string" - } - }, - "required": [ - "name", - "petType" - ] - }, - "Dog": { - "type": "object", - "properties": { - "breed": { - "type": "string" - } - }, - "required": [ - "name", - "petType" - ] - }, - "Cat": { - "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", - "allOf": [ - { - "$ref": "#/components/schemas/Pet" - }, - { - "type": "object", - "properties": { - "huntingSkill": { - "type": "string", - "description": "The measured skill for hunting", - "default": "lazy", - "enum": [ - "clueless", - "lazy", - "adventurous", - "aggressive" - ] - } - }, - "required": [ - "huntingSkill" - ] - } - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.yaml new file mode 100644 index 0000000..9a51920 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/reference_redirection.yaml @@ -0,0 +1,63 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + get: + responses: + "200": + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Cat' + "400": + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Cat' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Dog: + type: object + properties: + breed: + type: string + required: + - name + - petType + Cat: + description: A representation of a cat. Note that `Cat` will be used as the discriminator value. + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + default: lazy + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.json deleted file mode 100644 index 85becb4..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot", - "bird" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - }, - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.yaml new file mode 100644 index 0000000..4dea052 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_additional_properties.yaml @@ -0,0 +1,48 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + - bird + required: + - name + - petType + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.json deleted file mode 100644 index fd797a9..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { "url": "http://localhost:8000" } - ], - "paths": { - "/api/Parameters": { - "put": { - "parameters": [ - { "$ref": "#/components/parameters/skipParam" } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skip", - "in": "query", - "description": "number of items to skip", - "schema": { - "type": "integer", - "format": "int32" - } - } - } - } -} - diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.yaml new file mode 100644 index 0000000..90ddd1f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_client_parameter.yaml @@ -0,0 +1,20 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + parameters: + - $ref: '#/components/parameters/skipParam' +components: + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.json deleted file mode 100644 index 0efc974..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { "url": "http://localhost:8000" } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/limitParam" - }, - { - "name": "skipParam", - "in": "query", - "description": "max records to skip", - "required": true, - "schema" : { - "$ref": "#/components/schemas/Pet" - } - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - }, - "parameters": { - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "string", - "enum": [ - "clueless", - "adventurous" - ] - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.yaml new file mode 100644 index 0000000..4bf2a47 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_enum_value.yaml @@ -0,0 +1,54 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/limitParam' + - name: skipParam + in: query + description: max records to skip + required: true + schema: + $ref: '#/components/schemas/Pet' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + required: + - name + - petType + parameters: + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: string + enum: + - clueless + - adventurous diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.json deleted file mode 100644 index ee58c42..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_03", - "version": "2.0" - }, - "paths": { - "/api/Parameters": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null, - "headers": { - "x-b": { - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null, - "headers": { - "x-a": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.yaml new file mode 100644 index 0000000..906ff0f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_header.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.1 +info: + title: operation_check_03 + version: "2.0" +paths: + /api/Parameters: + get: + operationId: Responses_Get + responses: + "200": + description: null + headers: + x-b: + schema: + type: integer + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + headers: + x-a: + schema: + type: integer diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.json deleted file mode 100644 index 3e92c3c..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "removed_operation", - "version": "2.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.yaml new file mode 100644 index 0000000..4f61ba6 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_operation.yaml @@ -0,0 +1,13 @@ +openapi: 3.0.1 +info: + title: removed_operation + version: "2.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.json deleted file mode 100644 index a871074..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "removed_path", - "version": "2.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.yaml new file mode 100644 index 0000000..0813824 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_path.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.1 +info: + title: removed_path + version: "2.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.json deleted file mode 100644 index f02b554..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "description": "Updated name of the pet", - "type": "string" - } - }, - "required": [ - "status" - ] - } - } - } - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "404": { - "description": "not found response", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.yaml new file mode 100644 index 0000000..33a507b --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_property.yaml @@ -0,0 +1,52 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + required: + - status + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + "404": + description: not found response + content: + application/json: + schema: + type: object + properties: + error: + type: string +components: + schemas: + Pet: + type: object + properties: + name: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.json deleted file mode 100644 index cf22ba2..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.1" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/pets/{id}": { - "post": { - "description": "Post one pet according to its id", - "requestBody": { - "$ref": "#/components/requestBodies/PetBody" - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.yaml new file mode 100644 index 0000000..1910894 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_request_body.yaml @@ -0,0 +1,46 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.1" +paths: + /pets: + post: + description: Post multiple pets + responses: + "200": + content: + text/plain: + schema: + type: integer + /pets/{id}: + post: + description: Post one pet according to its id + requestBody: + $ref: '#/components/requestBodies/PetBody' + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + requestBodies: + PetBody: + content: + application/json: + schema: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.json deleted file mode 100644 index bbe902d..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [ - { - "$ref": "#/components/parameters/skipParam" - } - ] - } - } - }, - "components": { - "parameters": { - "skipParam": { - "name": "skipParam", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - "limitParam": { - "name": "limitParam", - "in": "query", - "description": "max records to return", - "required": true, - "schema" : { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.yaml new file mode 100644 index 0000000..f00143f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_required_parameter.yaml @@ -0,0 +1,33 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: + - $ref: '#/components/parameters/skipParam' +components: + parameters: + skipParam: + name: skipParam + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limitParam + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.json deleted file mode 100644 index 10f8c62..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "operation_check_01", - "version": "2.0" - }, - "paths": { - "/api/Path": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - }, - "/api/Parameters/{a}": { - "get": { - "operationId": "Parameters_Get", - "responses": { } - } - }, - "/api/Responses": { - "get": { - "operationId": "Responses_Get", - "responses": { - "200": { - "description": null - }, - "400": { - "description": null - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.yaml new file mode 100644 index 0000000..fd74e1e --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_response_code.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.1 +info: + title: operation_check_01 + version: "2.0" +paths: + /api/Path: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} + /api/Parameters/{a}: + get: + operationId: Parameters_Get + responses: {} + /api/Responses: + get: + operationId: Responses_Get + responses: + "200": + description: null + "400": + description: null diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.json deleted file mode 100644 index be26868..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "removed_definition", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - }, - { - "url":"https://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Database" - } - } - } - } - }, - "get": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Get", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Database" - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Database": { - "description": "Database schema", - "properties": { - "a": { - "type": "string", - "readOnly": true, - "description": "This is a system generated property.\nThe _rid value is empty for this operation." - }, - "b": { - "type": "integer", - "readOnly": true, - "default": 0, - "description": "This property shows the number of databases returned." - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.yaml new file mode 100644 index 0000000..a89e3b7 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema.yaml @@ -0,0 +1,43 @@ +openapi: 3.0 +info: + title: removed_definition + version: "2.0" +servers: + - url: http://localhost:8000 + - url: https://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Database' + get: + tags: + - Parameters + operationId: Parameters_Get + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Database' +components: + schemas: + Database: + description: Database schema + properties: + a: + type: string + readOnly: true + description: |- + This is a system generated property. + The _rid value is empty for this operation. + b: + type: integer + readOnly: true + default: 0 + description: This property shows the number of databases returned. diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.json deleted file mode 100644 index fc4a920..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "openapi": 3.0, - "info": { - "title": "Added Schema in response", - "version": "2.0" - }, - "servers": [ - { - "url": "http://localhost:8000" - } - ], - "paths": { - "/api/Parameters": { - "put": { - "tags": [ "Parameters" ], - "operationId": "Parameters_Put", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "discriminator": { - "propertyName": "petType" - }, - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dot" - ] - } - }, - "required": [ - "name", - "petType" - ] - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.yaml new file mode 100644 index 0000000..e0504f2 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/removed_schema_in_response.yaml @@ -0,0 +1,34 @@ +openapi: 3.0 +info: + title: Added Schema in response + version: "2.0" +servers: + - url: http://localhost:8000 +paths: + /api/Parameters: + put: + tags: + - Parameters + operationId: Parameters_Put + parameters: [] + responses: + "200": + content: + application/json: {} +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dot + required: + - name + - petType diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.json deleted file mode 100644 index 492a2f3..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.0" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schema/Pet" - } - } - } - } - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - }, - "/pets/{id}": { - "post": { - "description": "Post one pet according to its id", - "requestBody": { - "$ref": "#/components/requestBodies/PetBody" - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - }, - "Error": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.yaml new file mode 100644 index 0000000..0d61d83 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_no_longer_supported.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.0" +paths: + /pets: + post: + description: Post multiple pets + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schema/Pet' + responses: + "200": + content: + text/plain: + schema: + type: integer + /pets/{id}: + post: + description: Post one pet according to its id + requestBody: + $ref: '#/components/requestBodies/PetBody' + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + Error: + type: object + properties: + error: + type: string + message: + type: string + requestBodies: + PetBody: + content: + application/json: + schema: + $ref: '#/components/schema/Pet' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.json deleted file mode 100644 index b61d03e..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.1" - }, - "paths": { - "/pets": { - "post": { - "description": "Post multiple pets", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schema/Pet" - } - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - }, - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - } - }, - "requestBodies": { - "PetBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schema/Pet" - } - }, - "application/xml": { - "schema": { - "type": "string" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.yaml new file mode 100644 index 0000000..89541b5 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/request_body_format_now_supported.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.1" +paths: + /pets: + post: + description: Post multiple pets + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string + responses: + "200": + content: + text/plain: + schema: + type: integer +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + requestBodies: + PetBody: + content: + application/json: + schema: + $ref: '#/components/schema/Pet' + application/xml: + schema: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.json deleted file mode 100644 index 8fe71a5..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "tags to filter by", - "required": false, - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "$ref": "#/components/parameters/limit" - } - - ], - "requestBody": { - "description": "Pets payload", - "content": { - "application/json": { - "schema": { - "description": "body description", - "properties": { - "eyesColor": { - "type": "string" - }, - "petType": { - "type": "string" - } - } - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - }, - "parameters": { - "limit": { - "name": "limit", - "in": "query", - "description": "maximum number of results to return", - "required": false, - "schema": { - "type": "integer", - "format": "int32" - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.yaml new file mode 100644 index 0000000..8f92856 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/required_status_changed.yaml @@ -0,0 +1,68 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + style: form + schema: + type: array + items: + type: string + - $ref: '#/components/parameters/limit' + requestBody: + description: Pets payload + content: + application/json: + schema: + description: body description + properties: + eyesColor: + type: string + petType: + type: string + required: true + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + parameters: + limit: + name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.json deleted file mode 100644 index 1961ec1..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.0" - }, - "paths": { - "/pets": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#components/schemas/Pet" - } - } - }, - "application/xml": { - "schema": { - "type": "array", - "items": { - "$ref": "#components/schemas/Pet" - } - } - } - } - } - } - } - }, - "/pets/{id}": { - "get": { - "responses": { - "200": { - "content": { - "text/plain": { - "schema": { - "type": "integer" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - }, - "application/xml": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "404": { - "$ref": "#/components/responses/ErrorResponse" - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "petType": { - "type": "string", - "enum": [ - "cat", - "dog" - ] - } - } - }, - "Error": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - } - } - }, - "responses": { - "ErrorResponse": { - "content": { - "text/plain": { - "schema": { - "type": "string" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.yaml new file mode 100644 index 0000000..3380e27 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/response_body_format_now_supported.yaml @@ -0,0 +1,64 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.0" +paths: + /pets: + get: + responses: + "200": + content: + application/json: + schema: + type: array + items: + $ref: '#components/schemas/Pet' + application/xml: + schema: + type: array + items: + $ref: '#components/schemas/Pet' + /pets/{id}: + get: + responses: + "200": + content: + text/plain: + schema: + type: integer + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + "404": + $ref: '#/components/responses/ErrorResponse' +components: + schemas: + Pet: + type: object + properties: + name: + type: string + petType: + type: string + enum: + - cat + - dog + Error: + type: object + properties: + error: + type: string + message: + type: string + responses: + ErrorResponse: + content: + text/plain: + schema: + type: string + application/json: + schema: + $ref: '#/components/schemas/Error' diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.json deleted file mode 100644 index d6e78cb..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Petstore API", - "version": "2.0" - }, - "servers": [ - { - "url": "https://development.gigantic-server.com/v1" - } - ] -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.yaml new file mode 100644 index 0000000..2c45f86 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/server_no_longer_supported.yaml @@ -0,0 +1,6 @@ +openapi: 3.0.0 +info: + title: Petstore API + version: "2.0" +servers: + - url: https://development.gigantic-server.com/v1 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.json deleted file mode 100644 index ad63bdc..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "description": "Error schema", - "type": "string" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "UnreferencedSchema": { - "type": "string" - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.yaml new file mode 100644 index 0000000..847449f --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_changed.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: default response + content: + application/json: + schema: + description: Error schema + type: string +components: + schemas: + Pet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + UnreferencedSchema: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.json deleted file mode 100644 index 660f205..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "openapi": "3.0", - "info": { - "version": "2.0.0", - "title": "Pet store", - "description": "Pet store." - }, - "paths": { - "/pets": { - "get": { - "parameters:": [ - { - "$ref": "#/components/parameters/skipParam" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "description": "Just a Pet.", - "type": "object", - "properties": { - "sleepTime": { - "description": "How much time does he sleep.", - "type": "integer", - "format": "int64" - }, - "numberOfEyes": { - "description": "No question asked.", - "type": "string", - "format": "url" - } - } - } - }, - "parameters": { - "skipParam": { - "name": "skip", - "in": "query", - "description": "number of items to skip", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.yaml new file mode 100644 index 0000000..14e37ed --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/type_format_changed.yaml @@ -0,0 +1,39 @@ +openapi: "3.0" +info: + version: 2.0.0 + title: Pet store + description: Pet store. +paths: + /pets: + get: + 'parameters:': + - $ref: '#/components/parameters/skipParam' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +components: + schemas: + Pet: + description: Just a Pet. + type: object + properties: + sleepTime: + description: How much time does he sleep. + type: integer + format: int64 + numberOfEyes: + description: No question asked. + type: string + format: url + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int64 diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.json deleted file mode 100644 index 33e1b40..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "version": "2.0.0", - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "Swagger API Team", - "email": "apiteam@swagger.io", - "url": "http://swagger.io" - }, - "license": { - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "tags to filter by", - "required": false, - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "limit", - "in": "query", - "description": "maximum number of results to return", - "required": false, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pet" - } - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "post": { - "description": "Creates a new pet in the store. Duplicates are allowed", - "operationId": "addPet", - "requestBody": { - "description": "Pet to add to the store", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NewPet" - } - } - } - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/pets/{id}": { - "get": { - "description": "Returns a user based on a single ID, if the user does not have access to the pet", - "operationId": "find pet by id", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to fetch", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pet" - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "delete": { - "description": "deletes a single pet based on the ID supplied", - "operationId": "deletePet", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to delete", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "204": { - "description": "pet deleted" - }, - "default": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Pet": { - "allOf": [ - { - "$ref": "#/components/schemas/NewPet" - }, - { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - } - } - } - ] - }, - "NewPet": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "Error": { - "type": "object", - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } -} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.yaml new file mode 100644 index 0000000..0121b26 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/valid_oas.yaml @@ -0,0 +1,156 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification + termsOfService: http://swagger.io/terms/ + contact: + name: Swagger API Team + email: apiteam@swagger.io + url: http://swagger.io + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + style: form + schema: + type: array + items: + type: string + - name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 + responses: + "200": + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + description: Creates a new pet in the store. Duplicates are allowed + operationId: addPet + requestBody: + description: Pet to add to the store + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NewPet' + responses: + "200": + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /pets/{id}: + get: + description: Returns a user based on a single ID, if the user does not have access to the pet + operationId: find pet by id + parameters: + - name: id + in: path + description: ID of pet to fetch + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + description: deletes a single pet based on the ID supplied + operationId: deletePet + parameters: + - name: id + in: path + description: ID of pet to delete + required: true + schema: + type: integer + format: int64 + responses: + "204": + description: pet deleted + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' +components: + schemas: + Pet: + allOf: + - $ref: '#/components/schemas/NewPet' + - type: object + required: + - id + properties: + id: + type: integer + format: int64 + NewPet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + Error: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.json deleted file mode 100644 index 1f7a8f3..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "version_check_02", - "version": "1.0" - }, - "paths": { } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.yaml new file mode 100644 index 0000000..cbcb1af --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/version_reversed.yaml @@ -0,0 +1,5 @@ +openapi: 3.0.1 +info: + title: version_check_02 + version: "1.0" +paths: {} diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.json b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.json deleted file mode 100644 index 4d7d55d..0000000 --- a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "X-ms-paths", - "version": "2.0" - }, - "paths": { - "/api/Paths": { - "get": { - "operationId": "Paths_Get", - "responses": { } - } - }, - "/api/Operations": { - "get": { - "operationId": "Operations_Get", - "responses": { } - }, - "post": { - "operationId": "Operations_Post", - "responses": { } - } - } - }, - "x-ms-paths": { - "/myPath/query-drive?op=folder": { - "get": { - "parameters": [ - { - "name": "id", - "in": "query", - "description": "ID of pet to use", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "style": "simple" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Dog" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Dog": { - "type": "object", - "properties": { - "playWith": { - "type": "string" - }, - "enjoyWalk": { - "type": "boolean" - } - } - }, - "Cat": { - "type": "object", - "properties": { - "food": { - "type": "string" - }, - "sleepTime": { - "type": "string" - } - } - } - } - } -} \ No newline at end of file diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.yaml new file mode 100644 index 0000000..cd0dbb4 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/new/x-ms-paths.yaml @@ -0,0 +1,51 @@ +openapi: 3.0.1 +info: + title: X-ms-paths + version: "2.0" +paths: + /api/Paths: + get: + operationId: Paths_Get + responses: {} + /api/Operations: + get: + operationId: Operations_Get + responses: {} + post: + operationId: Operations_Post + responses: {} +x-ms-paths: + /myPath/query-drive?op=folder: + get: + parameters: + - name: id + in: query + description: ID of pet to use + required: true + schema: + type: array + items: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Dog' +components: + schemas: + Dog: + type: object + properties: + playWith: + type: string + enjoyWalk: + type: boolean + Cat: + type: object + properties: + food: + type: string + sleepTime: + type: string diff --git a/src/Criteo.OpenApi.Comparator.UTest/Resource/openapi_specification.yaml b/src/Criteo.OpenApi.Comparator.UTest/Resource/openapi_specification.yaml new file mode 100644 index 0000000..7bb4298 --- /dev/null +++ b/src/Criteo.OpenApi.Comparator.UTest/Resource/openapi_specification.yaml @@ -0,0 +1,156 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification + termsOfService: http://swagger.io/terms/ + contact: + name: Swagger API Team + email: apiteam@swagger.io + url: http://swagger.io + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + style: form + schema: + type: array + items: + type: string + - name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 + responses: + '200': + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + description: Creates a new pet in the store. Duplicates are allowed + operationId: addPet + requestBody: + description: Pet to add to the store + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NewPet' + responses: + '200': + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /pets/{id}: + get: + description: Returns a user based on a single ID, if the user does not have access to the pet + operationId: find pet by id + parameters: + - name: id + in: path + description: ID of pet to fetch + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + description: deletes a single pet based on the ID supplied + operationId: deletePet + parameters: + - name: id + in: path + description: ID of pet to delete + required: true + schema: + type: integer + format: int64 + responses: + '204': + description: pet deleted + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' +components: + schemas: + Pet: + allOf: + - $ref: '#/components/schemas/NewPet' + - type: object + required: + - id + properties: + id: + type: integer + format: int64 + NewPet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + Error: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/src/Criteo.OpenApi.Comparator/Parser/OpenApiParser.cs b/src/Criteo.OpenApi.Comparator/Parser/OpenApiParser.cs index 33f9fca..386b282 100644 --- a/src/Criteo.OpenApi.Comparator/Parser/OpenApiParser.cs +++ b/src/Criteo.OpenApi.Comparator/Parser/OpenApiParser.cs @@ -1,10 +1,11 @@ // Copyright (c) Criteo Technology. All rights reserved. // Licensed under the Apache 2.0 License. See LICENSE in the project root for license information. -using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.Writers; +using System.IO; namespace Criteo.OpenApi.Comparator.Parser { @@ -16,16 +17,6 @@ internal static class OpenApiParser /// Swagger as string internal static JsonDocument Parse(string openApiDocumentAsString) { - var settings = new JsonSerializerSettings - { - MaxDepth = 128, - TypeNameHandling = TypeNameHandling.None, - MetadataPropertyHandling = MetadataPropertyHandling.Ignore - }; - settings.Converters.Add(new PathLevelParameterConverter(openApiDocumentAsString)); - - var raw = JToken.Parse(openApiDocumentAsString); - var openApiReaderSettings = new OpenApiReaderSettings { ReferenceResolution = ReferenceResolutionSetting.DoNotResolveReferences @@ -33,7 +24,13 @@ internal static JsonDocument Parse(string openApiDocumentAsStri var openApiReader = new OpenApiStringReader(openApiReaderSettings); var openApiDocument = openApiReader.Read(openApiDocumentAsString, out _); - return raw.ToJsonDocument(openApiDocument); + var textWriter = new StringWriter(); + var openApiWriter = new OpenApiJsonWriter(textWriter); + openApiDocument.SerializeAsV3(openApiWriter); + var openApiDocumentAsJson = textWriter.ToString(); + var parsedJson = JToken.Parse(openApiDocumentAsJson); + + return parsedJson.ToJsonDocument(openApiDocument); } } }