Skip to content

Commit

Permalink
docs(vrl): add docs for new validate flag in punycode functions (#19923)
Browse files Browse the repository at this point in the history
* docs(vrl): add docs for new validate flag in punycode functions

Related: vectordotdev/vrl#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 <jesse.szwedko@datadoghq.com>
  • Loading branch information
3 people authored Mar 11, 2024
1 parent 7c596b4 commit 6d09613
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: "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`",
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 6d09613

Please sign in to comment.