From 176b260e71fd3ab07fca1bc4440e545d4ccb3fd8 Mon Sep 17 00:00:00 2001 From: Semyon Uchvatov Date: Wed, 25 Dec 2024 16:01:31 +0300 Subject: [PATCH] docs(vrl): Add parse_cbor vrl function documentation --- .github/actions/spelling/expect.txt | 2 +- .../reference/remap/functions/parse_cbor.cue | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 website/cue/reference/remap/functions/parse_cbor.cue diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index cc9bee24deda4..9d41723fefc79 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -78,7 +78,7 @@ bytesize califrag califragilistic CAROOT -CBOR +cbor cddl cdylib cef diff --git a/website/cue/reference/remap/functions/parse_cbor.cue b/website/cue/reference/remap/functions/parse_cbor.cue new file mode 100644 index 0000000000000..cf1ce159e5bc9 --- /dev/null +++ b/website/cue/reference/remap/functions/parse_cbor.cue @@ -0,0 +1,36 @@ +package metadata + +remap: functions: parse_json: { + category: "Parse" + description: """ + Parses the `value` as CBOR. + """ + notices: [ + """ + Only CBOR types are returned. + """, + ] + + arguments: [ + { + name: "value" + description: "The CBOR payload to parse." + required: true + type: ["string"] + }, + ] + internal_failure_reasons: [ + "`value` is not a valid CBOR-formatted payload.", + ] + return: types: ["boolean", "integer", "float", "string", "object", "array", "null"] + + examples: [ + { + title: "Parse CBOR" + source: #""" + parse_cbor!(decode_base64!("oWVmaWVsZGV2YWx1ZQ==")) + """# + return: field: "value" + }, + ] +}