Skip to content

Commit

Permalink
[Fix #742] Id, key and name refactor
Browse files Browse the repository at this point in the history
Id is removed.
Name remains mandatory and is clarified that should be unique.
Key description is updated and becomes optional in all cases.
Version is assumed to be latest if not specified

Signed-off-by: Francisco Javier Tirado Sarti <ftirados@redhat.com>
  • Loading branch information
fjtirado committed Feb 21, 2024
1 parent 3b6f976 commit 3c9316b
Show file tree
Hide file tree
Showing 41 changed files with 28 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .ci/validation/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export module SWSchemaValidator {
addFormats(ajv)


const workflowSchemaId = 'https://serverlessworkflow.io/schemas/0.8/workflow.json'
const workflowSchemaId = 'https://serverlessworkflow.io/schemas/0.9/workflow.json'
const schemaPath = '../../../schema'
export const defaultEncoding = 'utf-8'

Expand Down
1 change: 0 additions & 1 deletion examples/accumulate-room-readings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "roomreadings",
"name": "roomreadings",
"description": "Room Temp and Humidity Workflow",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/applicant-request-decision.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "applicantrequest",
"version": "1.0.0",
"specVersion": "0.8",
"name": "applicant-request-decision-workflow",
Expand Down
1 change: 0 additions & 1 deletion examples/async-function-invocation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "sendcustomeremail",
"version": "1.0.0",
"specVersion": "0.8",
"name": "send-customer-email-workflow",
Expand Down
1 change: 0 additions & 1 deletion examples/async-subflow-invocation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "onboardcustomer",
"version": "1.0.0",
"specVersion": "0.8",
"name": "onboard-customer",
Expand Down
1 change: 0 additions & 1 deletion examples/book-lending.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "booklending",
"name": "booklending",
"description": "Book Lending Workflow",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/car-vitals-checks-subflow.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "vitalscheck",
"name": "vitalscheck",
"description": "Car Vitals Check",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/car-vitals-checks.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "checkcarvitals",
"name": "checkcarvitals",
"description": "Check Car Vitals Workflow",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/check-inbox-periodically.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "check-inbox",
"name": "check-inbox",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
1 change: 0 additions & 1 deletion examples/continuing-as-a-new-execution.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "notifycustomerworkflow",
"name": "notifycustomerworkflow",
"description": "Notify Customer",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/event-based-greeting.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "eventbasedgreeting",
"version": "1.0.0",
"specVersion": "0.8",
"name": "Event Based Greeting Workflow",
Expand Down
1 change: 0 additions & 1 deletion examples/event-based-service-invocation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "vet-appointment-workflow",
"name": "vet-appointment-workflow",
"description": "Vet service call via events",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/event-based-transitions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "eventbasedswitchstate",
"version": "1.0.0",
"specVersion": "0.8",
"name": "event-based-switch-transitions",
Expand Down
1 change: 0 additions & 1 deletion examples/filling-a-glass-of-water.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "fillglassofwater",
"name": "fillglassofwater",
"description": "Fill glass of water workflow",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/finalize-college-application.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "finalize-college-application",
"name": "finalizeCollegeApplication",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
1 change: 0 additions & 1 deletion examples/greeting.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "greeting",
"version": "1.0.0",
"specVersion": "0.8",
"name": "greeting-workflow",
Expand Down
1 change: 0 additions & 1 deletion examples/handle-car-auction-bids.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "handle-car-auction-bid",
"version": "1.0.0",
"specVersion": "0.8",
"name": "handle-car-auction-bid",
Expand Down
3 changes: 1 addition & 2 deletions examples/hello-world.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"id": "helloworld",
"version": "1.0.0",
"specVersion": "0.8",
"name": "Hello World Workflow",
"name": "Hello-World-Workflow",
"description": "Inject Hello World",
"start": "hello-state",
"states": [
Expand Down
1 change: 0 additions & 1 deletion examples/monitor-job.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "jobmonitoring",
"version": "1.0.0",
"specVersion": "0.8",
"name": "jobmonitoring",
Expand Down
1 change: 0 additions & 1 deletion examples/monitor-patient-vital-signs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "patientVitalsWorkflow",
"name": "patientVitalsWorkflow",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
1 change: 0 additions & 1 deletion examples/new-patient-onboarding.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "patientonboarding",
"name": "patientonboarding",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
1 change: 0 additions & 1 deletion examples/parallel-execution.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "parallelexec",
"version": "1.0.0",
"specVersion": "0.8",
"name": "parallel-execution",
Expand Down
1 change: 0 additions & 1 deletion examples/perform-customer-credit-check.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "customercreditcheck",
"version": "1.0.0",
"specVersion": "0.8",
"name": "customercreditcheck",
Expand Down
1 change: 0 additions & 1 deletion examples/process-transactions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "customerbankingtransactions",
"name": "customerbankingtransactions",
"description": "Customer Banking Transactions Workflow",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/provision-orders.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "provisionorders",
"version": "1.0.0",
"specVersion": "0.8",
"name": "provision-orders",
Expand Down
1 change: 0 additions & 1 deletion examples/purchase-order-deadline.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "order",
"name": "order",
"description": "Purchase Order Workflow",
"version": "1.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/reusing-function-and-event-definitions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "paymentconfirmation",
"version": "1.0.0",
"specVersion": "0.8",
"name": "paymentconfirmation",
Expand Down
1 change: 0 additions & 1 deletion examples/send-cloudevent-on-workflow-completion.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "sendcloudeventonprovision",
"version": "1.0.0",
"specVersion": "0.8",
"name": "sendcloudeventonprovision",
Expand Down
1 change: 0 additions & 1 deletion examples/solving-math-problems.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"id": "solvemathproblems",
"version": "1.0.0",
"specVersion": "0.8",
"name": "solve-math-problems-workflow",
Expand Down
2 changes: 1 addition & 1 deletion schema/auth.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/auth.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/auth.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - auth schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/common.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/common.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/common.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - common schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/errors.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/errors.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/errors.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - errors schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/events.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/events.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/events.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - events schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/extensions.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/extensions.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - extensions schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/functions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/functions.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/functions.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - functions schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/odata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/odata.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/odata.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - OData command options schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/retries.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/retries.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/retries.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - retries schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/secrets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/secrets.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/secrets.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - secrets schema",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion schema/timeouts.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/timeouts.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/timeouts.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - functions schema",
"type": "object",
Expand Down
44 changes: 13 additions & 31 deletions schema/workflow.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
{
"$id": "https://serverlessworkflow.io/schemas/0.8/workflow.json",
"$id": "https://serverlessworkflow.io/schemas/0.9/workflow.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Serverless Workflow specification - workflow schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Workflow unique identifier",
"minLength": 1
},
"key": {
"name": {
"type": "string",
"description": "Domain-specific workflow identifier",
"description": "Workflow definition unique identifier (which must be human readable)",
"minLength": 1
},
"name": {
"version": {
"type": "string",
"description": "Workflow name",
"minLength": 1
"description": "Workflow version",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
},
"description": {
"type": "string",
"description": "Workflow description"
},
"version": {
"key": {
"type": "string",
"description": "Workflow version",
"minLength": 1,
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
"description": "Expression that will be used to generate a domain-specific workflow instance identifier"
},
"annotations": {
"type": "array",
Expand Down Expand Up @@ -152,22 +145,11 @@
}
},
"additionalProperties": false,
"oneOf": [
{
"required": [
"id",
"specVersion",
"states"
]
},
{
"required": [
"key",
"specVersion",
"states"
]
}
],
"required": [
"name",
"specVersion",
"states"
],
"definitions": {
"sleep": {
"type": "object",
Expand Down
7 changes: 3 additions & 4 deletions specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -1925,11 +1925,10 @@ definition "id" must be a constant value.

| Parameter | Description | Type | Required |
| --- | --- | --- | --- |
| id | Workflow unique identifier | string | yes (if `key` is not defined) |
| key | Domain-specific workflow identifier | string | yes (if `id` is not defined) |
| name | Workflow name | string | no |
| name | Workflow definition unique identifier (which must be human readable) | string | yes |
| version | Workflow version. MUST respect the [semantic versioning](https://semver.org/) format. If not provided, latest is assumed | string | no |
| description | Workflow description | string | no |
| version | Workflow version. MUST respect the [semantic versioning](https://semver.org/) format | string | no |
| key | Expression that will be used to generate a domain-specific workflow instance identifier | string | no |
| annotations | List of helpful terms describing the workflows intended purpose, subject areas, or other important qualities | array | no |
| dataInputSchema | Used to validate the workflow data input against a defined JSON Schema| string or object | no |
| dataOutputSchema | Used to validate the workflow data output against a defined JSON Schema| string or object | no |
Expand Down

0 comments on commit 3c9316b

Please sign in to comment.