diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java index f4a1682f6..2850e0f17 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java @@ -44,6 +44,13 @@ public DiffResult isCoreChanged() { && !changedBearerFormat && !changedOpenIdConnectUrl && (changedScopes == null || changedScopes.getIncreased().isEmpty())) { + + // TODO: Dead code removal opportunity for changedType and changedIn. It appears that + // SecuritySchemaDiff will never be given the chance to detect differences TYPE and + // IN differences because that case has already been detected and filtered out by + // SecurityRequirementsDiff and recorded as a dropped requirement in + // ChangedSecurityRequirements. + return DiffResult.COMPATIBLE; } return DiffResult.INCOMPATIBLE; diff --git a/core/src/test/java/org/openapitools/openapidiff/core/BackwardCompatibilityTest.java b/core/src/test/java/org/openapitools/openapidiff/core/BackwardCompatibilityTest.java deleted file mode 100644 index 612700ca7..000000000 --- a/core/src/test/java/org/openapitools/openapidiff/core/BackwardCompatibilityTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.openapitools.openapidiff.core; - -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardCompatible; -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; - -import org.junit.jupiter.api.Test; - -public class BackwardCompatibilityTest { - private final String OPENAPI_DOC1 = "backwardCompatibility/bc_1.yaml"; - private final String OPENAPI_DOC2 = "backwardCompatibility/bc_2.yaml"; - private final String OPENAPI_DOC3 = "backwardCompatibility/bc_3.yaml"; - private final String OPENAPI_DOC4 = "backwardCompatibility/bc_4.yaml"; - private final String OPENAPI_DOC5 = "backwardCompatibility/bc_5.yaml"; - - @Test - public void testNoChange() { - assertOpenApiBackwardCompatible(OPENAPI_DOC1, OPENAPI_DOC1, false); - } - - @Test - public void testApiAdded() { - assertOpenApiBackwardCompatible(OPENAPI_DOC1, OPENAPI_DOC2, true); - } - - @Test - public void testApiMissing() { - assertOpenApiBackwardIncompatible(OPENAPI_DOC2, OPENAPI_DOC1); - } - - @Test - public void testApiChangedOperationAdded() { - assertOpenApiBackwardCompatible(OPENAPI_DOC2, OPENAPI_DOC3, true); - } - - @Test - public void testApiChangedOperationMissing() { - assertOpenApiBackwardIncompatible(OPENAPI_DOC3, OPENAPI_DOC2); - } - - @Test - public void testApiOperationChanged() { - assertOpenApiBackwardCompatible(OPENAPI_DOC2, OPENAPI_DOC4, true); - } - - @Test - public void testApiReadWriteOnlyPropertiesChanged() { - assertOpenApiBackwardCompatible(OPENAPI_DOC1, OPENAPI_DOC5, true); - } -} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java b/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java index 1180f2886..5e07d0bcd 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java @@ -4,6 +4,7 @@ import static org.slf4j.LoggerFactory.getLogger; import org.openapitools.openapidiff.core.model.ChangedOpenApi; +import org.openapitools.openapidiff.core.model.DiffResult; import org.slf4j.Logger; public class TestUtils { @@ -25,6 +26,20 @@ public static void assertOpenApiChangedEndpoints(String oldSpec, String newSpec) assertThat(changedOpenApi.getChangedOperations()).isNotEmpty(); } + public static void assertSpecUnchanged(String oldSpec, String newSpec) { + ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(oldSpec, newSpec); + LOG.info("Result: {}", changedOpenApi.isChanged().getValue()); + assertThat(changedOpenApi.isUnchanged()).isTrue(); + } + + public static void assertSpecChangedButCompatible(String oldSpec, String newSpec) { + ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(oldSpec, newSpec); + DiffResult diffResult = changedOpenApi.isChanged(); + LOG.info("Result: {}", diffResult.getValue()); + assertThat(diffResult.isDifferent()).isTrue(); + assertThat(diffResult.isCompatible()).isTrue(); + } + public static void assertOpenApiBackwardCompatible( String oldSpec, String newSpec, boolean isDiff) { ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(oldSpec, newSpec); diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ApiResponseBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ApiResponseBCTest.java new file mode 100644 index 000000000..c93bc5d4a --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ApiResponseBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ApiResponseBCTest { + private final String BASE = "bc_response_apiresponse_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_response_apiresponse_changed_but_compatible.yaml"); + } + + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_apiresponse_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ContentBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ContentBCTest.java new file mode 100644 index 000000000..130255b80 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ContentBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ContentBCTest { + private final String BASE = "bc_content_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_content_changed_but_compatible.yaml"); + } + + @Test + public void requestDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_content_decreased.yaml"); + } + + @Test + public void responseDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_content_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/EnumBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/EnumBCTest.java new file mode 100644 index 000000000..3eecfda39 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/EnumBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class EnumBCTest { + private final String BASE = "bc_enum_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_enum_changed_but_compatible.yaml"); + } + + @Test + public void requestDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_enum_decreased.yaml"); + } + + @Test + public void responseIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_enum_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeaderBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeaderBCTest.java new file mode 100644 index 000000000..d97209d19 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeaderBCTest.java @@ -0,0 +1,37 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class HeaderBCTest { + private final String BASE = "bc_response_header_base.yaml"; + + @Test + public void responseHeaderUnchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void responseHeaderDeprecated() { + assertSpecChangedButCompatible(BASE, "bc_response_header_deprecated.yaml"); + } + + @Test + public void responseHeaderRequiredAdded() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_header_required_added.yaml"); + } + + @Test + public void responseHeaderRequiredDeleted() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_header_required_deleted.yaml"); + } + + @Test + public void responseHeaderExplode() { + String RESPONSE_HEADER_EXPLODE = "bc_response_header_explode.yaml"; + assertOpenApiBackwardIncompatible(BASE, RESPONSE_HEADER_EXPLODE); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeadersBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeadersBCTest.java new file mode 100644 index 000000000..b796a35e6 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeadersBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class HeadersBCTest { + private final String BASE = "bc_response_headers_base.yaml"; + + @Test + public void responseHeadersUnchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void responseHeadersIncreased() { + assertSpecChangedButCompatible(BASE, "bc_response_headers_increased.yaml"); + } + + @Test + public void responseHeadersMissing() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_headers_missing.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/MaxLengthBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/MaxLengthBCTest.java new file mode 100644 index 000000000..96c019b40 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/MaxLengthBCTest.java @@ -0,0 +1,25 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class MaxLengthBCTest { + private final String BASE = "bc_maxlength_base.yaml"; + + @Test + public void maxLengthUnchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void requestMaxLengthDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_maxlength_decreased.yaml"); + } + + @Test + public void responseMaxLengthIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_maxlength_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/NumericRangeBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/NumericRangeBCTest.java new file mode 100644 index 000000000..1f713f98a --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/NumericRangeBCTest.java @@ -0,0 +1,114 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class NumericRangeBCTest { + private final String BASE = "bc_numericrange_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + // TODO: Fix bug where response range-narrowing is deemed incompatible, then test here + assertSpecChangedButCompatible(BASE, "bc_numericrange_changed_but_compatible.yaml"); + } + + @Test + public void requestExclusiveMaxCreated() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_max_created.yaml"); + } + + @Test + public void requestExclusiveMaxSet() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_max_set.yaml"); + } + + @Test + public void requestExclusiveMinCreated() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_min_created.yaml"); + } + + @Test + public void requestExclusiveMinSet() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_min_set.yaml"); + } + + @Test + public void requestMaxAdded() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_max_added.yaml"); + } + + @Test + public void requestMaxDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_max_decreased.yaml"); + } + + @Test + public void requestMinAdded() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_min_added.yaml"); + } + + @Test + public void requestMinIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_min_increased.yaml"); + } + + @Test + public void responseExclusiveMaxDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_exclusive_max_deleted.yaml"); + } + + @Test + public void responseExclusiveMaxUnset() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_numericrange_exclusive_max_unset.yaml"); + } + + @Test + public void responseExclusiveMinDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_exclusive_min_deleted.yaml"); + } + + @Test + public void responseExclusiveMinUnset() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_numericrange_exclusive_min_unset.yaml"); + } + + @Test + public void responseMaxDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_max_deleted.yaml"); + } + + @Test + public void responseMaxIncreased() { + // TODO: Should be incompatible because clients may be unprepared + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_max_increased.yaml"); + } + + @Test + public void responseMinDecreased() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_min_decreased.yaml"); + } + + @Test + public void responseMinDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_min_deleted.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OAuthFlowBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OAuthFlowBCTest.java new file mode 100644 index 000000000..62cf3b9a0 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OAuthFlowBCTest.java @@ -0,0 +1,30 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OAuthFlowBCTest { + private final String BASE = "bc_oauthflow_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void authorizationUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_oauthflow_authorization_url_changed.yaml"); + } + + @Test + public void refreshUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_oauthflow_refresh_url_changed.yaml"); + } + + @Test + public void tokenUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_oauthflow_token_url_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OneOfBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OneOfBCTest.java new file mode 100644 index 000000000..e42829cca --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OneOfBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OneOfBCTest { + private final String BASE = "bc_oneof_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_oneof_changed_but_compatible.yaml"); + } + + @Test + public void requestOneOfDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_oneof_decreased.yaml"); + } + + @Test + public void responseOneOfIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_oneof_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OpenApiBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OpenApiBCTest.java new file mode 100644 index 000000000..0cb493aa2 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OpenApiBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OpenApiBCTest { + private final String BASE = "bc_openapi_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_openapi_changed_but_compatible.yaml"); + } + + @Test + public void endpointsDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_openapi_endpoints_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OperationBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OperationBCTest.java new file mode 100644 index 000000000..c95d8c9d2 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OperationBCTest.java @@ -0,0 +1,20 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OperationBCTest { + private final String BASE = "bc_operation_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_operation_changed_but_compatible.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParameterBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParameterBCTest.java new file mode 100644 index 000000000..4f1d30852 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParameterBCTest.java @@ -0,0 +1,41 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ParameterBCTest { + private final String BASE = "bc_request_param_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_request_param_changed_but_compatible.yaml"); + } + + @Test + public void allowEmptyValueDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_allowemptyvalue_decreased.yaml"); + } + + @Test + public void explodeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_explode_changed.yaml"); + } + + @Test + public void requiredIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_required_increased.yaml"); + } + + @Test + public void styleChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_style_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParametersBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParametersBCTest.java new file mode 100644 index 000000000..1b913115d --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParametersBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ParametersBCTest { + private final String BASE = "bc_request_params_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_request_params_changed_but_compatible.yaml"); + } + + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_params_decreased.yaml"); + } + + @Test + public void requiredIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_params_required_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathBCTest.java new file mode 100644 index 000000000..b0b9ab39c --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class PathBCTest { + private final String BASE = "bc_path_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_path_changed_but_compatible.yaml"); + } + + @Test + public void opsDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_path_ops_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathsBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathsBCTest.java new file mode 100644 index 000000000..495739d18 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathsBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class PathsBCTest { + private final String BASE = "bc_paths_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_paths_changed_but_compatible.yaml"); + } + + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_paths_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ReadOnlyBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ReadOnlyBCTest.java new file mode 100644 index 000000000..579a7e178 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ReadOnlyBCTest.java @@ -0,0 +1,32 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ReadOnlyBCTest { + private final String BASE = "bc_readonly_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_readonly_changed_but_compatible.yaml"); + } + + @Test + public void requestReadOnlyIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_readonly_increased.yaml"); + } + + @Test + public void requestReadOnlyRequiredDecreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_request_readonly_required_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequestBodyBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequestBodyBCTest.java new file mode 100644 index 000000000..b02c0a3e0 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequestBodyBCTest.java @@ -0,0 +1,20 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class RequestBodyBCTest { + private final String BASE = "bc_request_body_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void requiredChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_body_required_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequiredBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequiredBCTest.java new file mode 100644 index 000000000..bda8b2d8e --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequiredBCTest.java @@ -0,0 +1,32 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class RequiredBCTest { + + private final String BASE = "bc_required_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_required_changed_but_compatible.yaml"); + } + + @Test + public void requestRequiredIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_required_increased.yaml"); + } + + @Test + public void responseRequiredDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_required_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java new file mode 100644 index 000000000..cec27bc78 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java @@ -0,0 +1,65 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class SchemaBCTest { + private final String BASE = "bc_schema_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_schema_changed_but_compatible.yaml"); + } + + @Test + public void discriminatorChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_schema_discriminator_changed.yaml"); + } + + @Test + public void requestFormatDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_schema_format_decreased.yaml"); + } + + @Test + public void requestFormatIncreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_request_schema_format_increased.yaml"); + } + + @Test + public void requestPropsPutIncreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + // See https://github.com/OpenAPITools/openapi-diff/issues/537 + assertOpenApiBackwardIncompatible(BASE, "bc_request_schema_props_put_increased.yaml"); + } + + @Test + public void responseFormatDecreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_response_schema_format_decreased.yaml"); + } + + @Test + public void responseFormatIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_schema_format_increased.yaml"); + } + + @Test + public void responsePropsRequiredDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_schema_props_required_decreased.yaml"); + } + + @Test + public void typeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_schema_type_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementBCTest.java new file mode 100644 index 000000000..80c79cec9 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementBCTest.java @@ -0,0 +1,24 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.*; + +import org.junit.jupiter.api.Test; + +public class SecurityRequirementBCTest { + private final String BASE = "bc_security_requirement_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_security_requirement_changed_but_compatible.yaml"); + } + + @Test + public void schemesIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_requirement_schemes_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementsBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementsBCTest.java new file mode 100644 index 000000000..a9df11df0 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementsBCTest.java @@ -0,0 +1,38 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class SecurityRequirementsBCTest { + private final String BASE = "bc_security_requirements_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_security_requirements_changed_but_compatible.yaml"); + } + + // TODO: Dropping *all* security requirements should be compatible. Refactor or document + // reasoning. Context: OAS spec is clear that only one of the security requirement objects + // need to be satisfied so it makes sense why dropping one could break a client that may + // not yet support one of the remaining referenced security schemes. But dropping all + // requirements should be compatible. + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_requirements_decreased.yaml"); + } + + // TODO: A missing incompatible check seems to be if requirements increase from zero to 1 or more + + @Test + public void schemeTypeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_requirements_scheme_type_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecuritySchemeBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecuritySchemeBCTest.java new file mode 100644 index 000000000..b275523dd --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecuritySchemeBCTest.java @@ -0,0 +1,51 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class SecuritySchemeBCTest { + private final String BASE = "bc_security_scheme_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_security_scheme_changed_but_compatible.yaml"); + } + + @Test + public void bearerFormatChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_bearer_format_changed.yaml"); + } + + @Test + public void inChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_in_changed.yaml"); + } + + @Test + public void openIdConnectUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_open_id_connect_url_changed.yaml"); + } + + @Test + public void schemeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_scheme_changed.yaml"); + } + + @Test + public void typeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_type_changed.yaml"); + } + + @Test + public void scopesIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_scopes_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/WriteOnlyBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/WriteOnlyBCTest.java new file mode 100644 index 000000000..f3ea427f0 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/WriteOnlyBCTest.java @@ -0,0 +1,32 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class WriteOnlyBCTest { + private final String BASE = "bc_writeonly_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_writeonly_changed_but_compatible.yaml"); + } + + @Test + public void responseWriteOnlyIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_writeonly_increased.yaml"); + } + + @Test + public void responseWriteOnlyRequiredDecreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_response_writeonly_required_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/compare/ApiResponseDiffTest.java b/core/src/test/java/org/openapitools/openapidiff/core/compare/ApiResponseDiffTest.java deleted file mode 100644 index 97b8ab094..000000000 --- a/core/src/test/java/org/openapitools/openapidiff/core/compare/ApiResponseDiffTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.openapidiff.core.compare; - -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardCompatible; -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -class ApiResponseDiffTest extends Assertions { - /** - * * This is a regression test - when no responses were set, we would get an exception since the - * OpenAPI object has a `null` ApiResponses field. - */ - @Test - public void testNoResponseInPrevious() { - // The previous API had no response, so adding a response shape is still compatible. - assertOpenApiBackwardCompatible( - "backwardCompatibility/apiResponse_diff_1.yaml", - "backwardCompatibility/apiResponse_diff_2.yaml", - true); - - // Removing the response shape is backwards incompatible. - assertOpenApiBackwardIncompatible( - "backwardCompatibility/apiResponse_diff_2.yaml", - "backwardCompatibility/apiResponse_diff_1.yaml"); - } -} diff --git a/core/src/test/resources/backwardCompatibility/apiResponse_diff_1.yaml b/core/src/test/resources/backwardCompatibility/apiResponse_diff_1.yaml deleted file mode 100644 index fb1e6047d..000000000 --- a/core/src/test/resources/backwardCompatibility/apiResponse_diff_1.yaml +++ /dev/null @@ -1,7 +0,0 @@ -openapi: 3.0.0 -info: - title: Swagger Petstore -paths: - /store/inventory: - get: - operationId: asdf \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/apiResponse_diff_2.yaml b/core/src/test/resources/backwardCompatibility/apiResponse_diff_2.yaml deleted file mode 100644 index 82da7cfd6..000000000 --- a/core/src/test/resources/backwardCompatibility/apiResponse_diff_2.yaml +++ /dev/null @@ -1,15 +0,0 @@ -openapi: 3.0.0 -info: - title: Swagger Petstore -paths: - /store/inventory: - get: - responses: - '200': - content: - application/json: - schema: - type: object - properties: - title: - type: string \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_1.yaml b/core/src/test/resources/backwardCompatibility/bc_1.yaml deleted file mode 100644 index 8247d2fcb..000000000 --- a/core/src/test/resources/backwardCompatibility/bc_1.yaml +++ /dev/null @@ -1,132 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 16 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_2.yaml b/core/src/test/resources/backwardCompatibility/bc_2.yaml deleted file mode 100644 index 179f3ca3f..000000000 --- a/core/src/test/resources/backwardCompatibility/bc_2.yaml +++ /dev/null @@ -1,150 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet: - post: - tags: - - pet - summary: Add a new pet to the store - description: '' - operationId: addPet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/MyResponseType' - '405': - description: Invalid input - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 24 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_3.yaml b/core/src/test/resources/backwardCompatibility/bc_3.yaml deleted file mode 100644 index 30a68ced7..000000000 --- a/core/src/test/resources/backwardCompatibility/bc_3.yaml +++ /dev/null @@ -1,163 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet: - post: - tags: - - pet - summary: Add a new pet to the store - description: '' - operationId: addPet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/MyResponseType' - '405': - description: Invalid input - get: - tags: - - pet - summary: Finds Pets by name - description: name can be provided for the pet - operationId: getPet - parameters: - - name: name - in: query - description: name that need to be considered for filter - required: true - schema: - type: string - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 36 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_4.yaml b/core/src/test/resources/backwardCompatibility/bc_4.yaml deleted file mode 100644 index 4e6ee3e18..000000000 --- a/core/src/test/resources/backwardCompatibility/bc_4.yaml +++ /dev/null @@ -1,155 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet: - post: - tags: - - pet - summary: Add a new pet to the store - description: '' - operationId: addPet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/MyResponseType' - '405': - description: Invalid input - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - enum: - - available - - pending - - sold - default: available - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - deprecated: true - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_5.yaml b/core/src/test/resources/backwardCompatibility/bc_5.yaml deleted file mode 100644 index 6b282ba48..000000000 --- a/core/src/test/resources/backwardCompatibility/bc_5.yaml +++ /dev/null @@ -1,131 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 16 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/bc_content_base.yaml b/core/src/test/resources/bc_content_base.yaml new file mode 100644 index 000000000..82634f2a9 --- /dev/null +++ b/core/src/test/resources/bc_content_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string diff --git a/core/src/test/resources/bc_content_changed_but_compatible.yaml b/core/src/test/resources/bc_content_changed_but_compatible.yaml new file mode 100644 index 000000000..8300fbad7 --- /dev/null +++ b/core/src/test/resources/bc_content_changed_but_compatible.yaml @@ -0,0 +1,35 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + application/xml: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + application/xml: + schema: + type: string diff --git a/core/src/test/resources/bc_enum_base.yaml b/core/src/test/resources/bc_enum_base.yaml new file mode 100644 index 000000000..fe020824a --- /dev/null +++ b/core/src/test/resources/bc_enum_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + - param-inline-enum-val-2 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + - enum-prop-val-2 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_enum_changed_but_compatible.yaml b/core/src/test/resources/bc_enum_changed_but_compatible.yaml new file mode 100644 index 000000000..7fd9b1da6 --- /dev/null +++ b/core/src/test/resources/bc_enum_changed_but_compatible.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + - param-inline-enum-val-2 + - param-inline-enum-val-3 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_maxlength_base.yaml b/core/src/test/resources/bc_maxlength_base.yaml new file mode 100644 index 000000000..583adca5d --- /dev/null +++ b/core/src/test/resources/bc_maxlength_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string diff --git a/core/src/test/resources/bc_numericrange_base.yaml b/core/src/test/resources/bc_numericrange_base.yaml new file mode 100644 index 000000000..e03c5939e --- /dev/null +++ b/core/src/test/resources/bc_numericrange_base.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_numericrange_changed_but_compatible.yaml b/core/src/test/resources/bc_numericrange_changed_but_compatible.yaml new file mode 100644 index 000000000..b38f2fe9e --- /dev/null +++ b/core/src/test/resources/bc_numericrange_changed_but_compatible.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 21 + application/xml: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 21 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + # TODO: Narrowing response range fails as incompatible, but shouldn't it be ok? + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + # TODO: Narrowing response range fails as incompatible, but shouldn't it be ok? + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_oauthflow_authorization_url_changed.yaml b/core/src/test/resources/bc_oauthflow_authorization_url_changed.yaml new file mode 100644 index 000000000..d14957eea --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_authorization_url_changed.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization2 + refreshUrl: https://example.com/api/oauth/refresh + tokenUrl: https://example.com/api/oauth/token + scopes: {} diff --git a/core/src/test/resources/bc_oauthflow_base.yaml b/core/src/test/resources/bc_oauthflow_base.yaml new file mode 100644 index 000000000..40c7509b4 --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_base.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization + refreshUrl: https://example.com/api/oauth/refresh + tokenUrl: https://example.com/api/oauth/token + scopes: {} diff --git a/core/src/test/resources/bc_oauthflow_refresh_url_changed.yaml b/core/src/test/resources/bc_oauthflow_refresh_url_changed.yaml new file mode 100644 index 000000000..bde8f2285 --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_refresh_url_changed.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization + refreshUrl: https://example.com/api/oauth/refresh2 + tokenUrl: https://example.com/api/oauth/token + scopes: {} diff --git a/core/src/test/resources/bc_oauthflow_token_url_changed.yaml b/core/src/test/resources/bc_oauthflow_token_url_changed.yaml new file mode 100644 index 000000000..6992e3c07 --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_token_url_changed.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization + refreshUrl: https://example.com/api/oauth/refresh + tokenUrl: https://example.com/api/oauth/token2 + scopes: {} diff --git a/core/src/test/resources/bc_oneof_base.yaml b/core/src/test/resources/bc_oneof_base.yaml new file mode 100644 index 000000000..b5ef92c35 --- /dev/null +++ b/core/src/test/resources/bc_oneof_base.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_oneof_changed_but_compatible.yaml b/core/src/test/resources/bc_oneof_changed_but_compatible.yaml new file mode 100644 index 000000000..78468ebe0 --- /dev/null +++ b/core/src/test/resources/bc_oneof_changed_but_compatible.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + - $ref: '#/components/schemas/Gizmo' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_openapi_base.yaml b/core/src/test/resources/bc_openapi_base.yaml new file mode 100644 index 000000000..78e86b943 --- /dev/null +++ b/core/src/test/resources/bc_openapi_base.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_openapi_changed_but_compatible.yaml b/core/src/test/resources/bc_openapi_changed_but_compatible.yaml new file mode 100644 index 000000000..5b5dfffc1 --- /dev/null +++ b/core/src/test/resources/bc_openapi_changed_but_compatible.yaml @@ -0,0 +1,35 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}: + get: + operationId: getWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_openapi_endpoints_decreased.yaml b/core/src/test/resources/bc_openapi_endpoints_decreased.yaml new file mode 100644 index 000000000..bd33b69dd --- /dev/null +++ b/core/src/test/resources/bc_openapi_endpoints_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_operation_base.yaml b/core/src/test/resources/bc_operation_base.yaml new file mode 100644 index 000000000..eb6403307 --- /dev/null +++ b/core/src/test/resources/bc_operation_base.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_operation_changed_but_compatible.yaml b/core/src/test/resources/bc_operation_changed_but_compatible.yaml new file mode 100644 index 000000000..2d99878b8 --- /dev/null +++ b/core/src/test/resources/bc_operation_changed_but_compatible.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + deprecated: true + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_path_base.yaml b/core/src/test/resources/bc_path_base.yaml new file mode 100644 index 000000000..78e86b943 --- /dev/null +++ b/core/src/test/resources/bc_path_base.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_path_changed_but_compatible.yaml b/core/src/test/resources/bc_path_changed_but_compatible.yaml new file mode 100644 index 000000000..d2ae98018 --- /dev/null +++ b/core/src/test/resources/bc_path_changed_but_compatible.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + put: + operationId: widgetUpdate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_path_ops_decreased.yaml b/core/src/test/resources/bc_path_ops_decreased.yaml new file mode 100644 index 000000000..eb6403307 --- /dev/null +++ b/core/src/test/resources/bc_path_ops_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_paths_base.yaml b/core/src/test/resources/bc_paths_base.yaml new file mode 100644 index 000000000..451f66310 --- /dev/null +++ b/core/src/test/resources/bc_paths_base.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}: + get: + operationId: getWidget + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_paths_changed_but_compatible.yaml b/core/src/test/resources/bc_paths_changed_but_compatible.yaml new file mode 100644 index 000000000..e2b94c228 --- /dev/null +++ b/core/src/test/resources/bc_paths_changed_but_compatible.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}: + get: + operationId: getWidget + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}/status: + get: + operationId: getWidgetStatus + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_paths_decreased.yaml b/core/src/test/resources/bc_paths_decreased.yaml new file mode 100644 index 000000000..eb6403307 --- /dev/null +++ b/core/src/test/resources/bc_paths_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_readonly_base.yaml b/core/src/test/resources/bc_readonly_base.yaml new file mode 100644 index 000000000..dc4889b1f --- /dev/null +++ b/core/src/test/resources/bc_readonly_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true + prop2: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true diff --git a/core/src/test/resources/bc_readonly_changed_but_compatible.yaml b/core/src/test/resources/bc_readonly_changed_but_compatible.yaml new file mode 100644 index 000000000..cc6596ef6 --- /dev/null +++ b/core/src/test/resources/bc_readonly_changed_but_compatible.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true + prop2: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string diff --git a/core/src/test/resources/bc_request_body_base.yaml b/core/src/test/resources/bc_request_body_base.yaml new file mode 100644 index 000000000..fd89553e9 --- /dev/null +++ b/core/src/test/resources/bc_request_body_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_body_required_changed.yaml b/core/src/test/resources/bc_request_body_required_changed.yaml new file mode 100644 index 000000000..859512ca9 --- /dev/null +++ b/core/src/test/resources/bc_request_body_required_changed.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_content_decreased.yaml b/core/src/test/resources/bc_request_content_decreased.yaml new file mode 100644 index 000000000..d7a5517de --- /dev/null +++ b/core/src/test/resources/bc_request_content_decreased.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string diff --git a/core/src/test/resources/bc_request_enum_decreased.yaml b/core/src/test/resources/bc_request_enum_decreased.yaml new file mode 100644 index 000000000..c131e9aa7 --- /dev/null +++ b/core/src/test/resources/bc_request_enum_decreased.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + - enum-prop-val-2 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_request_maxlength_decreased.yaml b/core/src/test/resources/bc_request_maxlength_decreased.yaml new file mode 100644 index 000000000..48d50863c --- /dev/null +++ b/core/src/test/resources/bc_request_maxlength_decreased.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + maxLength: 10 + application/xml: + schema: + type: string + maxLength: 10 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_max_created.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_max_created.yaml new file mode 100644 index 000000000..f893a9545 --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_max_created.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMaximum: true + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_max_set.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_max_set.yaml new file mode 100644 index 000000000..efa02f990 --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_max_set.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: true + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_min_created.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_min_created.yaml new file mode 100644 index 000000000..649b7f48b --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_min_created.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_min_set.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_min_set.yaml new file mode 100644 index 000000000..e6d0c81fb --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_min_set.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: true + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_max_added.yaml b/core/src/test/resources/bc_request_numericrange_max_added.yaml new file mode 100644 index 000000000..f438d9bda --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_max_added.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + maximum: 20 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_max_decreased.yaml b/core/src/test/resources/bc_request_numericrange_max_decreased.yaml new file mode 100644 index 000000000..be0dec2c6 --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_max_decreased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 19 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 19 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_min_added.yaml b/core/src/test/resources/bc_request_numericrange_min_added.yaml new file mode 100644 index 000000000..84a06bbca --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_min_added.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + minimum: 10 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_min_increased.yaml b/core/src/test/resources/bc_request_numericrange_min_increased.yaml new file mode 100644 index 000000000..87df1ba4a --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_min_increased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 11 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 11 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_oneof_decreased.yaml b/core/src/test/resources/bc_request_oneof_decreased.yaml new file mode 100644 index 000000000..82371aed6 --- /dev/null +++ b/core/src/test/resources/bc_request_oneof_decreased.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_request_param_allowemptyvalue_decreased.yaml b/core/src/test/resources/bc_request_param_allowemptyvalue_decreased.yaml new file mode 100644 index 000000000..cf25dd898 --- /dev/null +++ b/core/src/test/resources/bc_request_param_allowemptyvalue_decreased.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_base.yaml b/core/src/test/resources/bc_request_param_base.yaml new file mode 100644 index 000000000..555015991 --- /dev/null +++ b/core/src/test/resources/bc_request_param_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_changed_but_compatible.yaml b/core/src/test/resources/bc_request_param_changed_but_compatible.yaml new file mode 100644 index 000000000..281fd0514 --- /dev/null +++ b/core/src/test/resources/bc_request_param_changed_but_compatible.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + allowEmptyValue: true + required: false + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_explode_changed.yaml b/core/src/test/resources/bc_request_param_explode_changed.yaml new file mode 100644 index 000000000..3424c5fbe --- /dev/null +++ b/core/src/test/resources/bc_request_param_explode_changed.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + explode: true + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: false + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_required_increased.yaml b/core/src/test/resources/bc_request_param_required_increased.yaml new file mode 100644 index 000000000..6af74a9bc --- /dev/null +++ b/core/src/test/resources/bc_request_param_required_increased.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + allowEmptyValue: true + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_style_changed.yaml b/core/src/test/resources/bc_request_param_style_changed.yaml new file mode 100644 index 000000000..ff8cb1dba --- /dev/null +++ b/core/src/test/resources/bc_request_param_style_changed.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + style: form + schema: + type: string + - name: query-param-2 + in: query + style: simple + explode: true + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_base.yaml b/core/src/test/resources/bc_request_params_base.yaml new file mode 100644 index 000000000..9d623821f --- /dev/null +++ b/core/src/test/resources/bc_request_params_base.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_changed_but_compatible.yaml b/core/src/test/resources/bc_request_params_changed_but_compatible.yaml new file mode 100644 index 000000000..62a26fbb6 --- /dev/null +++ b/core/src/test/resources/bc_request_params_changed_but_compatible.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + schema: + type: string + - name: query-param-3 + in: query + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_decreased.yaml b/core/src/test/resources/bc_request_params_decreased.yaml new file mode 100644 index 000000000..2837bcc4d --- /dev/null +++ b/core/src/test/resources/bc_request_params_decreased.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_required_increased.yaml b/core/src/test/resources/bc_request_params_required_increased.yaml new file mode 100644 index 000000000..d1c2e16c3 --- /dev/null +++ b/core/src/test/resources/bc_request_params_required_increased.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + schema: + type: string + - name: query-param-3 + in: query + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_readonly_increased.yaml b/core/src/test/resources/bc_request_readonly_increased.yaml new file mode 100644 index 000000000..5de3149d1 --- /dev/null +++ b/core/src/test/resources/bc_request_readonly_increased.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true + prop2: + type: string + readOnly: true + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true diff --git a/core/src/test/resources/bc_request_readonly_required_decreased.yaml b/core/src/test/resources/bc_request_readonly_required_decreased.yaml new file mode 100644 index 000000000..73f12cae5 --- /dev/null +++ b/core/src/test/resources/bc_request_readonly_required_decreased.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true diff --git a/core/src/test/resources/bc_request_required_increased.yaml b/core/src/test/resources/bc_request_required_increased.yaml new file mode 100644 index 000000000..cd9821ac0 --- /dev/null +++ b/core/src/test/resources/bc_request_required_increased.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + - prop3 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 diff --git a/core/src/test/resources/bc_request_schema_format_decreased.yaml b/core/src/test/resources/bc_request_schema_format_decreased.yaml new file mode 100644 index 000000000..3a69caf83 --- /dev/null +++ b/core/src/test/resources/bc_request_schema_format_decreased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int32 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_request_schema_format_increased.yaml b/core/src/test/resources/bc_request_schema_format_increased.yaml new file mode 100644 index 000000000..6201e14c9 --- /dev/null +++ b/core/src/test/resources/bc_request_schema_format_increased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int64 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_request_schema_props_put_increased.yaml b/core/src/test/resources/bc_request_schema_props_put_increased.yaml new file mode 100644 index 000000000..9ca619a47 --- /dev/null +++ b/core/src/test/resources/bc_request_schema_props_put_increased.yaml @@ -0,0 +1,117 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + put_prop3: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_required_base.yaml b/core/src/test/resources/bc_required_base.yaml new file mode 100644 index 000000000..711cd20a0 --- /dev/null +++ b/core/src/test/resources/bc_required_base.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 diff --git a/core/src/test/resources/bc_required_changed_but_compatible.yaml b/core/src/test/resources/bc_required_changed_but_compatible.yaml new file mode 100644 index 000000000..4e352896f --- /dev/null +++ b/core/src/test/resources/bc_required_changed_but_compatible.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + - prop3 diff --git a/core/src/test/resources/bc_response_apiresponse_base.yaml b/core/src/test/resources/bc_response_apiresponse_base.yaml new file mode 100644 index 000000000..640a7dc1a --- /dev/null +++ b/core/src/test/resources/bc_response_apiresponse_base.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + '400': + description: Invalid status value + /widgets/index: + post: + operationId: indexWidgets + description: Regression test for https://github.com/OpenAPITools/openapi-diff/pull/206 (handle missing responses) diff --git a/core/src/test/resources/bc_response_apiresponse_changed_but_compatible.yaml b/core/src/test/resources/bc_response_apiresponse_changed_but_compatible.yaml new file mode 100644 index 000000000..6ad621348 --- /dev/null +++ b/core/src/test/resources/bc_response_apiresponse_changed_but_compatible.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + '201': + description: OK + '400': + description: Invalid status value + /widgets/index: + post: + operationId: indexWidgets + responses: + '200': + description: successful operation diff --git a/core/src/test/resources/bc_response_apiresponse_decreased.yaml b/core/src/test/resources/bc_response_apiresponse_decreased.yaml new file mode 100644 index 000000000..6502cf0ce --- /dev/null +++ b/core/src/test/resources/bc_response_apiresponse_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + /widgets/index: + post: + operationId: indexWidgets + description: Regression test for https://github.com/OpenAPITools/openapi-diff/pull/206 (handle missing responses) diff --git a/core/src/test/resources/bc_response_content_decreased.yaml b/core/src/test/resources/bc_response_content_decreased.yaml new file mode 100644 index 000000000..2915db537 --- /dev/null +++ b/core/src/test/resources/bc_response_content_decreased.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 diff --git a/core/src/test/resources/bc_response_enum_increased.yaml b/core/src/test/resources/bc_response_enum_increased.yaml new file mode 100644 index 000000000..27a0d58d0 --- /dev/null +++ b/core/src/test/resources/bc_response_enum_increased.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + - param-inline-enum-val-2 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + - enum-prop-val-2 + - enum-prop-val-3 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_response_header_base.yaml b/core/src/test/resources/bc_response_header_base.yaml new file mode 100644 index 000000000..17716ba06 --- /dev/null +++ b/core/src/test/resources/bc_response_header_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_header_deprecated.yaml b/core/src/test/resources/bc_response_header_deprecated.yaml new file mode 100644 index 000000000..0c60132bd --- /dev/null +++ b/core/src/test/resources/bc_response_header_deprecated.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + deprecated: true + schema: + type: integer diff --git a/core/src/test/resources/bc_response_header_explode.yaml b/core/src/test/resources/bc_response_header_explode.yaml new file mode 100644 index 000000000..d48a726a7 --- /dev/null +++ b/core/src/test/resources/bc_response_header_explode.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer + explode: true diff --git a/core/src/test/resources/bc_response_header_required_added.yaml b/core/src/test/resources/bc_response_header_required_added.yaml new file mode 100644 index 000000000..83bceafe8 --- /dev/null +++ b/core/src/test/resources/bc_response_header_required_added.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + required: true + schema: + type: integer diff --git a/core/src/test/resources/bc_response_header_required_deleted.yaml b/core/src/test/resources/bc_response_header_required_deleted.yaml new file mode 100644 index 000000000..c227a3921 --- /dev/null +++ b/core/src/test/resources/bc_response_header_required_deleted.yaml @@ -0,0 +1,20 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_headers_base.yaml b/core/src/test/resources/bc_response_headers_base.yaml new file mode 100644 index 000000000..17716ba06 --- /dev/null +++ b/core/src/test/resources/bc_response_headers_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_headers_increased.yaml b/core/src/test/resources/bc_response_headers_increased.yaml new file mode 100644 index 000000000..837b3e222 --- /dev/null +++ b/core/src/test/resources/bc_response_headers_increased.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer + X-Header-3: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_headers_missing.yaml b/core/src/test/resources/bc_response_headers_missing.yaml new file mode 100644 index 000000000..c5166c9c2 --- /dev/null +++ b/core/src/test/resources/bc_response_headers_missing.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 diff --git a/core/src/test/resources/bc_response_maxlength_increased.yaml b/core/src/test/resources/bc_response_maxlength_increased.yaml new file mode 100644 index 000000000..40dd4309d --- /dev/null +++ b/core/src/test/resources/bc_response_maxlength_increased.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + maxLength: 20 + application/xml: + schema: + type: string + maxLength: 20 diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_max_deleted.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_max_deleted.yaml new file mode 100644 index 000000000..385b4759d --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_max_deleted.yaml @@ -0,0 +1,54 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_max_unset.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_max_unset.yaml new file mode 100644 index 000000000..e6c1448cd --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_max_unset.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: false diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_min_deleted.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_min_deleted.yaml new file mode 100644 index 000000000..49881a7f4 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_min_deleted.yaml @@ -0,0 +1,54 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_min_unset.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_min_unset.yaml new file mode 100644 index 000000000..75bb758fa --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_min_unset.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: false + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_max_deleted.yaml b/core/src/test/resources/bc_response_numericrange_max_deleted.yaml new file mode 100644 index 000000000..6edf439f2 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_max_deleted.yaml @@ -0,0 +1,53 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_max_increased.yaml b/core/src/test/resources/bc_response_numericrange_max_increased.yaml new file mode 100644 index 000000000..e994bf88c --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_max_increased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 21 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 21 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_min_decreased.yaml b/core/src/test/resources/bc_response_numericrange_min_decreased.yaml new file mode 100644 index 000000000..2055a3247 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_min_decreased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_min_deleted.yaml b/core/src/test/resources/bc_response_numericrange_min_deleted.yaml new file mode 100644 index 000000000..087245c07 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_min_deleted.yaml @@ -0,0 +1,53 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_oneof_increased.yaml b/core/src/test/resources/bc_response_oneof_increased.yaml new file mode 100644 index 000000000..0d6636e0e --- /dev/null +++ b/core/src/test/resources/bc_response_oneof_increased.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + - $ref: '#/components/schemas/Gizmo' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_required_decreased.yaml b/core/src/test/resources/bc_response_required_decreased.yaml new file mode 100644 index 000000000..e77d73da4 --- /dev/null +++ b/core/src/test/resources/bc_response_required_decreased.yaml @@ -0,0 +1,40 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 diff --git a/core/src/test/resources/bc_response_schema_format_decreased.yaml b/core/src/test/resources/bc_response_schema_format_decreased.yaml new file mode 100644 index 000000000..66ad527df --- /dev/null +++ b/core/src/test/resources/bc_response_schema_format_decreased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int32 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_schema_format_increased.yaml b/core/src/test/resources/bc_response_schema_format_increased.yaml new file mode 100644 index 000000000..1ecc86fb6 --- /dev/null +++ b/core/src/test/resources/bc_response_schema_format_increased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int64 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_schema_props_required_decreased.yaml b/core/src/test/resources/bc_response_schema_props_required_decreased.yaml new file mode 100644 index 000000000..cbd2c5a44 --- /dev/null +++ b/core/src/test/resources/bc_response_schema_props_required_decreased.yaml @@ -0,0 +1,112 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_writeonly_increased.yaml b/core/src/test/resources/bc_response_writeonly_increased.yaml new file mode 100644 index 000000000..a009b8dc6 --- /dev/null +++ b/core/src/test/resources/bc_response_writeonly_increased.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + prop2: + type: string + writeOnly: true + required: + - prop1 diff --git a/core/src/test/resources/bc_response_writeonly_required_decreased.yaml b/core/src/test/resources/bc_response_writeonly_required_decreased.yaml new file mode 100644 index 000000000..74bf153ef --- /dev/null +++ b/core/src/test/resources/bc_response_writeonly_required_decreased.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + required: + - prop1 diff --git a/core/src/test/resources/bc_schema_base.yaml b/core/src/test/resources/bc_schema_base.yaml new file mode 100644 index 000000000..28d8800d8 --- /dev/null +++ b/core/src/test/resources/bc_schema_base.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_schema_changed_but_compatible.yaml b/core/src/test/resources/bc_schema_changed_but_compatible.yaml new file mode 100644 index 000000000..e8a6e7e94 --- /dev/null +++ b/core/src/test/resources/bc_schema_changed_but_compatible.yaml @@ -0,0 +1,114 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop2: + type: integer + format: int64 + request_prop3: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop3: + type: string + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + deprecated: true + prop2: + type: integer + format: int32 + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_schema_discriminator_changed.yaml b/core/src/test/resources/bc_schema_discriminator_changed.yaml new file mode 100644 index 000000000..fd9569001 --- /dev/null +++ b/core/src/test/resources/bc_schema_discriminator_changed.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: 'prop1' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_schema_type_changed.yaml b/core/src/test/resources/bc_schema_type_changed.yaml new file mode 100644 index 000000000..946d16890 --- /dev/null +++ b/core/src/test/resources/bc_schema_type_changed.yaml @@ -0,0 +1,114 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: string + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_security_requirement_base.yaml b/core/src/test/resources/bc_security_requirement_base.yaml new file mode 100644 index 000000000..477736519 --- /dev/null +++ b/core/src/test/resources/bc_security_requirement_base.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + my-scheme-2: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirement_changed_but_compatible.yaml b/core/src/test/resources/bc_security_requirement_changed_but_compatible.yaml new file mode 100644 index 000000000..9a58c327f --- /dev/null +++ b/core/src/test/resources/bc_security_requirement_changed_but_compatible.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirement_schemes_increased.yaml b/core/src/test/resources/bc_security_requirement_schemes_increased.yaml new file mode 100644 index 000000000..234aa7a29 --- /dev/null +++ b/core/src/test/resources/bc_security_requirement_schemes_increased.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + my-scheme-2: [] + my-scheme-3: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_base.yaml b/core/src/test/resources/bc_security_requirements_base.yaml new file mode 100644 index 000000000..9c4c04650 --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_base.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + - my-scheme-2: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_changed_but_compatible.yaml b/core/src/test/resources/bc_security_requirements_changed_but_compatible.yaml new file mode 100644 index 000000000..ba983bc36 --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_changed_but_compatible.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + - my-scheme-2: [] + - my-scheme-3: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_decreased.yaml b/core/src/test/resources/bc_security_requirements_decreased.yaml new file mode 100644 index 000000000..9a58c327f --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_decreased.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_scheme_type_changed.yaml b/core/src/test/resources/bc_security_requirements_scheme_type_changed.yaml new file mode 100644 index 000000000..d2e6f1a95 --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_scheme_type_changed.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + - my-scheme-2: [] +components: + securitySchemes: + my-scheme-1: + type: apiKey + name: api_key + in: header + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_scheme_base.yaml b/core/src/test/resources/bc_security_scheme_base.yaml new file mode 100644 index 000000000..00caad137 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_base.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_bearer_format_changed.yaml b/core/src/test/resources/bc_security_scheme_bearer_format_changed.yaml new file mode 100644 index 000000000..bf7fcca56 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_bearer_format_changed.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + bearerFormat: myBearerFormat + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_changed_but_compatible.yaml b/core/src/test/resources/bc_security_scheme_changed_but_compatible.yaml new file mode 100644 index 000000000..5cf1f26bf --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_changed_but_compatible.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_in_changed.yaml b/core/src/test/resources/bc_security_scheme_in_changed.yaml new file mode 100644 index 000000000..5d937c361 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_in_changed.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: query + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_open_id_connect_url_changed.yaml b/core/src/test/resources/bc_security_scheme_open_id_connect_url_changed.yaml new file mode 100644 index 000000000..e981a945f --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_open_id_connect_url_changed.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect2 + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_scheme_changed.yaml b/core/src/test/resources/bc_security_scheme_scheme_changed.yaml new file mode 100644 index 000000000..5b474049d --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_scheme_changed.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + scheme: Digest + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_scopes_increased.yaml b/core/src/test/resources/bc_security_scheme_scopes_increased.yaml new file mode 100644 index 000000000..8cfe76833 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_scopes_increased.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" + - "scope3" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_type_changed.yaml b/core/src/test/resources/bc_security_scheme_type_changed.yaml new file mode 100644 index 000000000..985a1a17b --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_type_changed.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: apiKey + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_writeonly_base.yaml b/core/src/test/resources/bc_writeonly_base.yaml new file mode 100644 index 000000000..ad3c869db --- /dev/null +++ b/core/src/test/resources/bc_writeonly_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + prop2: + type: string + required: + - prop1 diff --git a/core/src/test/resources/bc_writeonly_changed_but_compatible.yaml b/core/src/test/resources/bc_writeonly_changed_but_compatible.yaml new file mode 100644 index 000000000..48857215b --- /dev/null +++ b/core/src/test/resources/bc_writeonly_changed_but_compatible.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + prop2: + type: string + required: + - prop1