Skip to content

Commit 7a5fb71

Browse files
committed
Add webhooks to the model API
1 parent 81a9613 commit 7a5fb71

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.eclipse.microprofile.openapi.models;
1919

2020
import java.util.List;
21+
import java.util.Map;
2122

2223
import org.eclipse.microprofile.openapi.models.info.Info;
2324
import org.eclipse.microprofile.openapi.models.security.SecurityRequirement;
@@ -275,6 +276,57 @@ default OpenAPI paths(Paths paths) {
275276
return this;
276277
}
277278

279+
/**
280+
* Returns the webhooks property of this OpenAPI instance.
281+
*
282+
* @return a copy Map (potentially immutable) of named webhook definitions
283+
* @since 4.0
284+
*/
285+
Map<String, PathItem> getWebhooks();
286+
287+
/**
288+
* Sets the webhooks property of this OpenAPI instance.
289+
*
290+
* @param webhooks
291+
* a map of named webhook definitions
292+
* @since 4.0
293+
*/
294+
void setWebhooks(Map<String, PathItem> webhooks);
295+
296+
/**
297+
* Sets the webhooks property of this OpenAPI instance.
298+
*
299+
* @param webhooks
300+
* a map of named webhook definitions
301+
* @return the current Schema instance
302+
* @since 4.0
303+
*/
304+
default OpenAPI webhooks(Map<String, PathItem> webhooks) {
305+
setWebhooks(webhooks);
306+
return this;
307+
}
308+
309+
/**
310+
* Adds a webhook definition.
311+
*
312+
* @param name
313+
* unique name of the webhook to add
314+
* @param webhook
315+
* webhook definition to add
316+
* @return the current Schema instance
317+
* @since 4.0
318+
*/
319+
OpenAPI addWebhook(String name, PathItem webhook);
320+
321+
/**
322+
* Removes a webhook definition.
323+
*
324+
* @param name
325+
* unique name of the webhook to remove
326+
* @since 4.0
327+
*/
328+
void removeWebhook(String name);
329+
278330
/**
279331
* Returns the components property from an OpenAPI instance.
280332
*

api/src/main/java/org/eclipse/microprofile/openapi/models/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
* </pre>
4141
*/
4242

43-
@org.osgi.annotation.versioning.Version("2.0")
43+
@org.osgi.annotation.versioning.Version("2.1")
4444
@org.osgi.annotation.versioning.ProviderType
4545
package org.eclipse.microprofile.openapi.models;

0 commit comments

Comments
 (0)