message_wrapper.py 1.94 KB
Newer Older
1 2
"""
    schemas: Message Wrapper is used to wrap all message types that contain
3 4
    details of where the message is coming from, which end client is its
    destination and the type of message.
5 6 7 8 9 10 11 12 13 14
"""

message_wrapper_schema = {
    "type": "object",
    "discriminator": {
        "propertyName": "message_type",
    },
    "properties": {
        "message_ID": {
            "type": "string",
15
            "description": "An identifier for the type of message received.",
16
            "example": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
17 18
        },
        "timestamp": {
19 20
            "type": "string",
            "format": "date-time",
21 22 23 24
            "description": "Timestamp of message",
            "example": "2022-11-16T00:00:00Z",
        },
        "message_type": {
25
            "type": "string",
26 27 28 29
            "description": "Type of message",
            "example": "platform_status",
        },
        "version": {
30 31 32
            "type": "number",
            "format": "float",
            "description": "Version of comms backbone message format protocol",
33 34 35 36 37 38 39 40 41
            "example": 2.0,
        },
        "source": {
            "type": "string",
            "description": "The sender; Where is this message from",
            "example": "autonomy_engine",
        },
        "destination": {
            "type": "string",
42 43
            "description": "Publisher topic; What is the destination"
            + " of this message",
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
            "example": "ah1",
        },
        "encoded": {
            "type": "boolean",
            "description": "Indicate that message raw (encoded) or decoded. "
            + "Options: encoded=True, decoded=False",
            "example": False,
        },
        "delivery_type": {
            "type": "string",
            "description": "To publish or broadcast this message.",
            "enum": ["broadcast", "publish"],
            "example": "publish",
            "default": "publish",
        },
    },
    "required": ["message_type"],
}