JSON
kind: json
On this page
source | condition | target |
---|---|---|
✔ | ✔ | ✔ |
Description
source
The JSON "source" retrieves an information from a JSON file.
condition
The JSON "condition" tests that an information exist in a JSON file.
target
The JSON "target" ensures that a JSON file content a specific value at specific location.
Parameters
Name | Type | Description | Required |
---|---|---|---|
file | string | [s][c][t] File specifies the Json file to manipulate | |
files | array | [c][t] Files specifies a list of Json file to manipulate | |
key | string | [s][c][t] Key specifies the Jsonpath key to manipulate | |
query | string | [s][c][t] Query allows to used advanced query. Override the parameter key | |
value | string | [s][c][t] Value specifies the Jsonpath key to manipulate. Default to source output | |
versionfilter | object | [s]VersionFilter provides parameters to specify version pattern and its type like regex, semver, or just latest. | |
kind | string | specifies the version kind such as semver, regex, or latest | |
pattern | string | specifies the version pattern according the version kind | |
strict | boolean | strict enforce strict versioning rule. Only used for semantic versioning at this time |
Query
The JSON plugin relies on Dasel to query json files
Example
# updatecli.yaml
name: Basic Json Example
scms:
default:
kind: git
spec:
url: https://github.com/updatecli/updatecli.git
sources:
local:
name: Get value from json
kind: json
scmid: default
spec:
file: pkg/plugins/resources/json/testdata/data.json
key: firstName
http:
name: Get value from json
kind: json
spec:
file: https://www.updatecli.io/schema/latest/config.json
key: $id
conditions:
local:
name: Test value from json
kind: json
sourceid: local
scmid: default
spec:
file: pkg/plugins/resources/json/testdata/data.json
key: firstName
http:
name: Test value from json
kind: json
disablesourceinput: true
spec:
file: https://www.updatecli.io/schema/latest/config.json
key: $schema
value: http://json-schema.org/draft-04/schema
targets:
local:
name: Test value from json
kind: json
sourceid: local
scmid: default
spec:
file: pkg/plugins/resources/json/testdata/data.json
key: firstName
value: John