From 0970d9b24119cfd273bcd0dec98a36bf291a082f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Wed, 21 Feb 2024 14:53:25 +0100 Subject: [PATCH] docs(vrl): add docs for new validate flag in punycode functions Related: https://github.com/vectordotdev/vrl/pull/709 --- .../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..2afb3e8625091 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: "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` 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." + }, ] }