From ff595a632634539385d9c2be4798d694e03b8ea3 Mon Sep 17 00:00:00 2001 From: "hidde.wieringa" Date: Thu, 14 Oct 2021 14:51:51 +0200 Subject: [PATCH] Test for nested refs --- .../openapidiff/core/NestedSchemaRefTest.java | 15 +++++++ .../test/resources/nested_schema_ref_1.yaml | 44 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/NestedSchemaRefTest.java create mode 100644 core/src/test/resources/nested_schema_ref_1.yaml diff --git a/core/src/test/java/org/openapitools/openapidiff/core/NestedSchemaRefTest.java b/core/src/test/java/org/openapitools/openapidiff/core/NestedSchemaRefTest.java new file mode 100644 index 000000000..c512b7881 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/NestedSchemaRefTest.java @@ -0,0 +1,15 @@ +package org.openapitools.openapidiff.core; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiAreEquals; + +import org.junit.jupiter.api.Test; + +public class NestedSchemaRefTest { + + private final String OPENAPI_DOC1 = "nested_schema_ref_1.yaml"; + + @Test + public void shouldNotThrowErrorsForNestedRefs() { + assertOpenApiAreEquals(OPENAPI_DOC1, OPENAPI_DOC1); + } +} diff --git a/core/src/test/resources/nested_schema_ref_1.yaml b/core/src/test/resources/nested_schema_ref_1.yaml new file mode 100644 index 000000000..344d47366 --- /dev/null +++ b/core/src/test/resources/nested_schema_ref_1.yaml @@ -0,0 +1,44 @@ +openapi: 3.0.1 +info: + title: Service + description: test + version: test + contact: + name: test + url: 'test' +servers: + - url: 'localhost' +paths: + /feature: + get: + summary: Get feature state + operationId: feature + description: Gets feature + parameters: + - name: feature + in: query + schema: + $ref: '#/components/schemas/Feature/properties/feature' + required: true + responses: + '200': + description: Found feature + content: + application/json: + schema: + $ref: '#/components/schemas/Feature' +components: + schemas: + Feature: + type: object + properties: + feature: + type: string + enum: + - alpha + - beta + value: + type: boolean + required: + - feature + - value