我有一个像这样的 Yaml 文件
name: hhh_aaa_bbb
arguments:
- !argument
name: inputsss
description: hhh aaa bbb
required: true
- !argument
name: lll
description: lll
required: true
- !argument
name: ccc
description: ccc
required: true
source:
!!com.abc.bbc.sss
uri: !arg input
但是当我使用 Yaml Lint 验证 yamllint 中的这个 yaml 文件时,它删除了所有的“!”或者 ”!!”用户参数。为什么会发生这种情况?
这是验证后我从 yaml lint 获得的输出
---
arguments:
-
description: "hhh aaa bbb"
name: inputsss
required: true
-
description: lll
name: lll
required: true
-
description: ccc
name: ccc
required: true
name: hhh_aaa_bbb
source:
uri: input
最佳答案
如果您想在不进行转换的情况下验证 YAML 文件,请使用 yamllint (linter,而不是网站 - yamllint.com 不是 linter)。
对于您的具体输入,它将给出:
$ yamllint file.yaml
file.yaml
1:1 warning missing document start "---" (document-start)
1:18 error trailing spaces (trailing-spaces)
4:9 error wrong indentation: expected 6 but found 8 (indentation)
8:9 error wrong indentation: expected 6 but found 8 (indentation)
12:9 error wrong indentation: expected 6 but found 8 (indentation)
17:9 error wrong indentation: expected 4 but found 8 (indentation)
关于YamlLint 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38454142/