ScannerError: mapping values are not allowed here
ScannerError: mapping values are not allowed here
使用 Tavern 并尝试 运行 tavern-ci 针对此 yaml:
test_name: tavern poc
- name: list
request:
url: https://xxx.xxx.xxx.us/api/v3/institutions/
method: GET
response:
status_code: 200
headers:
content-type: application/json
save:
body:
content: content
正在获取
E ScannerError:此处不允许映射值
“/Users/xxx/xxx/xxx/test_poc.tavern.yaml”中的 E,第 3 行,第 9 列
已经尝试了这里介绍的许多解决方案(其中大部分是 'put a space after the colon'),但并不满意。
Yamllint 给出同样的错误...
在您的 YAML 文档的根目录中,您有一个带有键 test_name
的映射,其值为普通标量 tavern ....
的开始。
解析器需要一个键,与第一行的缩进相同,第二行或第一行的普通标量的延续。第二行是空的,所以它在第三行继续相同的期望。它在那里找到一个 -
,它比 test_name
的开头缩进得更多,所以它不是键,而是普通标量的一部分。然后它发现 name
也是从第一行开始的普通标量的一部分,然后是 :
(冒号 + space)。
但是冒号+space 在普通标量中是不允许的,因为这会导致另一个键值对的开头存在潜在的歧义。
不太可能的解决方案是将双引号放在 tavern
之前和 YAML 文档的末尾。
您更有可能包含一个键,以 - name: list
开头的结构就是其值。例如:
test_name: tavern poc
stages:
- name: list
request:
(从您通过谷歌搜索获得的第二个条目开始 "tavern yaml")
使用 Tavern 并尝试 运行 tavern-ci 针对此 yaml:
test_name: tavern poc
- name: list
request:
url: https://xxx.xxx.xxx.us/api/v3/institutions/
method: GET
response:
status_code: 200
headers:
content-type: application/json
save:
body:
content: content
正在获取 E ScannerError:此处不允许映射值 “/Users/xxx/xxx/xxx/test_poc.tavern.yaml”中的 E,第 3 行,第 9 列
已经尝试了这里介绍的许多解决方案(其中大部分是 'put a space after the colon'),但并不满意。
Yamllint 给出同样的错误...
在您的 YAML 文档的根目录中,您有一个带有键 test_name
的映射,其值为普通标量 tavern ....
的开始。
解析器需要一个键,与第一行的缩进相同,第二行或第一行的普通标量的延续。第二行是空的,所以它在第三行继续相同的期望。它在那里找到一个 -
,它比 test_name
的开头缩进得更多,所以它不是键,而是普通标量的一部分。然后它发现 name
也是从第一行开始的普通标量的一部分,然后是 :
(冒号 + space)。
但是冒号+space 在普通标量中是不允许的,因为这会导致另一个键值对的开头存在潜在的歧义。
不太可能的解决方案是将双引号放在 tavern
之前和 YAML 文档的末尾。
您更有可能包含一个键,以 - name: list
开头的结构就是其值。例如:
test_name: tavern poc
stages:
- name: list
request:
(从您通过谷歌搜索获得的第二个条目开始 "tavern yaml")