Skip to content

Instantly share code, notes, and snippets.

@dalelane
Last active May 8, 2023 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalelane/62803461d2c1df5577c89e38785b7f81 to your computer and use it in GitHub Desktop.
Save dalelane/62803461d2c1df5577c89e38785b7f81 to your computer and use it in GitHub Desktop.
asyncapi: 2.6.0
id: https://github.com/dalelane/my-asyncapi-v2-doc
info:
title: Modo Jeans order system
description: >
Need to write something here
### Using headers
* And bullet points
* And **formatting** such as `code`
* And images
![placeholder](https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Placeholder_view_vector.svg/310px-Placeholder_view_vector.svg.png)
(Images can be more interesting than that)
contact:
name: Dale Lane
email: email@dalelane.co.uk
url: https://dalelane.co.uk
version: 0.0.1
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
termsOfService: https://dalelane.co.uk/asyncapi/terms-of-service
tags:
- name: example
description: Things that are used as an example of the spec
- name: simple
defaultContentType: application/json
servers:
eventstreams:
protocol: kafka-secure
protocolVersion: 3.3.0
description: A secure Kafka cluster running in **OpenShift**
url: es-kafka-bootstrap-eventstreams.{host}:{port}
security:
- kafkaEventStreams: []
bindings:
kafka:
schemaRegistryUrl: https://my-apicurio-schema-registry.com
schemaRegistryVendor: apicurio
bindingVersion: 0.4.0
tags:
- name: example
- name: openshift
description: Servers running in OpenShift
variables:
host:
default: apps.dale-lane.cp.fyre.ibm.com
description: hostname for the OpenShift cluster
examples:
- apps.dale-lane.cp.fyre.ibm.com
- apps.dalelane-neptune.cp.fyre.ibm.com
port:
default: '443'
description: port number for clients to connect to
channels:
CANCELLATIONS:
description: Notifications about orders that are being cancelled and refunded
subscribe:
operationId: orderCancellation
summary: Order cancellation event
description: >
descriptions of the reasons that lead to a cancellation being recorded
could go here
Can orders be cancelled after shipping? Or only before?
Describe that here.
Maybe include a picture that represents a cancelled order
![cancellation!](https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/OOjs_UI_icon_cancel-destructive.svg/240px-OOjs_UI_icon_cancel-destructive.svg.png)
externalDocs:
url: https://modojeans.com/orders/cancellation-process
description: Order cancellation system
tags:
- name: orders
description: Resources relating to Modo Jeans orders
message:
messageId: modoJeansCancellationMessage
name: modoJeansCancellation
title: Modo Jeans Order cancellation notification
summary: A message containing details of a new order
description: >-
More info about how the cancellation notifications are **created** and
**used**.
tags:
- name: orders
description: Resources relating to Modo Jeans orders
externalDocs:
description: Info about signing up for cancellation notifications
url: https://modojeans.com/orders/cancellation/api
headers:
type: object
properties:
orderSource:
description: >-
unique ID of the application used to register the order
cancellation
type: string
payload:
type: object
required:
- orderid
properties:
orderid:
description: id of the order that was cancelled
type: string
format: uuid
schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0
contentType: application/json
ORDERS:
description: This is how the **Orders** topic is used in [Modo](https://modojeans.com).
subscribe:
operationId: orderNotification
message:
$ref: '#/components/messages/newOrder'
traits:
- $ref: '#/components/operationTraits/kafka'
components:
securitySchemes:
kafkaEventStreams:
type: scramSha512
description: Event Streams credentials
messages:
newOrder:
messageId: modoJeansOrderMessage
name: modoJeansOrder
title: Modo Jeans New Order notification
summary: A message containing details of a new order
description: >-
More info about how the order notifications are **created** and
**used**.
tags:
- name: orders
description: Resources relating to Modo Jeans orders
externalDocs:
description: Info about signing up for order notifications
url: https://modojeans.com/intranet/orders/api
headers:
type: object
properties:
orderSource:
description: unique ID of the application used to create the order
type: string
payload:
type: object
order:
$ref: '#/components/schemas/newOrder'
schemaFormat: application/vnd.aai.asyncapi+yaml;version=2.6.0
contentType: application/json
bindings:
kafka:
key:
type: object
required:
- region
properties:
region:
type: string
enum:
- west
- east
- north
- south
bindingVersion: 0.4.0
examples:
- name: SimpleOrder
summary: Example of a simple order
headers:
orderSource: modo-core-sys
someCustomHeader: my-value
payload:
order:
version: v2
id: ABCD1234
catalogid: ABC013312312
quantity: 3
cost: 9.99
customer: bob@customer.com
traits:
- $ref: '#/components/messageTraits/kafkaHeaders'
schemas:
newOrder:
title: New Order message payload
type: object
oneOf:
- $ref: '#/components/schemas/newOrderV1'
- $ref: '#/components/schemas/newOrderV2'
required:
- version
- id
descriminator: version
properties:
id:
type: string
description: unique order id on the Modo Jeans order system
version:
type: string
enum:
- v1
- v2
externalDocs:
description: Info about signing up for order notifications
url: https://modojeans.com/intranet/orders/data
newOrderV1:
title: New Order message payload
deprecated: true
type: object
required:
- version
- id
- itemid
- cost
properties:
id:
type: string
description: unique order id on the Modo Jeans order system
version:
type: string
enum:
- v1
itemid:
type: string
cost:
type: number
format: double
newOrderV2:
title: Order message payload from new systems
type: object
required:
- version
- id
- catalogid
- quantity
- cost
- customer
properties:
id:
type: string
description: unique order id on the Modo Jeans order system
version:
type: string
enum:
- v2
catalogid:
type: string
quantity:
type: integer
format: int32
default: 1
minimum: 0
cost:
type: number
format: double
discount:
type: number
format: double
customer:
type: string
format: email
description: username for the order - should be the email address of the customer
operationTraits:
kafka:
summary: Operation traits that are common to all Kafka operations
description: Detailed **description** goes here
tags:
- name: kafka
bindings:
kafka:
clientId:
type: string
groupId:
type: string
bindingVersion: 0.4.0
messageTraits:
kafkaHeaders:
headers:
type: object
properties:
someCustomHeader:
description: A common header included for all Kafka messages
type: string
tags:
- name: kafka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment