Merge branch 'master' into generic_ast

This commit is contained in:
Mike Farah
2023-05-28 14:22:48 +10:00
12 changed files with 48 additions and 10 deletions
@@ -26,6 +26,24 @@ will output
true
```
## "yes" and "no" are strings
In the yaml 1.2 standard, support for yes/no as booleans was dropped - they are now considered strings. See '10.2.1.2. Boolean' in https://yaml.org/spec/1.2.2/
Given a sample.yml file of:
```yaml
- yes
- no
```
then
```bash
yq '.[] | tag' sample.yml
```
will output
```yaml
!!str
!!str
```
## `and` example
Running
```bash
+1 -1
View File
@@ -25,7 +25,7 @@ See CSV and TSV [documentation](https://mikefarah.gitbook.io/yq/usage/csv-tsv) f
XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields.
Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a string.
Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a utf-8 string and not binary content.
## Encode value as json string
Given a sample.yml file of:
@@ -25,4 +25,4 @@ See CSV and TSV [documentation](https://mikefarah.gitbook.io/yq/usage/csv-tsv) f
XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields.
Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a string.
Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a utf-8 string and not binary content.
+2
View File
@@ -14,6 +14,8 @@ You can load files of the following supported types:
| Plain String | load_str |
| Base64 | load_base64 |
Note that load_base64 only works for base64 encoded utf-8 strings.
## Samples files for tests:
### yaml
+2
View File
@@ -14,6 +14,8 @@ You can load files of the following supported types:
| Plain String | load_str |
| Base64 | load_base64 |
Note that load_base64 only works for base64 encoded utf-8 strings.
## Samples files for tests:
### yaml
+10
View File
@@ -12,6 +12,16 @@ var booleanOperatorScenarios = []expressionScenario{
"D0, P[], (!!bool)::true\n",
},
},
{
description: "\"yes\" and \"no\" are strings",
subdescription: "In the yaml 1.2 standard, support for yes/no as booleans was dropped - they are now considered strings. See '10.2.1.2. Boolean' in https://yaml.org/spec/1.2.2/",
document: `[yes, no]`,
expression: `.[] | tag`,
expected: []string{
"D0, P[0], (!!str)::!!str\n",
"D0, P[1], (!!str)::!!str\n",
},
},
{
skipDoc: true,
document: "b: hi",