Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend actors with a schema (or schemas) field #50

Open
mwvaughn opened this issue Nov 16, 2018 · 0 comments
Open

Extend actors with a schema (or schemas) field #50

mwvaughn opened this issue Nov 16, 2018 · 0 comments

Comments

@mwvaughn
Copy link

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants