Created
November 4, 2022 12:20
-
-
Save mikaelvesavuori/2a0ccf603028017c5d599ca05d8bdfa9 to your computer and use it in GitHub Desktop.
AsyncAPI demo for UserService
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "asyncapi": "2.4.0", | |
| "info": { | |
| "title": "User Service", | |
| "version": "1.0.0", | |
| "contact": { | |
| "name": "Sam Person", | |
| "url": "https://acmecorp.com/docs#owner", | |
| "email": "[email protected]" | |
| }, | |
| "description": "The User Service handles all things relating to users." | |
| }, | |
| "externalDocs": { | |
| "description": "Confluence documentation", | |
| "url": "https://acmecorp.com/UserService/docs" | |
| }, | |
| "servers": { | |
| "test": { | |
| "url": "https://api-test.acmecorp.com/", | |
| "protocol": "http", | |
| "description": "The test and dev endpoint." | |
| }, | |
| "production": { | |
| "url": "https://api.acmecorp.com/", | |
| "protocol": "http", | |
| "description": "Production endpoint." | |
| }, | |
| "bus": { | |
| "url": "arn:aws:events:eu-north-1:123412341234:event-bus/greet", | |
| "protocol": "eventbridge", | |
| "description": "The EventBridge bus to which we will subscribe to get events." | |
| } | |
| }, | |
| "channels": { | |
| "GetUserName": { | |
| "publish": { | |
| "bindings": { | |
| "http": { | |
| "type": "request", | |
| "method": "POST" | |
| } | |
| }, | |
| "message": { | |
| "$ref": "#/components/messages/GetUserName" | |
| } | |
| } | |
| }, | |
| "LogGreetedUser": { | |
| "publish": { | |
| "operationId": "logGreetedUser", | |
| "message": { | |
| "$ref": "#/components/messages/LogGreetedUser" | |
| } | |
| } | |
| } | |
| }, | |
| "components": { | |
| "messages": { | |
| "GetUserName": { | |
| "name": "GetUserName", | |
| "title": "Get user name by ID", | |
| "summary": "Returns the name of the user using the given ID.", | |
| "contentType": "application/json", | |
| "payload": { | |
| "$ref": "#/components/schemas/GetUserNameInput" | |
| } | |
| }, | |
| "LogGreetedUser": { | |
| "name": "LogGreetedUser", | |
| "title": "Log the greeted user", | |
| "summary": "Logs out the user that has been greeted for auditing purposes.", | |
| "payload": { | |
| "$ref": "#/components/schemas/LogGreetedUserEventInput" | |
| } | |
| } | |
| }, | |
| "schemas": { | |
| "GetUserNameInput": { | |
| "type": "object", | |
| "description": "Get user name by ID.", | |
| "properties": { | |
| "id": { | |
| "type": "number", | |
| "minimum": 0, | |
| "maximum": 99, | |
| "description": "Customer's ID number" | |
| } | |
| }, | |
| "additionalProperties": false | |
| }, | |
| "LogGreetedUserEventInput": { | |
| "type": "object", | |
| "description": "EventBridge input.", | |
| "properties": { | |
| "detail": { | |
| "type": "object", | |
| "description": "EventBridge `detail` field.", | |
| "$ref": "#/components/schemas/EventBridgeStandardSchema" | |
| } | |
| }, | |
| "required": ["detail"] | |
| }, | |
| "EventBridgeStandardSchema": { | |
| "type": "object", | |
| "description": "Our EventBridge standard schema.", | |
| "additionalProperties": false, | |
| "properties": { | |
| "data": { | |
| "type": "object", | |
| "description": "The user-provided data.", | |
| "additionalProperties": true | |
| }, | |
| "metadata": { | |
| "type": "object", | |
| "description": "General metadata that is always provided.", | |
| "additionalProperties": true, | |
| "$ref": "#/components/schemas/EventBridgeMetadataSchema" | |
| } | |
| }, | |
| "required": ["data", "metadata"] | |
| }, | |
| "EventBridgeMetadataSchema": { | |
| "type": "object", | |
| "description": "Our EventBridge standard metadata schema.", | |
| "additionalProperties": false, | |
| "properties": { | |
| "id": { | |
| "type": "string", | |
| "description": "ID of the event." | |
| }, | |
| "correlationId": { | |
| "type": "string", | |
| "description": "Correlation ID for the function call." | |
| }, | |
| "timestamp": { | |
| "type": "string", | |
| "description": "Timestamp of this message in Unix epoch." | |
| }, | |
| "timestampRequest": { | |
| "type": "string", | |
| "description": "Timestamp of the call." | |
| }, | |
| "level": { | |
| "type": "string", | |
| "description": "Log level." | |
| }, | |
| "context": { | |
| "type": "object", | |
| "description": "Context object.", | |
| "additionalProperties": true | |
| }, | |
| "version": { | |
| "type": "number", | |
| "description": "The version of the logged service." | |
| }, | |
| "user": { | |
| "type": "string", | |
| "description": "The user in this context." | |
| }, | |
| "route": { | |
| "type": "string", | |
| "description": "The route that is responding. In EventBridge, this will be your detail type." | |
| }, | |
| "duration": { | |
| "type": "number", | |
| "description": "Duration of processing in milliseconds." | |
| }, | |
| "error": { | |
| "type": "boolean", | |
| "description": "Is this an error?" | |
| }, | |
| "httpStatusCode": { | |
| "type": "number", | |
| "description": "What HTTP status code does this represent?", | |
| "minimum": 100, | |
| "maximum": 599 | |
| }, | |
| "traceId": { | |
| "type": "string", | |
| "description": "Trace ID." | |
| }, | |
| "lifecycleStage": { | |
| "type": "string", | |
| "description": "Which lifecycle stage the logged service pertains to." | |
| }, | |
| "domain": { | |
| "type": "string", | |
| "description": "Domain of the producer system." | |
| }, | |
| "system": { | |
| "type": "string", | |
| "description": "System of the producer." | |
| }, | |
| "service": { | |
| "type": "string", | |
| "description": "Service of the producer." | |
| }, | |
| "team": { | |
| "type": "string", | |
| "description": "Team responsible for emitting this log." | |
| }, | |
| "eventType": { | |
| "type": "string", | |
| "description": "Type of event." | |
| }, | |
| "platform": { | |
| "type": "string", | |
| "description": "The host platform or infrastructure that runs the system." | |
| }, | |
| "owner": { | |
| "type": "string", | |
| "description": "The organization that owns this system." | |
| }, | |
| "region": { | |
| "type": "string", | |
| "description": "Which region is this system running in?" | |
| }, | |
| "jurisdiction": { | |
| "type": "string", | |
| "description": "What legal jurisdiction does this system fall into?" | |
| }, | |
| "tags": { | |
| "type": "string", | |
| "description": "Tags for the logged system." | |
| }, | |
| "dataSensitivity": { | |
| "type": "string", | |
| "description": "Data sensitivity classification for the contents of this log.", | |
| "oneOf": [ | |
| { | |
| "title": "public", | |
| "type": "string", | |
| "format": "DataSensitivity" | |
| } | |
| ] | |
| } | |
| }, | |
| "required": [ | |
| "id", | |
| "correlationId", | |
| "timestamp", | |
| "timestampRequest", | |
| "level", | |
| "context", | |
| "version", | |
| "user", | |
| "route", | |
| "duration", | |
| "error", | |
| "httpStatusCode", | |
| "traceId", | |
| "lifecycleStage", | |
| "domain", | |
| "system", | |
| "service", | |
| "team", | |
| "eventType", | |
| "platform", | |
| "owner", | |
| "region", | |
| "jurisdiction" | |
| ] | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment