From 3382b3ebc5a9c95639eee9bb7f577ae8182afdc5 Mon Sep 17 00:00:00 2001 From: Inf1mum Date: Mon, 16 Nov 2026 15:38:06 +0300 Subject: [PATCH] Add OpenAPI 3.1 paired-fixture test harness (Phase 0) Phase 0 of the OpenAPI 3.1 plan: the test setup every later phase uses. Fixture convention under core/src/test/resources/oas31//: the same minimal document as old-3.0.yaml/new-3.0.yaml and old-3.1.yaml/new-3.1.yaml so the same change is expressed in 3.0 and in 3.1 syntax. First fixtures: type-change, nullable, exclusive-bounds, array-items, all-of, one-of, plus one Swagger 2.0 pair. Oas31PairedFixturesTest pins the documented 3.0->3.0 verdict per rule, checks the Swagger 2.0 pair matches the 3.0 verdict, and keeps the parts of the harness contract that fail on today's engine as disabled tests, each naming the phase that fixes it: - 3.1->3.1 verdict agreement: Phase 2 (#950), engine reads 3.1 fields - 3.0->3.1 verdict agreement and the 3.0-vs-3.1 written equivalence: Phase 3 (#951), converter wired in Fixes #948 Signed-off-by: Inf1mum --- .../core/Oas31PairedFixturesTest.java | 186 ++++++++++++++++++ .../test/resources/oas31/all-of/new-3.0.yaml | 31 +++ .../test/resources/oas31/all-of/new-3.1.yaml | 31 +++ .../test/resources/oas31/all-of/old-3.0.yaml | 31 +++ .../test/resources/oas31/all-of/old-3.1.yaml | 31 +++ .../resources/oas31/array-items/new-3.0.yaml | 24 +++ .../resources/oas31/array-items/new-3.1.yaml | 24 +++ .../resources/oas31/array-items/old-3.0.yaml | 24 +++ .../resources/oas31/array-items/old-3.1.yaml | 24 +++ .../oas31/exclusive-bounds/new-3.0.yaml | 19 ++ .../oas31/exclusive-bounds/new-3.1.yaml | 18 ++ .../oas31/exclusive-bounds/old-3.0.yaml | 18 ++ .../oas31/exclusive-bounds/old-3.1.yaml | 18 ++ .../resources/oas31/nullable/new-3.0.yaml | 23 +++ .../resources/oas31/nullable/new-3.1.yaml | 22 +++ .../resources/oas31/nullable/old-3.0.yaml | 23 +++ .../resources/oas31/nullable/old-3.1.yaml | 22 +++ .../test/resources/oas31/one-of/new-3.0.yaml | 42 ++++ .../test/resources/oas31/one-of/new-3.1.yaml | 40 ++++ .../test/resources/oas31/one-of/old-3.0.yaml | 42 ++++ .../test/resources/oas31/one-of/old-3.1.yaml | 40 ++++ .../resources/oas31/swagger2/new-2.0.yaml | 21 ++ .../resources/oas31/swagger2/old-2.0.yaml | 21 ++ .../resources/oas31/type-change/new-3.0.yaml | 22 +++ .../resources/oas31/type-change/new-3.1.yaml | 22 +++ .../resources/oas31/type-change/old-3.0.yaml | 22 +++ .../resources/oas31/type-change/old-3.1.yaml | 22 +++ 27 files changed, 863 insertions(+) create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/Oas31PairedFixturesTest.java create mode 100644 core/src/test/resources/oas31/all-of/new-3.0.yaml create mode 100644 core/src/test/resources/oas31/all-of/new-3.1.yaml create mode 100644 core/src/test/resources/oas31/all-of/old-3.0.yaml create mode 100644 core/src/test/resources/oas31/all-of/old-3.1.yaml create mode 100644 core/src/test/resources/oas31/array-items/new-3.0.yaml create mode 100644 core/src/test/resources/oas31/array-items/new-3.1.yaml create mode 100644 core/src/test/resources/oas31/array-items/old-3.0.yaml create mode 100644 core/src/test/resources/oas31/array-items/old-3.1.yaml create mode 100644 core/src/test/resources/oas31/exclusive-bounds/new-3.0.yaml create mode 100644 core/src/test/resources/oas31/exclusive-bounds/new-3.1.yaml create mode 100644 core/src/test/resources/oas31/exclusive-bounds/old-3.0.yaml create mode 100644 core/src/test/resources/oas31/exclusive-bounds/old-3.1.yaml create mode 100644 core/src/test/resources/oas31/nullable/new-3.0.yaml create mode 100644 core/src/test/resources/oas31/nullable/new-3.1.yaml create mode 100644 core/src/test/resources/oas31/nullable/old-3.0.yaml create mode 100644 core/src/test/resources/oas31/nullable/old-3.1.yaml create mode 100644 core/src/test/resources/oas31/one-of/new-3.0.yaml create mode 100644 core/src/test/resources/oas31/one-of/new-3.1.yaml create mode 100644 core/src/test/resources/oas31/one-of/old-3.0.yaml create mode 100644 core/src/test/resources/oas31/one-of/old-3.1.yaml create mode 100644 core/src/test/resources/oas31/swagger2/new-2.0.yaml create mode 100644 core/src/test/resources/oas31/swagger2/old-2.0.yaml create mode 100644 core/src/test/resources/oas31/type-change/new-3.0.yaml create mode 100644 core/src/test/resources/oas31/type-change/new-3.1.yaml create mode 100644 core/src/test/resources/oas31/type-change/old-3.0.yaml create mode 100644 core/src/test/resources/oas31/type-change/old-3.1.yaml diff --git a/core/src/test/java/org/openapitools/openapidiff/core/Oas31PairedFixturesTest.java b/core/src/test/java/org/openapitools/openapidiff/core/Oas31PairedFixturesTest.java new file mode 100644 index 00000000..8db19abb --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/Oas31PairedFixturesTest.java @@ -0,0 +1,186 @@ +package org.openapitools.openapidiff.core; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.openapitools.openapidiff.core.model.DiffResult.COMPATIBLE; +import static org.openapitools.openapidiff.core.model.DiffResult.INCOMPATIBLE; +import static org.openapitools.openapidiff.core.model.DiffResult.NO_CHANGES; + +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.openapitools.openapidiff.core.model.DiffResult; + +/** + * Phase 0 test harness for the OpenAPI 3.1 plan, see issue #948. + * + *

