TACC / abaco

Actor Based Co(mputing)ntainers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extend actors with a schema (or schemas) field

mwvaughn opened this issue · comments

For actors designed to receive JSON messages (a good majority of the current crop), it is difficult to know the format of a valid message. The sd2e tenant has adopted a convention of bundling a descriptive JSONschema document with the deployed container which is used to validate incoming messages. However, one must consult either the source code, some sort of central registry, or the container itself to be able to discover the appropriate format for a JSON message. I propose adding a schema field to the actor data model, which is populated at registration/update time and then returned either by default as part of an actor's listing or at dedicated child endpoint. This enhances discoverability and permits use of client tools that can render JSON schema into user interface or language-specific objects. Here's an example schema from one of the sd2e actors:

{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"title": "PipelinesJobStateEvent",
	"description": "Directly send a state-change event to a Pipelines Job",
	"type": "object",
	"properties": {
		"uuid": {
			"description": "a UUID referring to a known Pipeline Job",
			"type": "string"
		},
		"event": {
			"description": "a valid Pipeline Job state-change event",
			"type": "string",
			"enum": ["update", "run", "fail", "finish", "validate", "validated", "reject", "finalize", "retire"]
		},
		"data": {
			"description": "an object containing additional context about the event (optional)",
			"type": "object"
		},
		"token": {
			"description": "an authorization token issued when the job was created",
			"type": "string",
			"minLength": 16,
			"maxLength": 17
		},
		"__options": {
			"type": "object",
			"description": "an object used to pass runtime options to a pipeline (private, optional)"
		}
	},
	"required": ["uuid", "event", "token"],
	"additionalProperties": false
}