Skip to content

Commit

Permalink
Add order_service_async_v1.yaml 3.0.0 specification
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshnikam671 committed Nov 28, 2024
1 parent 1738865 commit 92305c6
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions io/specmatic/examples/store/asyncapi/3_0_0/order_service_async_v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
asyncapi: 3.0.0

Check warning on line 1 in io/specmatic/examples/store/asyncapi/3_0_0/order_service_async_v1.yaml

View workflow job for this annotation

GitHub Actions / Check API Contracts

unrecognized-format
info:
title: Order API
version: '1.0.0'

channels:
place-order:
messages:
placeOrderMessage:
$ref: "#/components/messages/OrderRequest"

process-order:
messages:
processOrderMessage:
$ref: "#/components/messages/Order"

operations:
onPlaceOrder:
action: receive
channel:
$ref: '#/channels/place-order'
messages:
- $ref: "#/channels/place-order/messages/placeOrderMessage"
reply:
channel:
$ref: '#/channels/process-order'
messages:
- $ref: '#/channels/process-order/messages/processOrderMessage'

components:
messages:
OrderRequest:
name: OrderRequest
title: An order request
contentType: application/json
payload:
$ref: '#/components/schemas/OrderRequest'
examples:
- name: NEW_ORDER
payload:
id: 12345
orderItems:
- id: 1
name: "Macbook"
quantity: 1
price: 2000.00
- id: 2
name: "Iphone"
quantity: 1
price: 1000.00
Order:
name: OrderToProcess
title: An order that needs to be processed
contentType: application/json
payload:
type: object
required:
- totalAmount
- status
properties:
orderRequestId:
type: integer
totalAmount:
type: number
status:
type: string
enum:
- NEW
- IN_PROGRESS
- PROCESSED
- FAILED
examples:
- name: NEW_ORDER
payload:
totalAmount: 3000.00
status: "PROCESSED"
Notification:
name: Notification
title: A notification message
contentType: application/json
payload:
type: object
required:
- message
- type
properties:
message:
type: string
type:
type: string
enum:
- ORDER_PLACED
- ORDER_PROCESSED

examples:
- name: NEW_ORDER
payload:
message: "Order processed successfully"
type: "ORDER_PLACED"
schemas:
OrderRequest:
type: object
required:
- id
- orderItems
properties:
id:
description: Unique identifier of the order request
type: number
orderItems:
type: array
items:
$ref: '#/components/schemas/OrderItem'
OrderItem:
type: object
required:
- id
- name
- quantity
- price
properties:
id:
type: integer
name:
type: string
quantity:
type: integer
price:
type: number

0 comments on commit 92305c6

Please sign in to comment.