From 7186b1a9f2f417b737f34e95bfc6dade9e8c1718 Mon Sep 17 00:00:00 2001 From: Lukas Burgey Date: Mon, 20 Aug 2018 17:54:14 +0200 Subject: [PATCH] Add schemas for input and output --- README.md | 3 +- schema-input.json | 106 +++++++++++++++++++++++++++++++++++++++++++++ schema-output.json | 74 +++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 schema-input.json create mode 100644 schema-output.json diff --git a/README.md b/README.md index a0780f2..e285d14 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ FEUDAL scripts are executed by a FEUDAL client to facilitate the customized depl of an arbitrary service. They use the JSON encoding for input and output. The specific formats are outlined below. +Schema files for [input](schema-input.json) and [output](schema-output.json) are also available. Input Format @@ -70,4 +71,4 @@ Output Format "key": "value" } } -``` \ No newline at end of file +``` diff --git a/schema-input.json b/schema-input.json new file mode 100644 index 0000000..e699c71 --- /dev/null +++ b/schema-input.json @@ -0,0 +1,106 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "state_target": { + "type": "string", + "enum": [ + "deployed", + "not_deployed" + ] + }, + "user": { + "type": "object", + "properties": { + "userinfo": { + "type": "object", + "properties": { + "eduPersonEntitlement": { + "type": "array", + "items": { + "type": "string" + } + }, + "email": { + "type": "string" + }, + "email_verified": { + "type": "string" + }, + "groups": { + "type": "array", + "items": [ + { + "type": "string" + } + ] + }, + "iss": { + "type": "string" + }, + "name": { + "type": "string" + }, + "preferred_username": { + "type": "string" + }, + "ssh_key": { + "type": "string" + }, + "sub": { + "type": "string" + } + }, + "required": [ + "email", + "email_verified", + "groups", + "iss", + "name", + "preferred_username", + "ssh_key", + "sub" + ] + } + }, + "required": [ + "userinfo" + ] + }, + "credentials": { + "type": "object", + "properties": { + "ssh_key": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "name", + "value" + ] + } + ] + } + }, + "required": [ + ] + }, + "questionnaire": { + "type": "object" + } + }, + "required": [ + "state_target", + "user", + "credentials" + ] +} diff --git a/schema-output.json b/schema-output.json new file mode 100644 index 0000000..7c2ab28 --- /dev/null +++ b/schema-output.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "oneOf": [ + { + "properties": { + "state": { + "type": "string", + "enum": [ + "deployed" + ] + }, + "message": { + "type": "string" + }, + "credentials": { + "type": "object" + } + }, + "required": [ + "state" + ] + }, + { + "properties": { + "state": { + "type": "string", + "enum": [ + "not_deployed" + ] + } + }, + "required": [ + "state" + ] + }, + { + "properties": { + "state": { + "type": "string", + "enum": [ + "failed", + "rejected" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "state", + "message" + ] + }, + { + "properties": { + "state": { + "type": "string", + "enum": [ + "questionnaire" + ] + }, + "questionnaire": { + "type": "object" + } + }, + "required": [ + "state", + "questionnaire" + ] + } + + ] +} -- GitLab