Skip to content

Commit c672086

Browse files
authored
Merge branch 'main' into feat-listen-any-events-until
2 parents fa51403 + 08af9e2 commit c672086

File tree

85 files changed

+1437
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1437
-425
lines changed

.ci/validation/package-lock.json

Lines changed: 16 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.ci/validation/src/ctk.test.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright 2023-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { SWSchemaValidator } from "./index";
18+
import fs from "node:fs";
19+
import path from "node:path";
20+
21+
SWSchemaValidator.prepareSchemas();
22+
23+
const ctkDir = path.join(__dirname, "..", "..", "..", "ctk", "features");
24+
25+
function extractYamlBlocks(content: string): string[] {
26+
const yamlBlockRegex = /"""yaml\s([\s\S]*?)\s"""/gm; // Match YAML blocks
27+
let match;
28+
const yamlBlocks: string[] = [];
29+
30+
while ((match = yamlBlockRegex.exec(content)) !== null) {
31+
yamlBlocks.push(match[1]);
32+
}
33+
34+
return yamlBlocks;
35+
}
36+
37+
const workflows = fs.readdirSync(ctkDir)
38+
.filter((file) => file.endsWith(".feature"))
39+
.flatMap((file) => {
40+
const filePath = path.join(ctkDir, file);
41+
const fileContent = fs.readFileSync(filePath, SWSchemaValidator.defaultEncoding);
42+
43+
const yamlBlocks = extractYamlBlocks(fileContent);
44+
45+
return yamlBlocks
46+
.map((yamlText) => SWSchemaValidator.yamlToJSON(yamlText))
47+
.filter((workflow) => typeof workflow === "object")
48+
.filter((workflow) => "document" in workflow)
49+
.filter((workflow) => "dsl" in workflow.document)
50+
.map((workflow) => ({ workflow, file }));
51+
});
52+
53+
describe(`Validate workflows from .feature files`, () => {
54+
test.each(workflows)('$workflow.document.name (from $file)', ({ workflow, file }) => {
55+
const results = SWSchemaValidator.validateSchema(workflow);
56+
57+
if (results?.errors) {
58+
console.warn(
59+
`Schema validation failed for workflow "${workflow.document.name}" in file "${file}" with:`,
60+
JSON.stringify(results.errors, null, 2)
61+
);
62+
}
63+
64+
expect(results?.valid).toBeTruthy();
65+
});
66+
});

.ci/validation/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export module SWSchemaValidator {
2525
addFormats(ajv);
2626

2727
const workflowSchemaId =
28-
"https://serverlessworkflow.io/schemas/1.0.0-alpha1/workflow.yaml";
28+
"https://serverlessworkflow.io/schemas/1.0.0-alpha5/workflow.yaml";
2929
const schemaPath = "../../../schema";
3030
export const defaultEncoding = "utf-8";
3131

.ci/validation/test/fixtures/invalid/extra-property-in-call.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
document:
2-
dsl: 1.0.0-alpha1
2+
dsl: '1.0.0-alpha5'
33
namespace: examples
44
name: two-tasks-in-one-item
5-
version: 1.0.0-alpha1
5+
version: '0.1.0'
66
do:
77
- getPet:
88
call: http

.ci/validation/test/fixtures/invalid/two-tasks-in-one-item.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
document:
2-
dsl: 1.0.0-alpha1
2+
dsl: '1.0.0-alpha5'
33
namespace: examples
44
name: two-tasks-in-one-item
5-
version: 1.0.0-alpha1
5+
version: '0.1.0'
66
do:
77
- getPet:
88
call: http

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Bug Report
2+
description: Create a bug report
3+
labels: ["type: bug"]
4+
body:
5+
6+
- type: markdown
7+
attributes:
8+
value: |
9+
:pray: Thanks for taking the time to fill out this bug report!
10+
11+
- type: markdown
12+
attributes:
13+
value: |
14+
## Bug Report
15+
16+
- type: textarea
17+
id: i-tried-this
18+
attributes:
19+
label: "I tried this:"
20+
placeholder: "What did you try to do? A code snippet or example helps."
21+
validations:
22+
required: true
23+
24+
- type: textarea
25+
id: instead-what-happened
26+
attributes:
27+
label: "This happened:"
28+
placeholder: "What happened instead of what you've expected?"
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: what-did-you-expect
34+
attributes:
35+
label: "I expected this:"
36+
placeholder: "What did you expect to happen? Describe the output or behavior you expected to see (unless it's obvious)."
37+
38+
- type: textarea
39+
id: workaround
40+
attributes:
41+
label: "Is there a workaround?"
42+
placeholder: "What's the workaround to avoid this issue?"
43+
44+
- type: textarea
45+
attributes:
46+
label: Anything else?
47+
placeholder: |
48+
Links? References? Logs? Anything that will give us more context about the issue you are encountering.
49+
Tip: You can attach images or log files by dragging files in.
50+
51+
- type: markdown
52+
attributes:
53+
value: |
54+
## Environment
55+
56+
- type: dropdown
57+
id: areas
58+
attributes:
59+
label: "Area(s)"
60+
multiple: true
61+
options:
62+
- Documentation
63+
- Schema
64+
- CTK
65+
- Examples
66+
- Use Cases
67+
- Community
68+
- Other
69+
70+
- type: textarea
71+
attributes:
72+
label: Community Notes
73+
value: |
74+
<!-- Please keep this note for the community -->
75+
* Please vote by adding a 👍 reaction to the issue to help us prioritize.
76+
* If you are interested to work on this issue, please leave a comment.name: Bug Report 🐞

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
blank_issues_enabled: false
2+
contact_links: []

.github/ISSUE_TEMPLATE/enhancement.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Feature Request
2+
description: Create a feature request
3+
labels: ["type: feature"]
4+
body:
5+
6+
- type: markdown
7+
attributes:
8+
value: |
9+
:pray: Thanks for taking the time to fill out this feature request!
10+
11+
- type: markdown
12+
attributes:
13+
value: |
14+
## Feature Request
15+
16+
- type: textarea
17+
id: what-would-you-like-to-be-added
18+
attributes:
19+
label: "What would you like to be added?"
20+
placeholder: "Description of the feature you'd like to see."
21+
validations:
22+
required: true
23+
24+
- type: textarea
25+
id: proposals
26+
attributes:
27+
label: "Proposal(s):"
28+
placeholder: "Describe your proposal(s) and any relevant details here."
29+
30+
- type: textarea
31+
id: alternatives
32+
attributes:
33+
label: "Alternative(s):"
34+
placeholder: "Describe any alternative approaches, options, or suggestions you’d like to consider."
35+
36+
- type: textarea
37+
id: additional-info
38+
attributes:
39+
label: "Additional info:"
40+
placeholder: "Provide any supplementary details, context, or supporting information here."
41+
42+
- type: textarea
43+
attributes:
44+
label: Community Notes
45+
value: |
46+
<!-- Please keep this note for the community -->
47+
* Please vote by adding a 👍 reaction to the feature to help us prioritize.
48+
* If you are interested to work on this feature, please leave a comment.

.github/ISSUE_TEMPLATE/new-extension.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

.markdownlint.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)