MCPcopy Create free account
hub / github.com/baerwang/openapi-rs / demonstrate_webhooks

Function demonstrate_webhooks

examples/openapi_31_features.rs:51–179  ·  view source on GitHub ↗

Demonstrates parsing and working with webhooks

()

Source from the content-addressed store, hash-verified

49
50/// Demonstrates parsing and working with webhooks
51fn demonstrate_webhooks() -> Result<()> {
52 let webhook_yaml = r#"
53openapi: 3.1.0
54info:
55 title: E-Commerce API with Webhooks
56 version: '1.0.0'
57webhooks:
58 orderCreated:
59 post:
60 summary: New order created
61 description: Fired when a new order is successfully created
62 operationId: orderCreated
63 tags:
64 - Webhooks
65 - Orders
66 requestBody:
67 required: true
68 content:
69 application/json:
70 schema:
71 type: object
72 properties:
73 order_id:
74 type: string
75 customer_id:
76 type: string
77 total:
78 type: number
79 status:
80 type: string
81 enum: [pending, processing, shipped, delivered, cancelled]
82 responses:
83 '200':
84 description: Webhook received
85 orderStatusChanged:
86 post:
87 summary: Order status updated
88 operationId: orderStatusChanged
89 requestBody:
90 required: true
91 content:
92 application/json:
93 schema:
94 type: object
95 responses:
96 '200':
97 description: Webhook processed
98 paymentCompleted:
99 post:
100 summary: Payment completed
101 operationId: paymentCompleted
102 parameters:
103 - name: X-Webhook-Signature
104 in: header
105 required: true
106 schema:
107 type: string
108 requestBody:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected