From 72efb9314172fcddefc9bf4e5db4f1f51e0cb7ca Mon Sep 17 00:00:00 2001 From: Anwar Hidayat Date: Wed, 17 Nov 2021 10:56:35 +0700 Subject: [PATCH] doc: update readme and example to reflect the latest changes --- README.md | 11 +++++------ example/procedure/enrich_user_account.jsonnet | 10 ++++------ valor.example.yaml | 1 - 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b1315c3..9e6575d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ frameworks: type: file format: json path: ./example/schema/user_account_rule.json - output_is_error: true procedures: - name: enrich_user_account type: file @@ -53,13 +52,13 @@ In this example, Resource named `user_account` will be evaluated agaist framework named `user_account_validation`. The targetted framework specifies three things: -* Schema follows JSON schema format to validate the Resource. It is +* Schema, which follows JSON schema format to validate the Resource. It is required to validate whether the structure for the `user_account` Resource contains error or not. -* Procedure follows JSONNET format to evaluate the `user_account` Resource. +* Procedure, which follows JSONNET format to evaluate the `user_account` Resource. It can be for validation or any execution that can't be handled by using Schema. -* Output Target specifies on how to write the output of either Schema or +* Output Target, which specifies on how to write the output of either Schema or Procedure or both. ### 3. Execute Pipeline @@ -68,11 +67,11 @@ After the preparation is done, try running valor by executing the following command: ```zsh -./out/valor +./out/valor execute ``` Or, if you have not build it, try building it by following [#HowToBuild](#how-to-build). -Make sure to have the require dependencies specified under [#Dependency](#dependency). +Make sure to have the required dependencies specified under [#Dependency](#dependency). The output of the above solution should look like the following: ```zsh diff --git a/example/procedure/enrich_user_account.jsonnet b/example/procedure/enrich_user_account.jsonnet index 1ee83fb..7540baf 100644 --- a/example/procedure/enrich_user_account.jsonnet +++ b/example/procedure/enrich_user_account.jsonnet @@ -1,8 +1,6 @@ -local enrich(data) = { - email: data.email, - membership: data.membership, - is_active: data.is_active, +local evaluate(resource, definition, previous) = { + email: resource.email, + membership: resource.membership, + is_active: resource.is_active, is_valid: true }; - -enrich(user_account) diff --git a/valor.example.yaml b/valor.example.yaml index 1070d0a..2ad47e3 100644 --- a/valor.example.yaml +++ b/valor.example.yaml @@ -13,7 +13,6 @@ frameworks: type: file format: json path: ./example/schema/user_account_rule.json - output_is_error: true procedures: - name: enrich_user_account type: file