Skip to content

Commit

Permalink
Add OpenAPI.jsonSchemaDefinition to the annotations
Browse files Browse the repository at this point in the history
Allows setting the default schema dialect for the OpenAPI document. The
only value we can test here is the default one, since that's the only
one that implementations must support.
  • Loading branch information
Azquelt committed Dec 3, 2024
1 parent f245695 commit 18b6ad4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
* </pre>
*/

@org.osgi.annotation.versioning.Version("1.2")
@org.osgi.annotation.versioning.Version("1.3")
package org.eclipse.microprofile.openapi.annotations;
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

0 comments on commit 18b6ad4

Please sign in to comment.