Skip to content

Commit

Permalink
Add Json documentation (#504)
Browse files Browse the repository at this point in the history
* Add Json documentation

Signed-off-by: Olblak <me@olblak.com>

* remove swp file

Signed-off-by: Olblak <me@olblak.com>

* Fix json example

Signed-off-by: Olblak <me@olblak.com>

Signed-off-by: Olblak <me@olblak.com>
  • Loading branch information
olblak committed Sep 28, 2022
1 parent 5bbfc25 commit a0edbd6
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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

59 changes: 59 additions & 0 deletions content/en/docs/plugins/resource/json.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: "JSON"
description: "Manipulate Json information"
lead: "kind: json"
date: 2021-09-24T19:19:01+02:00
draft: false
images: []
menu:
docs:
parent: "plugin-resource"
toc: true
plugins:
- source
- condition
- target
---
// <!-- Required for asciidoctor -->
:toc:
// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key
:toclevels: 4

[cols="1^,1^,1^",options=header]
|===
| source | condition | target
| &#10004; | &#10004; | &#10004;
|===

== 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

{{< resourceparameters "sources" "json" >}}

=== Xpath

Under construction, some help would be need to document common jsonpath query that work with Updatecli
https://www.w3.org/TR/1999/REC-xpath-19991116/

== Example

[source,yaml]
----
# updatecli.yaml
{{<include "assets/code_example/docs/plugins/resources/json/updatecli.d/default.yaml">}}
----


0 comments on commit a0edbd6

Please sign in to comment.