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..8561d13a 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/RequestDiffTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/RequestDiffTest.java @@ -1,5 +1,6 @@ package org.openapitools.openapidiff.core; +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiChangedEndpoints; import org.junit.jupiter.api.Test; @@ -12,4 +13,9 @@ public class RequestDiffTest { public void testDiffDifferent() { assertOpenApiChangedEndpoints(OPENAPI_DOC1, OPENAPI_DOC2); } + + @Test + public void issue412() { + assertOpenApiBackwardIncompatible("issue-412_1.yaml", "issue-412_2.yaml"); + } } diff --git a/core/src/test/resources/issue-412_1.yaml b/core/src/test/resources/issue-412_1.yaml new file mode 100644 index 00000000..8034cc6a --- /dev/null +++ b/core/src/test/resources/issue-412_1.yaml @@ -0,0 +1,34 @@ +openapi: "3.0.1" +info: + title: "Public Api" + description: "" + version: "2022-08-23T16:17:54Z" +servers: + - url: "https://someurl" + variables: + basePath: + default: "/v1" +paths: + /auth: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AuthRequest" + required: true + responses: + 200: + description: OK +components: + schemas: + AuthRequest: + required: + - "Username" + - "Password" + type: "object" + properties: + Username: + type: "string" + Password: + type: "string" \ No newline at end of file diff --git a/core/src/test/resources/issue-412_2.yaml b/core/src/test/resources/issue-412_2.yaml new file mode 100644 index 00000000..07bb3f55 --- /dev/null +++ b/core/src/test/resources/issue-412_2.yaml @@ -0,0 +1,31 @@ +openapi: "3.0.1" +info: + title: "Public Api" + description: "" + version: "2022-08-23T16:17:54Z" +servers: + - url: "https://someurl" + variables: + basePath: + default: "/v1" +paths: + /auth: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AuthRequest" + required: true + responses: + 200: + description: OK +components: + schemas: + AuthRequest: + required: + - "Username" + type: "object" + properties: + Username: + type: "string" \ No newline at end of file