Skip to content

Commit

Permalink
docs(vrl): add documentation for punycode encoding functions (#19794)
Browse files Browse the repository at this point in the history
* docs(vrl): add documentation for punycode encoding functions

Related: vectordotdev/vrl#672

* Allow IDN and punycode in spellchecker

* Change IDN allow entry into lowercase

* chore: expose component test utils (#19826)

* chore(deps): Bump VRL to 0.11.0 (#19827)

Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>

* chore(ci): Bump aws-actions/configure-aws-credentials from 4.0.1 to 4.0.2 (#19823)

chore(ci): Bump aws-actions/configure-aws-credentials

Bumps [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](aws-actions/configure-aws-credentials@v4.0.1...v4.0.2)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump the prost group with 1 update (#19830)

Bumps the prost group with 1 update: [prost-reflect](https://github.com/andrewhickman/prost-reflect).


Updates `prost-reflect` from 0.12.0 to 0.13.0
- [Changelog](https://github.com/andrewhickman/prost-reflect/blob/main/CHANGELOG.md)
- [Commits](andrewhickman/prost-reflect@0.12.0...0.13.0)

---
updated-dependencies:
- dependency-name: prost-reflect
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: prost
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update punycode encoding to be fallible in docs

* Add failure reasons for punycode encoding

* Fix typo in decode_punycode docs

* Simplify error descriptions for punycode_encoding

* Fix formatting of punycode_encoding cue files

---------

Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>
Co-authored-by: Pavlos Rontidis <pavlos.rontidis@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Feb 9, 2024
1 parent de628d8 commit 1e83c95
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ htmltest
https
humungus
icecream
idn
ifeq
ifneq
imobile
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/spelling/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,8 @@ user:P@ssw0rd
# Ignore base64 encoded values in Prometheus Pushgateway URL paths
/.+@base64/.+

# Ignore punycode
\bxn--[-0-9a-z]+

# changelog.d fragment authors line
^authors: .*$
38 changes: 38 additions & 0 deletions website/cue/reference/remap/functions/decode_punycode.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package metadata

remap: functions: decode_punycode: {
category: "Codec"
description: """
Decodes a [punycode](\(urls.punycode)) encoded `value`, like an internationalized domain name ([IDN](\(urls.idn))).
"""

arguments: [
{
name: "value"
description: "The string to decode."
required: true
type: ["string"]
},
]
internal_failure_reasons: [
"`value` is not valid `punycode`",
]
return: types: ["string"]

examples: [
{
title: "Decode a punycode encoded internationalized domain name"
source: """
decode_punycode!("www.xn--caf-dma.com")
"""
return: "www.café.com"
},
{
title: "Decode an ASCII only string"
source: """
decode_punycode!("www.cafe.com")
"""
return: "www.cafe.com"
},
]
}
45 changes: 45 additions & 0 deletions website/cue/reference/remap/functions/encode_punycode.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package metadata

remap: functions: encode_punycode: {
category: "Codec"
description: """
Encodes a `value` to [punycode](\(urls.punycode)). Useful for internationalized domain names ([IDN](\(urls.idn))).
"""

arguments: [
{
name: "value"
description: "The string to encode."
required: true
type: ["string"]
},
]
internal_failure_reasons: [
"`value` can not be encoded to `punycode`",
]
return: types: ["string"]

examples: [
{
title: "Encode an internationalized domain name"
source: """
encode_punycode!("www.café.com")
"""
return: "www.xn--caf-dma.com"
},
{
title: "Encode an internationalized domain name with mixed case"
source: """
encode_punycode!("www.CAFé.com")
"""
return: "www.xn--caf-dma.com"
},
{
title: "Encode an ASCII only string"
source: """
encode_punycode!("www.cafe.com")
"""
return: "www.cafe.com"
},
]
}
32 changes: 32 additions & 0 deletions website/cue/reference/remap/functions/parse_url.cue
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,37 @@ remap: functions: parse_url: {
fragment: null
}
},
{
title: "Parse URL with internationalized domain name"
source: #"""
parse_url!("https://www.café.com")
"""#
return: {
scheme: "https"
username: ""
password: ""
host: "www.xn--caf-dma.com"
port: null
path: "/"
query: {}
fragment: null
}
},
{
title: "Parse URL with mixed case internationalized domain name"
source: #"""
parse_url!("https://www.CAFé.com")
"""#
return: {
scheme: "https"
username: ""
password: ""
host: "www.xn--caf-dma.com"
port: null
path: "/"
query: {}
fragment: null
}
},
]
}
2 changes: 2 additions & 0 deletions website/cue/reference/urls.cue
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ urls: {
iana_time_zones: "\(wikipedia)/wiki/List_of_tz_database_time_zones"
ieee_754: "\(wikipedia)/wiki/IEEE_754"
ietf_rfc_6750: "https://tools.ietf.org/html/rfc6750"
idn: "\(wikipedia)/wiki/Internationalized_domain_name"
initd: "https://bash.cyberciti.biz/guide//etc/init.d"
influxdb: "https://www.influxdata.com/products/influxdb-overview/"
influxdb_http_api_v1: "https://docs.influxdata.com/influxdb/latest/tools/api/#write-http-endpoint"
Expand Down Expand Up @@ -423,6 +424,7 @@ urls: {
protobuf: "https://developers.google.com/protocol-buffers"
pulsar: "https://pulsar.apache.org/"
pulsar_protocol: "https://pulsar.apache.org/docs/en/develop-binary-protocol/"
punycode: "\(wikipedia)/wiki/Punycode"
raspbian: "https://www.raspbian.org/"
rdkafka: "\(github)/edenhill/librdkafka"
regex: "\(wikipedia)/wiki/Regular_expression"
Expand Down

0 comments on commit 1e83c95

Please sign in to comment.