diff --git a/core/src/test/java/org/openapitools/openapidiff/core/RequestDiffTest.java b/core/src/test/java/org/openapitools/openapidiff/core/RequestDiffTest.java index 31b76f76..7dcffdbc 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/RequestDiffTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/RequestDiffTest.java @@ -1,8 +1,10 @@ package org.openapitools.openapidiff.core; +import static org.assertj.core.api.Assertions.assertThat; import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiChangedEndpoints; import org.junit.jupiter.api.Test; +import org.openapitools.openapidiff.core.model.ChangedOpenApi; public class RequestDiffTest { private final String OPENAPI_DOC1 = "request_diff_1.yaml"; @@ -12,4 +14,13 @@ public class RequestDiffTest { public void testDiffDifferent() { assertOpenApiChangedEndpoints(OPENAPI_DOC1, OPENAPI_DOC2); } + + @Test + public void testSameTypeResponseSchemaDIff() { + ChangedOpenApi changedOpenApi = + OpenApiCompare.fromLocations( + "response_schema_simple_object_type.yaml", + "response_schema_simple_object_type_with_alloff.yaml"); + assertThat(changedOpenApi.isCompatible()).isTrue(); + } } diff --git a/core/src/test/resources/response_schema_simple_object_type.yaml b/core/src/test/resources/response_schema_simple_object_type.yaml new file mode 100644 index 00000000..7bfd87c5 --- /dev/null +++ b/core/src/test/resources/response_schema_simple_object_type.yaml @@ -0,0 +1,27 @@ +openapi: "3.0.0" +info: + title: Sample API + description: API description in Markdown. + version: 1.0.0 +servers: [] +paths: + /test: + get: + summary: Your GET endpoint + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/working' +components: + schemas: + working: + type: object + properties: + foo: + type: string + bar: + type: integer \ No newline at end of file diff --git a/core/src/test/resources/response_schema_simple_object_type_with_alloff.yaml b/core/src/test/resources/response_schema_simple_object_type_with_alloff.yaml new file mode 100644 index 00000000..4277712c --- /dev/null +++ b/core/src/test/resources/response_schema_simple_object_type_with_alloff.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + title: Sample API + description: API description in Markdown. + version: 1.1.0 +servers: [] +paths: + /test: + get: + summary: Your GET endpoint + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/working' + operationId: get-test +components: + schemas: + working: + allOf: + - type: object + properties: + foo: + type: string + - $ref: '#/components/schemas/bar' + bar: + type: object + properties: + bar: + type: integer \ No newline at end of file