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..a900b48c3cf29 --- /dev/null +++ b/website/cue/reference/remap/functions/parse_cbor.cue @@ -0,0 +1,36 @@ +package metadata + +remap: functions: parse_cbor: { + category: "Parse" + description: """ + Parses the `value` as [CBOR](\(urls.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" + }, + ] +} diff --git a/website/cue/reference/urls.cue b/website/cue/reference/urls.cue index 3c846432eec6a..6431076a20a87 100644 --- a/website/cue/reference/urls.cue +++ b/website/cue/reference/urls.cue @@ -105,6 +105,7 @@ urls: { bind_dnstap: "https://kb.isc.org/docs/aa-01342" b_tree_map: "https://doc.rust-lang.org/std/collections/struct.BTreeMap.html" cargo_audit: "\(github)/RustSec/cargo-audit" + cbor: "https://cbor.io" centos: "https://www.centos.org/" chrono_time_formats: "https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers" cgroups_limit_resources: "https://the.binbashtheory.com/control-resources-cgroups/"