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

[Fix #742] Id, key and name refactor #824

Merged
merged 4 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
3 changes: 1 addition & 2 deletions examples/accumulate-room-readings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "roomreadings",
"name": "roomreadings",
"name": "room-readings",
"description": "Room Temp and Humidity Workflow",
"version": "1.0.0",
"specVersion": "0.8",
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
3 changes: 1 addition & 2 deletions examples/book-lending.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "booklending",
"name": "booklending",
"name": "book-lending",
"description": "Book Lending Workflow",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
3 changes: 1 addition & 2 deletions examples/car-vitals-checks-subflow.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "vitalscheck",
"name": "vitalscheck",
"name": "vitals-check",
"description": "Car Vitals Check",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
3 changes: 1 addition & 2 deletions examples/car-vitals-checks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "checkcarvitals",
"name": "checkcarvitals",
"name": "check-car-vitals",
"description": "Check Car Vitals Workflow",
"version": "1.0.0",
"specVersion": "0.8",
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
3 changes: 1 addition & 2 deletions examples/continuing-as-a-new-execution.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "notifycustomerworkflow",
"name": "notifycustomerworkflow",
"name": "notify-customer-workflow",
"description": "Notify Customer",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
3 changes: 1 addition & 2 deletions examples/event-based-greeting.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"id": "eventbasedgreeting",
"version": "1.0.0",
"specVersion": "0.8",
"name": "Event Based Greeting Workflow",
"name": "event-based-greeting-workflow",
"description": "Event Based Greeting",
"start": "greet",
"events": [
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
3 changes: 1 addition & 2 deletions examples/filling-a-glass-of-water.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "fillglassofwater",
"name": "fillglassofwater",
"name": "fill-glass-of-water",
"description": "Fill glass of water workflow",
"version": "1.0.0",
"specVersion": "0.8",
Expand Down
3 changes: 1 addition & 2 deletions examples/finalize-college-application.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "finalize-college-application",
"name": "finalizeCollegeApplication",
"name": "finalize-college-application",
"version": "1.0.0",
"specVersion": "0.8",
"start": "finalize-application",
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
3 changes: 1 addition & 2 deletions examples/monitor-job.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"id": "jobmonitoring",
"version": "1.0.0",
"specVersion": "0.8",
"name": "jobmonitoring",
"name": "job-monitoring",
"description": "Monitor finished execution of a submitted job",
"start": "submit-job",
"functions": [
Expand Down
3 changes: 1 addition & 2 deletions examples/monitor-patient-vital-signs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "patientVitalsWorkflow",
"name": "patientVitalsWorkflow",
"name": "patient-vitals-workflow",
"version": "1.0.0",
"specVersion": "0.8",
"start": "monitor-vitals",
Expand Down
3 changes: 1 addition & 2 deletions examples/new-patient-onboarding.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "patientonboarding",
"name": "patientonboarding",
"name": "patient-onboarding",
"version": "1.0.0",
"specVersion": "0.8",
"start": "onboard",
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
3 changes: 1 addition & 2 deletions examples/perform-customer-credit-check.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"id": "customercreditcheck",
"version": "1.0.0",
"specVersion": "0.8",
"name": "customercreditcheck",
"name": "customer-credit-check",
"description": "Perform Customer Credit Check",
"start": "check-credit",
"functions": [
Expand Down
3 changes: 1 addition & 2 deletions examples/process-transactions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"id": "customerbankingtransactions",
"name": "customerbankingtransactions",
"name": "customer-banking-transactions",
"description": "Customer Banking Transactions Workflow",
"version": "1.0.0",
"specVersion": "0.8",
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
3 changes: 1 addition & 2 deletions examples/reusing-function-and-event-definitions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"id": "paymentconfirmation",
"version": "1.0.0",
"specVersion": "0.8",
"name": "paymentconfirmation",
"name": "payment-confirmation",
"description": "Performs Payment Confirmation",
"functions": "file://functiondefs.json",
"events": "file://eventdefs.yml",
Expand Down
3 changes: 1 addition & 2 deletions examples/send-cloudevent-on-workflow-completion.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"id": "sendcloudeventonprovision",
"version": "1.0.0",
"specVersion": "0.8",
"name": "sendcloudeventonprovision",
"name": "send-cloudevent-provision",
"start": "provision-orders-state",
"events": [
{
Expand Down
3 changes: 1 addition & 2 deletions examples/solving-math-problems.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"id": "solvemathproblems",
"version": "1.0.0",
"specVersion": "0.8",
"name": "solve-math-problems-workflow",
"name": "solve-math-problems",
"description": "Solve math problems",
"start": "solve",
"functions": [
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",
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
"$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
45 changes: 14 additions & 31 deletions schema/workflow.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
{
"$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": {
fjtirado marked this conversation as resolved.
Show resolved Hide resolved
"type": "string",
"description": "Domain-specific workflow identifier",
"description": "The name that identifies the workflow definition, and which, when combined with its version, forms a unique identifier.",
"pattern": "^[a-z0-9](-?[a-z0-9])*$",
"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-]+)*))?$"
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
},
"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": "Optional expression that will be used to generate a domain-specific workflow instance identifier"
},
"annotations": {
"type": "array",
Expand Down Expand Up @@ -152,22 +146,11 @@
}
},
"additionalProperties": false,
"oneOf": [
{
"required": [
"id",
"specVersion",
"states"
]
},
{
"required": [
"key",
"specVersion",
"states"
]
}
],
"required": [
"name",
"specVersion",
"states"
],
"definitions": {
"sleep": {
"type": "object",
Expand Down
Loading
Loading