-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cloudworkflows.json Schema (#1354)
* Add .clasp.json schema. Fix appsscript.json schema title * Fix libraries array * For appsscript.json, add dataStudio * Improve defaults for appsscript.json. Misc improvements * feat: Add more appsscript.json properties * feat: add cloudworkflows.json Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: add object with steps Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: update steps Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: a Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: add comments Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: do not require step keys Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: support subworkflows Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: add pattern properties Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: fix subworkflows Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: variable assign Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * test 2 Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * test 3 Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * remove properties from try Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: add except steps Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: test Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * 5 Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix steps Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix steps Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix step list Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix step list Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix step list Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix step list Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: add map of subworkflows Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: add subworkflows Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: remove top subworkflow Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: return anything Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: try 14 Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * feat: final schema Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: cloudworkflows.json: permit url or string Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: permit return in conditions Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: fix cloudworkflows ci Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
- Loading branch information
Showing
2 changed files
with
259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Google Cloud Workflows config file", | ||
"description": "Orchestrate Workflows consisting of Google Cloud APIs, SaaS APIs or private API endpoints.", | ||
"anyOf": [ | ||
{ | ||
"description": "A list of steps.", | ||
"$ref": "#/definitions/stepArray" | ||
}, | ||
{ | ||
"description": "A map of subworkflows.", | ||
"minItems": 1, | ||
"patternProperties": { | ||
"^.*$": { | ||
"description": "A subworkflow.", | ||
"$ref": "#/definitions/subworkflow" | ||
} | ||
} | ||
} | ||
], | ||
"definitions": { | ||
"subworkflow": { | ||
"description": "A subworkflow.", | ||
"properties": { | ||
"params": { | ||
"description": "A list of parameters.", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"steps": { | ||
"description": "An array of objects with a single step.", | ||
"$ref": "#/definitions/stepArray" | ||
} | ||
} | ||
}, | ||
"stepArray": { | ||
"type": "array", | ||
"description": "An array of objects with a single step.", | ||
"minItems": 1, | ||
"items": { | ||
"description": "An object with a single step.", | ||
"minItems": 1, | ||
"maxItems": 1, | ||
"patternProperties": { | ||
"^.*$": { | ||
"description": "A single workflow step.", | ||
"$ref": "#/definitions/step" | ||
} | ||
} | ||
} | ||
}, | ||
"step": { | ||
"description": "A single workflow step.", | ||
"additionalProperties": false, | ||
"properties": { | ||
"call": { | ||
"description": "Required. Use `http.get`, `http.post`, or `http.request` for HTTP requests.", | ||
"type": "string", | ||
"enum": [ | ||
"http.get", | ||
"http.post", | ||
"http.request", | ||
"sys.sleep" | ||
] | ||
}, | ||
"args": { | ||
"description": "Arguments to a workflow step.", | ||
"additionalProperties": false, | ||
"properties": { | ||
"url": { | ||
"anyOf": [{ | ||
"type": "string", | ||
"description": "Required. URL where the request is sent.", | ||
"format": "uri" | ||
}, { | ||
"type": "string", | ||
"description": "Required. An expression that resultvs to a URL where the request is sent." | ||
}] | ||
}, | ||
"method": { | ||
"type": "string", | ||
"description": "Required if using call type http.request. The type of HTTP request method to use.", | ||
"enum": [ | ||
"GET", | ||
"HEAD", | ||
"POST", | ||
"PUT", | ||
"DELETE", | ||
"CONNECT", | ||
"OPTIONS", | ||
"TRACE", | ||
"PATCH" | ||
] | ||
}, | ||
"header": { | ||
"type": "object", | ||
"description": "Request headers." | ||
}, | ||
"body": { | ||
"type": "object", | ||
"description": "Request body." | ||
}, | ||
"query": { | ||
"type": "object", | ||
"description": "Request query parameters." | ||
}, | ||
"auth": { | ||
"description": "Required if the API being called requires authentication.", | ||
"additionalProperties": false, | ||
"properties": { | ||
"type": { | ||
"description": "The type of authentication.", | ||
"enum": ["OIDC", "OAuth2"] | ||
} | ||
} | ||
}, | ||
"timeout": { | ||
"type": "number", | ||
"description": "Time in seconds. How long a request is allowed to run before throwing an exception." | ||
}, | ||
"seconds": { | ||
"type": "number", | ||
"description": "The number of seconds to sleep." | ||
} | ||
}, | ||
"required": [ | ||
"url" | ||
] | ||
}, | ||
"assign": { | ||
"type": "array", | ||
"description": "Define a dictionary.", | ||
"items": { | ||
"description": "A single variable assignment.", | ||
"minItems": 1, | ||
"maxItems": 1 | ||
} | ||
}, | ||
"result": { | ||
"type": "string", | ||
"description": "Variable name where the result of an HTTP invocation step is stored." | ||
}, | ||
"switch": { | ||
"type": "array", | ||
"description": "A switch block.", | ||
"items": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"condition": { | ||
"description": "An expression to switch on.", | ||
"type": "string" | ||
}, | ||
"next": { | ||
"description": "The next step to jump to. \"end\" to terminate.", | ||
"type": "string", | ||
"default": "end" | ||
}, | ||
"steps": { | ||
"description": "A list of steps to run in this switch statement.", | ||
"$ref": "#/definitions/stepArray" | ||
}, | ||
"return": { | ||
"description": "Stop a workflow's execution and return a value, variable, or expression." | ||
} | ||
}, | ||
"required": ["condition"] | ||
} | ||
}, | ||
"next": { | ||
"type": "string", | ||
"description": "The next step to jump to. \"end\" to terminate.", | ||
"default": "end" | ||
}, | ||
"return": { | ||
"description": "Stop a workflow's execution and return a value, variable, or expression." | ||
}, | ||
"try": { | ||
"description": "Try a single step or a list of steps.", | ||
"$ref": "#/definitions/step" | ||
}, | ||
"retry": { | ||
"description": "Optional. If omitted, all other fields are required. Options include ${http.default_retry} and ${http.default_retry_non_idempotent}. Allows you to specify a default retry policy to use. If you specify a retry policy, omit all other fields in the retry block.", | ||
"properties": { | ||
"predicate": { | ||
"type": "string", | ||
"description": "Required if you don't select a default retry policy. Defines which error codes will be retried. Options include ${http.default_retry_predicate}, ${http.default_retry_predicate_non_idempotent}, or a custom predicate defined as a subworkflow." | ||
}, | ||
"max_retries": { | ||
"type": "integer", | ||
"description": "Maximum number of times a step will be retried." | ||
}, | ||
"backoff": { | ||
"description": "Block that controls how retries occur.", | ||
"properties": { | ||
"initial_delay": { | ||
"type": "integer", | ||
"description": "Delay in seconds between the initial failure and the first retry." | ||
}, | ||
"max_delay": { | ||
"type": "integer", | ||
"description": "Maximum delay in seconds between retries." | ||
}, | ||
"multiplier": { | ||
"type": "integer", | ||
"description": "Multiplier applied to the previous delay to calculate the delay for the subsequent retry." | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"except": { | ||
"description": "Except a try clause.", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/step" | ||
}, | ||
{ | ||
"properties": { | ||
"as": { | ||
"type": "string", | ||
"description": "Name of a dictionary variable that contains the error message." | ||
}, | ||
"steps": { | ||
"description": "An array of objects with a single step.", | ||
"$ref": "#/definitions/stepArray" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"raise": { | ||
"description": "Raise an exception.", | ||
"anyOf": [{ | ||
"description": "String message.", | ||
"type": "string" | ||
}, { | ||
"description": "A dictionary.", | ||
"type": "object" | ||
}] | ||
} | ||
} | ||
} | ||
} | ||
} |