admin管理员组文章数量:1122846
I use ballerina to process composer.json files. such files have repositories entries like this:
"repositories": [
{
"type": "vcs",
"url": ".git"
},
{
"type": "vcs",
"url": ".git"
},
...
]
When such a json map is loaded in my ballerina script, the "type" field cannot be manipulated as other filed,
for example: this compiles:
string url = check theRepo.url.ensureType();
but this does not:
string type = check theRepo.type.ensureType();
the error is:
ERROR [dev_it.bal:(114:12,114:16)] invalid token 'type'
ERROR [dev_it.bal:(114:17,114:17)] missing identifier
ERROR [dev_it.bal:(114:33,114:33)] missing identifier
ERROR [dev_it.bal:(114:33,114:33)] missing semicolon token
ERROR [dev_it.bal:(114:33,114:37)] type definitions are allowed only at module level
ERROR [dev_it.bal:(114:37,114:38)] invalid token '.'
and my ballerina version is:
$bal --version
Ballerina 2201.10.3 (Swan Lake Update 10)
Language specification 2024R1
Update Tool 1.4.3
... I worked around it with this:
theRepo["url"];
theRepo["type"];
本文标签: Ballerina does not support quottypequot field in a json mapStack Overflow
版权声明:本文标题:Ballerina does not support "type" field in a json map - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282138a1926546.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论