From 949b71cfd8bf7466465e9eecea71b6bd7faeb94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Mon, 11 Mar 2024 17:55:07 +0100 Subject: [PATCH] docs(vrl): add docs for new validate flag in punycode functions (#19923) * docs(vrl): add docs for new validate flag in punycode functions Related: https://github.com/vectordotdev/vrl/pull/709 * Update validate flag description Co-authored-by: Brett Blue <84536271+brett0000FF@users.noreply.github.com> --------- Co-authored-by: Brett Blue <84536271+brett0000FF@users.noreply.github.com> Co-authored-by: Jesse Szwedko --- .../reference/remap/functions/decode_punycode.cue | 14 ++++++++++++++ .../reference/remap/functions/encode_punycode.cue | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/website/cue/reference/remap/functions/decode_punycode.cue b/website/cue/reference/remap/functions/decode_punycode.cue index b2d2dde433e86..0f0734e233e6e 100644 --- a/website/cue/reference/remap/functions/decode_punycode.cue +++ b/website/cue/reference/remap/functions/decode_punycode.cue @@ -13,6 +13,13 @@ remap: functions: decode_punycode: { required: true type: ["string"] }, + { + name: "validate" + description: "If enabled, checks if the input string is a valid domain name." + required: false + type: ["boolean"] + default: true + }, ] internal_failure_reasons: [ "`value` is not valid `punycode`", @@ -34,5 +41,12 @@ remap: functions: decode_punycode: { """ return: "www.cafe.com" }, + { + title: "Ignore validation" + source: """ + decode_punycode!("xn--8hbb.xn--fiba.xn--8hbf.xn--eib.", validate: false) + """ + return: "١٠.٦٦.٣٠.٥." + }, ] } diff --git a/website/cue/reference/remap/functions/encode_punycode.cue b/website/cue/reference/remap/functions/encode_punycode.cue index 13e5415f99638..5ca6df5f0a2ba 100644 --- a/website/cue/reference/remap/functions/encode_punycode.cue +++ b/website/cue/reference/remap/functions/encode_punycode.cue @@ -13,6 +13,13 @@ remap: functions: encode_punycode: { required: true type: ["string"] }, + { + name: "validate" + description: "Whether to validate the input string to check if it is a valid domain name." + required: false + type: ["boolean"] + default: true + }, ] internal_failure_reasons: [ "`value` can not be encoded to `punycode`", @@ -41,5 +48,12 @@ remap: functions: encode_punycode: { """ return: "www.cafe.com" }, + { + title: "Ignore validation" + source: """ + encode_punycode!("xn--8hbb.xn--fiba.xn--8hbf.xn--eib.", validate: false) + """ + return: "xn--8hbb.xn--fiba.xn--8hbf.xn--eib." + }, ] }