Fixture convention: every rule directory {@code core/src/test/resources/oas31//} holds + * the same minimal document as old-3.0.yaml/new-3.0.yaml and old-3.1.yaml/new-3.1.yaml, so the same + * change is expressed twice: once in 3.0 syntax and once in 3.1 syntax. The harness contract is + * that the same change gets the same verdict in every version, and that the same document written + * in 3.0 and in 3.1 diffs to no changes. + * + *

Comparisons that fail on the current engine are not deleted: they are kept as disabled tests, + * each naming the phase of the plan that fixes them, so the build stays green while the gaps remain + * visible. When a phase lands, remove its {@code @Disabled} annotations. New rule fixtures follow + * the same pattern: add the directory, add the expected 3.0 verdict below, and disable the 3.1 + * comparisons if they do not hold yet. + */ +class Oas31PairedFixturesTest { + + /** Verdict the engine gives for the rule pair when both documents are 3.0. */ + private static final Map VERDICT_30 = + Map.of( + "all-of", INCOMPATIBLE, + "array-items", INCOMPATIBLE, + "exclusive-bounds", INCOMPATIBLE, + "nullable", COMPATIBLE, + "one-of", INCOMPATIBLE, + "type-change", INCOMPATIBLE); + + private static final List RULES = + List.of("all-of", "array-items", "exclusive-bounds", "nullable", "one-of", "type-change"); + + static Stream rules() { + return RULES.stream(); + } + + private static DiffResult verdict(String oldSpec, String newSpec) { + return OpenApiCompare.fromLocations(oldSpec, newSpec).isChanged(); + } + + private static DiffResult verdict30to30(String rule) { + return verdict("oas31/" + rule + "/old-3.0.yaml", "oas31/" + rule + "/new-3.0.yaml"); + } + + private static DiffResult verdict31to31(String rule) { + return verdict("oas31/" + rule + "/old-3.1.yaml", "oas31/" + rule + "/new-3.1.yaml"); + } + + private static DiffResult verdict30to31(String rule) { + return verdict("oas31/" + rule + "/old-3.0.yaml", "oas31/" + rule + "/new-3.1.yaml"); + } + + /** The 3.0->3.0 comparison detects the change with the documented verdict. */ + @ParameterizedTest(name = "{0}: 3.0->3.0 keeps its documented verdict") + @MethodSource("rules") + void changeDetectedIn30WithDocumentedVerdict(String rule) { + assertThat(verdict30to30(rule)).isEqualTo(VERDICT_30.get(rule)); + } + + /** The Swagger 2.0 pair encodes the type-change rule and matches the 3.0 verdict. */ + @Test + void swagger2PairMatchesThe30Verdict() { + assertThat(verdict("oas31/swagger2/old-2.0.yaml", "oas31/swagger2/new-2.0.yaml")) + .isEqualTo(VERDICT_30.get("type-change")); + } + + /** The 3.1->3.1 comparison of the same change agrees with the 3.0 verdict. */ + private static void assertSameVerdictIn30And31(String rule) { + assertThat(verdict31to31(rule)).isEqualTo(verdict30to30(rule)); + } + + /** The 3.0->3.1 comparison of the same change agrees with the 3.0 verdict. */ + private static void assertCrossVersionMatches30(String rule) { + assertThat(verdict30to31(rule)).isEqualTo(verdict30to30(rule)); + } + + /** The same document written in 3.0 and in 3.1 diffs to no changes. */ + private static void assertWrittenVersionsAgree(String rule) { + assertThat(verdict("oas31/" + rule + "/old-3.0.yaml", "oas31/" + rule + "/old-3.1.yaml")) + .isEqualTo(NO_CHANGES); + assertThat(verdict("oas31/" + rule + "/new-3.0.yaml", "oas31/" + rule + "/new-3.1.yaml")) + .isEqualTo(NO_CHANGES); + } + + /** + * Known 3.1 gaps of the current engine, kept as disabled tests so they are visible and green. + * Every test names the phase of the plan that fixes it; remove the {@code @Disabled} annotation + * when that phase lands. + */ + @Nested + @DisplayName("Known 3.1 gaps") + class KnownGaps { + + @Nested + @DisplayName("Same-version verdicts: Phase 2, engine reads 3.1 fields (#950)") + class SameVersion31 { + + @Test + @Disabled( + "#950 (Phase 2): the engine compares getType(), which is null for 3.1 schemas; the" + + " type keyword lives in the types set (see also #938)") + void typeChange() { + assertSameVerdictIn30And31("type-change"); + } + + @Test + @Disabled( + "#950 (Phase 2): 3.1 nullability is \"null\" in the types set and only goes through" + + " the null rule, which is not implemented yet") + void nullable() { + assertSameVerdictIn30And31("nullable"); + } + + @Test + @Disabled( + "#950 (Phase 2): the 3.1 numeric exclusiveMinimum is not read; bounds need the" + + " effective-bound rule (value plus inclusive/exclusive)") + void exclusiveBounds() { + assertSameVerdictIn30And31("exclusive-bounds"); + } + + @Test + @Disabled( + "#950 (Phase 2): items are compared only on ArraySchema, but 3.1 arrays deserialize" + + " as JsonSchema") + void arrayItems() { + assertSameVerdictIn30And31("array-items"); + } + + @Test + @Disabled( + "#950 (Phase 2): allOf is flattened only on ComposedSchema, but 3.1 compositions" + + " deserialize as JsonSchema (see also #938)") + void allOf() { + assertSameVerdictIn30And31("all-of"); + } + + @Test + @Disabled( + "#950 (Phase 2): oneOf members are compared only on ComposedSchema, but 3.1" + + " compositions deserialize as JsonSchema") + void oneOf() { + assertSameVerdictIn30And31("one-of"); + } + } + + @Nested + @DisplayName("Cross-version verdicts: Phase 3, converter wired in (#951)") + class CrossVersion { + + @ParameterizedTest(name = "{0}: 3.0->3.1 agrees with the 3.0 verdict") + @MethodSource("org.openapitools.openapidiff.core.Oas31PairedFixturesTest#rules") + @Disabled( + "#951 (Phase 3): 3.0 documents are not converted to the 3.1 shape before comparing," + + " so mixed-version comparisons report a false type change") + void crossVersionMatches30(String rule) { + assertCrossVersionMatches30(rule); + } + + @ParameterizedTest(name = "{0}: the 3.0 and 3.1 spellings agree") + @MethodSource("org.openapitools.openapidiff.core.Oas31PairedFixturesTest#rules") + @Disabled( + "#951 (Phase 3): the same document written in 3.0 and in 3.1 currently reports" + + " changes (version noise, see #858)") + void writtenVersionsAgree(String rule) { + assertWrittenVersionsAgree(rule); + } + } + } +} diff --git a/core/src/test/resources/oas31/all-of/new-3.0.yaml b/core/src/test/resources/oas31/all-of/new-3.0.yaml new file mode 100644 index 00000000..b2be5043 --- /dev/null +++ b/core/src/test/resources/oas31/all-of/new-3.0.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (all-of) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + allOf: + - $ref: "#/components/schemas/Base" + - $ref: "#/components/schemas/Extra" + Base: + type: object + properties: + name: + type: integer + Extra: + type: object + properties: + tag: + type: string diff --git a/core/src/test/resources/oas31/all-of/new-3.1.yaml b/core/src/test/resources/oas31/all-of/new-3.1.yaml new file mode 100644 index 00000000..eca8d91b --- /dev/null +++ b/core/src/test/resources/oas31/all-of/new-3.1.yaml @@ -0,0 +1,31 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (all-of) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + allOf: + - $ref: "#/components/schemas/Base" + - $ref: "#/components/schemas/Extra" + Base: + type: object + properties: + name: + type: integer + Extra: + type: object + properties: + tag: + type: string diff --git a/core/src/test/resources/oas31/all-of/old-3.0.yaml b/core/src/test/resources/oas31/all-of/old-3.0.yaml new file mode 100644 index 00000000..4370e9f7 --- /dev/null +++ b/core/src/test/resources/oas31/all-of/old-3.0.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (all-of) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + allOf: + - $ref: "#/components/schemas/Base" + - $ref: "#/components/schemas/Extra" + Base: + type: object + properties: + name: + type: string + Extra: + type: object + properties: + tag: + type: string diff --git a/core/src/test/resources/oas31/all-of/old-3.1.yaml b/core/src/test/resources/oas31/all-of/old-3.1.yaml new file mode 100644 index 00000000..bbf5decc --- /dev/null +++ b/core/src/test/resources/oas31/all-of/old-3.1.yaml @@ -0,0 +1,31 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (all-of) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + allOf: + - $ref: "#/components/schemas/Base" + - $ref: "#/components/schemas/Extra" + Base: + type: object + properties: + name: + type: string + Extra: + type: object + properties: + tag: + type: string diff --git a/core/src/test/resources/oas31/array-items/new-3.0.yaml b/core/src/test/resources/oas31/array-items/new-3.0.yaml new file mode 100644 index 00000000..716ec65b --- /dev/null +++ b/core/src/test/resources/oas31/array-items/new-3.0.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (array-items) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + tags: + type: array + items: + type: integer diff --git a/core/src/test/resources/oas31/array-items/new-3.1.yaml b/core/src/test/resources/oas31/array-items/new-3.1.yaml new file mode 100644 index 00000000..c2ee10a3 --- /dev/null +++ b/core/src/test/resources/oas31/array-items/new-3.1.yaml @@ -0,0 +1,24 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (array-items) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + tags: + type: array + items: + type: integer diff --git a/core/src/test/resources/oas31/array-items/old-3.0.yaml b/core/src/test/resources/oas31/array-items/old-3.0.yaml new file mode 100644 index 00000000..20d2c47e --- /dev/null +++ b/core/src/test/resources/oas31/array-items/old-3.0.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (array-items) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + tags: + type: array + items: + type: string diff --git a/core/src/test/resources/oas31/array-items/old-3.1.yaml b/core/src/test/resources/oas31/array-items/old-3.1.yaml new file mode 100644 index 00000000..1066f73f --- /dev/null +++ b/core/src/test/resources/oas31/array-items/old-3.1.yaml @@ -0,0 +1,24 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (array-items) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + tags: + type: array + items: + type: string diff --git a/core/src/test/resources/oas31/exclusive-bounds/new-3.0.yaml b/core/src/test/resources/oas31/exclusive-bounds/new-3.0.yaml new file mode 100644 index 00000000..2f50911b --- /dev/null +++ b/core/src/test/resources/oas31/exclusive-bounds/new-3.0.yaml @@ -0,0 +1,19 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (exclusive-bounds) + version: "1.0" +paths: + /scores: + post: + operationId: createScore + requestBody: + content: + application/json: + schema: + type: integer + minimum: 0 + exclusiveMinimum: true + maximum: 100 + responses: + "200": + description: OK diff --git a/core/src/test/resources/oas31/exclusive-bounds/new-3.1.yaml b/core/src/test/resources/oas31/exclusive-bounds/new-3.1.yaml new file mode 100644 index 00000000..35f296f0 --- /dev/null +++ b/core/src/test/resources/oas31/exclusive-bounds/new-3.1.yaml @@ -0,0 +1,18 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (exclusive-bounds) + version: "1.0" +paths: + /scores: + post: + operationId: createScore + requestBody: + content: + application/json: + schema: + type: integer + exclusiveMinimum: 0 + maximum: 100 + responses: + "200": + description: OK diff --git a/core/src/test/resources/oas31/exclusive-bounds/old-3.0.yaml b/core/src/test/resources/oas31/exclusive-bounds/old-3.0.yaml new file mode 100644 index 00000000..64463c14 --- /dev/null +++ b/core/src/test/resources/oas31/exclusive-bounds/old-3.0.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (exclusive-bounds) + version: "1.0" +paths: + /scores: + post: + operationId: createScore + requestBody: + content: + application/json: + schema: + type: integer + minimum: 0 + maximum: 100 + responses: + "200": + description: OK diff --git a/core/src/test/resources/oas31/exclusive-bounds/old-3.1.yaml b/core/src/test/resources/oas31/exclusive-bounds/old-3.1.yaml new file mode 100644 index 00000000..30b0aa9b --- /dev/null +++ b/core/src/test/resources/oas31/exclusive-bounds/old-3.1.yaml @@ -0,0 +1,18 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (exclusive-bounds) + version: "1.0" +paths: + /scores: + post: + operationId: createScore + requestBody: + content: + application/json: + schema: + type: integer + minimum: 0 + maximum: 100 + responses: + "200": + description: OK diff --git a/core/src/test/resources/oas31/nullable/new-3.0.yaml b/core/src/test/resources/oas31/nullable/new-3.0.yaml new file mode 100644 index 00000000..570f5abf --- /dev/null +++ b/core/src/test/resources/oas31/nullable/new-3.0.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (nullable) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + notes: + type: string + nullable: true diff --git a/core/src/test/resources/oas31/nullable/new-3.1.yaml b/core/src/test/resources/oas31/nullable/new-3.1.yaml new file mode 100644 index 00000000..0b94cb62 --- /dev/null +++ b/core/src/test/resources/oas31/nullable/new-3.1.yaml @@ -0,0 +1,22 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (nullable) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + notes: + type: [string, "null"] diff --git a/core/src/test/resources/oas31/nullable/old-3.0.yaml b/core/src/test/resources/oas31/nullable/old-3.0.yaml new file mode 100644 index 00000000..12931e13 --- /dev/null +++ b/core/src/test/resources/oas31/nullable/old-3.0.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (nullable) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + notes: + type: string + nullable: false diff --git a/core/src/test/resources/oas31/nullable/old-3.1.yaml b/core/src/test/resources/oas31/nullable/old-3.1.yaml new file mode 100644 index 00000000..d34ac482 --- /dev/null +++ b/core/src/test/resources/oas31/nullable/old-3.1.yaml @@ -0,0 +1,22 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (nullable) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + notes: + type: [string] diff --git a/core/src/test/resources/oas31/one-of/new-3.0.yaml b/core/src/test/resources/oas31/one-of/new-3.0.yaml new file mode 100644 index 00000000..1b5bbb44 --- /dev/null +++ b/core/src/test/resources/oas31/one-of/new-3.0.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (one-of) + version: "1.0" +paths: + /widgets: + post: + operationId: createWidget + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetCreateRequest" + responses: + "200": + description: OK + 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: integer + Gadget: + type: object + properties: + gadget_prop1: + type: string diff --git a/core/src/test/resources/oas31/one-of/new-3.1.yaml b/core/src/test/resources/oas31/one-of/new-3.1.yaml new file mode 100644 index 00000000..942155ff --- /dev/null +++ b/core/src/test/resources/oas31/one-of/new-3.1.yaml @@ -0,0 +1,40 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (one-of) + version: "1.0" +paths: + /widgets: + post: + operationId: createWidget + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetCreateRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetCreateResponse" +components: + schemas: + WidgetCreateRequest: + oneOf: + - $ref: "#/components/schemas/Doodad" + - $ref: "#/components/schemas/Gadget" + WidgetCreateResponse: + oneOf: + - $ref: "#/components/schemas/Doodad" + - $ref: "#/components/schemas/Gadget" + Doodad: + type: object + properties: + doodad_prop1: + type: integer + Gadget: + type: object + properties: + gadget_prop1: + type: string diff --git a/core/src/test/resources/oas31/one-of/old-3.0.yaml b/core/src/test/resources/oas31/one-of/old-3.0.yaml new file mode 100644 index 00000000..ac5ae259 --- /dev/null +++ b/core/src/test/resources/oas31/one-of/old-3.0.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (one-of) + version: "1.0" +paths: + /widgets: + post: + operationId: createWidget + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetCreateRequest" + responses: + "200": + description: OK + 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 diff --git a/core/src/test/resources/oas31/one-of/old-3.1.yaml b/core/src/test/resources/oas31/one-of/old-3.1.yaml new file mode 100644 index 00000000..08ea3093 --- /dev/null +++ b/core/src/test/resources/oas31/one-of/old-3.1.yaml @@ -0,0 +1,40 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (one-of) + version: "1.0" +paths: + /widgets: + post: + operationId: createWidget + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetCreateRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetCreateResponse" +components: + schemas: + WidgetCreateRequest: + oneOf: + - $ref: "#/components/schemas/Doodad" + - $ref: "#/components/schemas/Gadget" + WidgetCreateResponse: + 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 diff --git a/core/src/test/resources/oas31/swagger2/new-2.0.yaml b/core/src/test/resources/oas31/swagger2/new-2.0.yaml new file mode 100644 index 00000000..6a147218 --- /dev/null +++ b/core/src/test/resources/oas31/swagger2/new-2.0.yaml @@ -0,0 +1,21 @@ +swagger: "2.0" +info: + title: oas31 harness fixture (swagger2) + version: "1.0" +paths: + /things: + get: + operationId: getThing + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: "#/definitions/Thing" +definitions: + Thing: + type: object + properties: + weight: + type: string diff --git a/core/src/test/resources/oas31/swagger2/old-2.0.yaml b/core/src/test/resources/oas31/swagger2/old-2.0.yaml new file mode 100644 index 00000000..dff00fd4 --- /dev/null +++ b/core/src/test/resources/oas31/swagger2/old-2.0.yaml @@ -0,0 +1,21 @@ +swagger: "2.0" +info: + title: oas31 harness fixture (swagger2) + version: "1.0" +paths: + /things: + get: + operationId: getThing + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: "#/definitions/Thing" +definitions: + Thing: + type: object + properties: + weight: + type: integer diff --git a/core/src/test/resources/oas31/type-change/new-3.0.yaml b/core/src/test/resources/oas31/type-change/new-3.0.yaml new file mode 100644 index 00000000..91ace429 --- /dev/null +++ b/core/src/test/resources/oas31/type-change/new-3.0.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (type-change) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + weight: + type: string diff --git a/core/src/test/resources/oas31/type-change/new-3.1.yaml b/core/src/test/resources/oas31/type-change/new-3.1.yaml new file mode 100644 index 00000000..289c69f9 --- /dev/null +++ b/core/src/test/resources/oas31/type-change/new-3.1.yaml @@ -0,0 +1,22 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (type-change) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + weight: + type: string diff --git a/core/src/test/resources/oas31/type-change/old-3.0.yaml b/core/src/test/resources/oas31/type-change/old-3.0.yaml new file mode 100644 index 00000000..075a3aa8 --- /dev/null +++ b/core/src/test/resources/oas31/type-change/old-3.0.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.3 +info: + title: oas31 harness fixture (type-change) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + weight: + type: integer diff --git a/core/src/test/resources/oas31/type-change/old-3.1.yaml b/core/src/test/resources/oas31/type-change/old-3.1.yaml new file mode 100644 index 00000000..fbe20717 --- /dev/null +++ b/core/src/test/resources/oas31/type-change/old-3.1.yaml @@ -0,0 +1,22 @@ +openapi: 3.1.0 +info: + title: oas31 harness fixture (type-change) + version: "1.0" +paths: + /things: + get: + operationId: getThing + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Thing" +components: + schemas: + Thing: + type: object + properties: + weight: + type: integer