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

Adds support for external resources #701

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions schema/auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@
"description": "Serverless Workflow specification - auth schema",
"type": "object",
"auth": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing auth definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow auth definitions",
"items": {
"type": "object",
"$ref": "#/definitions/authdef"
},
"additionalItems": false,
"minItems": 1
}
]
"type": "array",
"description": "Workflow auth definitions",
"items": {
"type": "object",
"$ref": "#/definitions/authdef"
},
"additionalItems": false,
"minItems": 1
},
"required": [
"auth"
Expand Down
25 changes: 8 additions & 17 deletions schema/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@
"description": "Serverless Workflow specification - errors schema",
"type": "object",
"errors": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing error definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow Error definitions. Defines checked errors that can be explicitly handled during workflow execution",
"items": {
"type": "object",
"$ref": "#/definitions/errordef"
},
"additionalItems": false,
"minItems": 1
}
]
"type": "array",
"description": "Workflow Error definitions. Defines checked errors that can be explicitly handled during workflow execution",
"items": {
"type": "object",
"$ref": "#/definitions/errordef"
},
"additionalItems": false,
"minItems": 1
},
"required": [
"errors"
Expand Down
25 changes: 8 additions & 17 deletions schema/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@
"description": "Serverless Workflow specification - events schema",
"type": "object",
"events": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing event definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow CloudEvent definitions. Defines CloudEvents that can be consumed or produced",
"items": {
"type": "object",
"$ref": "#/definitions/eventdef"
},
"additionalItems": false,
"minItems": 1
}
]
"type": "array",
"description": "Workflow CloudEvent definitions. Defines CloudEvents that can be consumed or produced",
"items": {
"type": "object",
"$ref": "#/definitions/eventdef"
},
"additionalItems": false,
"minItems": 1
},
"required": [
"events"
Expand Down
25 changes: 8 additions & 17 deletions schema/functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@
"description": "Serverless Workflow specification - functions schema",
"type": "object",
"functions": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing function definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow function definitions",
"items": {
"type": "object",
"$ref": "#/definitions/function"
},
"additionalItems": false,
"minItems": 1
}
]
"type": "array",
"description": "Workflow function definitions",
"items": {
"type": "object",
"$ref": "#/definitions/function"
},
"additionalItems": false,
"minItems": 1
},
"required": [
"functions"
Expand Down
100 changes: 100 additions & 0 deletions schema/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/resources.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - resources schema",
"type": "object",
"resources":{
"type": "array",
"description": "Defines the external resources referenced by the workflow",
"items": {
"type": "object",
"$ref": "#/definitions/resourceRef"
},
"additionalItems": false,
"minItems": 1
},
"required":[
"resources"
],
"definitions":{
"resourceRef":{
"type": "object",
"description": "References an external resource",
"properties": {
"name": {
"type": "string",
"description": "The name of the external resource. It must be lowercased and must only contain alphanumeric characters, with the exception of `-` and `_`. The name is used as prefix to reference any definition contained in the referenced resource.",
"pattern": "^[a-z0-9-_]+$"
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
},
"uri": {
"type": "string",
"format": "uri",
"description": "The uri at which to find the referenced external resource definition"
},
"authRef": {
"type": "string",
"description": "References the (inline) auth definition used to retrieve the referenced external resource"
}
},
"required": [
"name",
"uri"
]
},
"resourceDef":{
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
"type": "object",
"description": "Defines an external resource",
"properties": {
"constants": {
"type": "object"
},
"secrets": {
"type": "array",
"items": {
"$ref": "secrets.json#/secrets"
}
},
"retries": {
"type": "array",
"items": {
"$ref": "retries.json#/retries"
}
},
"auth": {
"type": "array",
"items": {
"$ref": "auth.json#/auth"
}
},
"timeouts": {
"type": "array",
"items": {
"$ref": "timeouts.json#/timeouts"
}
},
"events": {
"type": "array",
"items": {
"$ref": "events.json#/events"
}
},
"functions": {
"type": "array",
"items": {
"$ref": "functions.json#/functions"
}
},
"errors": {
"type": "array",
"items": {
"$ref": "errors.json#/errors"
}
},
"metadata":{
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
"type": "object",
"additionalProperties": true
}
}
}
}
}
25 changes: 8 additions & 17 deletions schema/retries.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@
"description": "Serverless Workflow specification - retries schema",
"type": "object",
"retries": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing retry definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow Retry definitions. Define retry strategies that can be referenced in states onError definitions",
"items": {
"type": "object",
"$ref": "#/definitions/retrydef"
},
"additionalItems": false,
"minItems": 1
}
]
"type": "array",
"description": "Workflow Retry definitions. Define retry strategies that can be referenced in states onError definitions",
"items": {
"type": "object",
"$ref": "#/definitions/retrydef"
},
"additionalItems": false,
"minItems": 1
},
"required": [
"retries"
Expand Down
21 changes: 6 additions & 15 deletions schema/secrets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@
"description": "Serverless Workflow specification - secrets schema",
"type": "object",
"secrets": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing secrets definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow Secrets definitions",
"items": {
"type": "string"
},
"minItems": 1
}
]
"type": "array",
"description": "Workflow Secrets definitions",
"items": {
"type": "string"
},
"minItems": 1
},
"required": [
"secrets"
Expand Down
47 changes: 19 additions & 28 deletions schema/timeouts.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,27 @@
"description": "Serverless Workflow specification - functions schema",
"type": "object",
"timeouts": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing timeouts definitions (json or yaml)"
"type": "object",
"description": "Workflow default timeouts",
"properties": {
"workflowExecTimeout": {
"$ref": "#/definitions/workflowExecTimeout"
},
{
"type": "object",
"description": "Workflow default timeouts",
"properties": {
"workflowExecTimeout": {
"$ref": "#/definitions/workflowExecTimeout"
},
"stateExecTimeout": {
"$ref": "#/definitions/stateExecTimeout"
},
"actionExecTimeout": {
"$ref": "#/definitions/actionExecTimeout"
},
"branchExecTimeout": {
"$ref": "#/definitions/branchExecTimeout"
},
"eventTimeout": {
"$ref": "#/definitions/eventTimeout"
}
},
"additionalProperties": false,
"required": []
"stateExecTimeout": {
"$ref": "#/definitions/stateExecTimeout"
},
"actionExecTimeout": {
"$ref": "#/definitions/actionExecTimeout"
},
"branchExecTimeout": {
"$ref": "#/definitions/branchExecTimeout"
},
"eventTimeout": {
"$ref": "#/definitions/eventTimeout"
}
]
},
"additionalProperties": false,
"required": []
},
"required": [
"timeouts"
Expand Down
16 changes: 5 additions & 11 deletions schema/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,15 @@
}
]
},
"resources":{
"$ref": "resources.json#/resources"
},
"secrets": {
"$ref": "secrets.json#/secrets"
},
"constants": {
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing constants data (json or yaml)"
},
{
"type": "object",
"description": "Workflow constants data (object type)"
}
]
"type": "object",
"description": "Workflow constants data (object type)"
},
"start": {
"$ref": "#/definitions/startdef"
Expand Down
Loading