首页 > 解决方案 > YAML 中的索引数组是什么?

问题描述

在我的 yaml spring-boot 应用程序配置中,我有

additional-properties[auto.register.schemas]: false
additional-properties[use.latest.version]: true

它有效!我在 YAML 规范中没有找到这种语法。这是什么意思?如何使用标准 YAML 重写它?这是一样的吗

additional-properties:
    - auto.register.schemas: false
    - use.latest.version: true

?

标签: yaml

解决方案


AFAIK:每个元素(由点分隔)都必须在自己的行上并相应地标记。

foo:
   bar:
       name: value
       name2: value2
   fez: value

所以你的例子是:

additional-properties:
    auto:
       register:
           schemas: false

推荐阅读