-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7cacd0
commit 51b1347
Showing
18 changed files
with
571 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
Add json schema support to workflows |
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
88 changes: 88 additions & 0 deletions
88
core/services/workflows/testdata/fixtures/workflows/marshalling/workflow_1.yaml
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,88 @@ | ||
triggers: | ||
- type: on_mercury_report@1 | ||
ref: report_data | ||
config: | ||
boolean_coercion: | ||
bools: | ||
- y | ||
- n | ||
- yes | ||
- no | ||
- Y | ||
- N | ||
- YES | ||
- NO | ||
- No | ||
- Yes | ||
- TRUE | ||
- FALSE | ||
- True | ||
- False | ||
- true | ||
- false | ||
strings: | ||
- TruE | ||
- FalsE | ||
- "true" | ||
- "false" | ||
- "TRUE" | ||
- "FALSE" | ||
- t | ||
- f | ||
- "T" | ||
- "F" | ||
- "t" | ||
- "f" | ||
- "1" | ||
- "0" | ||
- "yes" | ||
- "no" | ||
- "y" | ||
- "n" | ||
- "YES" | ||
- "NO" | ||
- "Y" | ||
- "N" | ||
numbers: | ||
- 1 | ||
- 0 | ||
feed_ids: | ||
- 123 # ETHUSD | ||
- 456 # LINKUSD | ||
- 789 # USDBTC | ||
|
||
# no actions | ||
|
||
consensus: | ||
- type: offchain_reporting@1 | ||
inputs: | ||
observations: | ||
- triggers.report_data.outputs | ||
config: | ||
aggregation_method: data_feeds_2_0 | ||
aggregation_config: | ||
123: # ETHUSD | ||
deviation: "0.005" | ||
heartbeat: 24h | ||
test: | ||
456: # LINKUSD | ||
deviation: "0.001" | ||
heartbeat: 24h | ||
789: # USDBTC | ||
deviation: "0.002" | ||
heartbeat: 6h | ||
encoder: EVM | ||
encoder_config: | ||
abi: "mercury_reports bytes[]" | ||
|
||
targets: | ||
- type: write_polygon_mainnet@1 | ||
inputs: | ||
report: | ||
- consensus.evm_median.outputs.report | ||
config: | ||
address: "0xaabbcc" | ||
method: "updateFeedValues(report bytes, role uint8)" | ||
params: [$(inputs.report), 1] | ||
|
||
# yaml-language-server: $schema=../workflow_schema.json |
15 changes: 15 additions & 0 deletions
15
core/services/workflows/testdata/fixtures/workflows/references/failing_1.yaml
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,15 @@ | ||
triggers: | ||
- type: trigger_test@1 | ||
config: {} | ||
|
||
consensus: | ||
- type: offchain_reporting@1 | ||
ref: offchain_reporting=1 | ||
config: {} | ||
|
||
targets: | ||
- type: write_polygon_mainnet@1 | ||
ref: write_polygon_mainnet_1 | ||
config: {} | ||
|
||
# yaml-language-server: $schema=../workflow_schema.json |
15 changes: 15 additions & 0 deletions
15
core/services/workflows/testdata/fixtures/workflows/references/passing_1.yaml
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,15 @@ | ||
triggers: | ||
- type: trigger_test@1 | ||
config: {} | ||
|
||
consensus: | ||
- type: offchain_reporting@1 | ||
ref: offchain_reporting_1 | ||
config: {} | ||
|
||
targets: | ||
- type: write_polygon_mainnet@1 | ||
ref: write_polygon_mainnet_1 | ||
config: {} | ||
|
||
# yaml-language-server: $schema=../workflow_schema.json |
16 changes: 16 additions & 0 deletions
16
core/services/workflows/testdata/fixtures/workflows/versioning/failing_1.yaml
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,16 @@ | ||
# Should fail since version is more specific than major | ||
triggers: | ||
- type: [email protected] | ||
config: {} | ||
|
||
consensus: | ||
- type: offchain_reporting@1 | ||
ref: offchain_reporting_1 | ||
config: {} | ||
|
||
targets: | ||
- type: write_polygon_mainnet@1 | ||
ref: write_polygon_mainnet_1 | ||
config: {} | ||
|
||
# yaml-language-server: $schema=../workflow_schema.json |
17 changes: 17 additions & 0 deletions
17
core/services/workflows/testdata/fixtures/workflows/versioning/failing_2.yaml
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,17 @@ | ||
|
||
# Should fail since version is more specific than major | ||
triggers: | ||
- type: [email protected] | ||
config: {} | ||
|
||
consensus: | ||
- type: offchain_reporting@1 | ||
ref: offchain_reporting_1 | ||
config: {} | ||
|
||
targets: | ||
- type: write_polygon_mainnet@1 | ||
ref: write_polygon_mainnet_1 | ||
config: {} | ||
|
||
# yaml-language-server: $schema=../workflow_schema.json |
15 changes: 15 additions & 0 deletions
15
core/services/workflows/testdata/fixtures/workflows/versioning/passing_1.yaml
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,15 @@ | ||
triggers: | ||
- type: trigger_test@1 | ||
config: {} | ||
|
||
consensus: | ||
- type: [email protected] | ||
ref: offchain_reporting_1 | ||
config: {} | ||
|
||
targets: | ||
- type: write_polygon_mainnet@1-alpha+sha246er3 | ||
ref: write_polygon_mainnet_1 | ||
config: {} | ||
|
||
# yaml-language-server: $schema=../workflow_schema.json |
66 changes: 66 additions & 0 deletions
66
core/services/workflows/testdata/fixtures/workflows/workflow_schema.json
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,66 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://github.com/smartcontractkit/chainlink/v2/core/services/workflows/workflow-spec", | ||
"$ref": "#/$defs/workflowSpec", | ||
"$defs": { | ||
"stepDefinition": { | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"pattern": "^[a-z0-9_\\-:]+@(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-]+)*))?$" | ||
}, | ||
"ref": { | ||
"type": "string", | ||
"pattern": "^[a-z0-9_]+$" | ||
}, | ||
"inputs": { | ||
"type": "object" | ||
}, | ||
"config": { | ||
"type": "object" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"type", | ||
"config" | ||
] | ||
}, | ||
"workflowSpec": { | ||
"properties": { | ||
"triggers": { | ||
"items": { | ||
"$ref": "#/$defs/stepDefinition" | ||
}, | ||
"type": "array" | ||
}, | ||
"actions": { | ||
"items": { | ||
"$ref": "#/$defs/stepDefinition" | ||
}, | ||
"type": "array" | ||
}, | ||
"consensus": { | ||
"items": { | ||
"$ref": "#/$defs/stepDefinition" | ||
}, | ||
"type": "array" | ||
}, | ||
"targets": { | ||
"items": { | ||
"$ref": "#/$defs/stepDefinition" | ||
}, | ||
"type": "array" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"triggers", | ||
"consensus", | ||
"targets" | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.