diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java index 9f2da51e..fdfb53ef 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java @@ -102,6 +102,15 @@ */ PathItem[] webhooks() default {}; + /** + * The identifier of the default JSON schema dialect for schemas in this document. + * + * @return the identifier of the default JSON schema dialect for schemas in this document + * + * @since 4.1 + */ + String jsonSchemaDialect() default ""; + /** * An element to hold a set of reusable objects for different aspects of the OpenAPI Specification (OAS). * diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java index 6bbd7b54..0fc7a193 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java @@ -34,5 +34,5 @@ * */ -@org.osgi.annotation.versioning.Version("1.2") +@org.osgi.annotation.versioning.Version("1.3") package org.eclipse.microprofile.openapi.annotations; \ No newline at end of file diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java index 92792221..87da785c 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java @@ -51,7 +51,8 @@ }, components = @Components(schemas = { @Schema(name = "Lizard", implementation = Lizard.class) - })) + }), + jsonSchemaDialect = "https://spec.openapis.org/oas/3.1/dialect/base") @Schema(externalDocs = @ExternalDocumentation(url = "http://swagger.io", description = "Find out more about our store")) public class PetStoreApp extends Application { @Override diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java index 45816cd7..98882677 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java @@ -303,4 +303,10 @@ public void testExtensionPlacement(String type) { vr.body(opPath + ".responses.'503'.content.'application/xml'", hasEntry(equalTo("x-notavailable-ext"), equalTo("true"))); } + + @Test(dataProvider = "formatProvider") + public void testSchemaDialect(String type) { + ValidatableResponse vr = callEndpoint(type); + vr.body("jsonSchemaDialect", equalTo("https://spec.openapis.org/oas/3.1/dialect/base")); + } }