Skip to content

Commit

Permalink
docs(vrl): add docs for new validate flag in punycode functions
Browse files Browse the repository at this point in the history
  • Loading branch information
esensar committed Feb 21, 2024
1 parent 1470f1a commit 0970d9b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions website/cue/reference/remap/functions/decode_punycode.cue
Original file line number Diff line number Diff line change
Expand Up @@ -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`",
Expand All @@ -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: "١٠.٦٦.٣٠.٥."
},
]
}
14 changes: 14 additions & 0 deletions website/cue/reference/remap/functions/encode_punycode.cue
Original file line number Diff line number Diff line change
Expand Up @@ -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`",
Expand Down Expand Up @@ -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."
},
]
}

0 comments on commit 0970d9b

Please sign in to comment.