【问题标题】:YAMLException: bad indentation of a mapping entryYAMLException:映射条目的缩进错误
【发布时间】:2021-03-15 08:47:49
【问题描述】:

在下面的 OpenAPI 定义中,参数 LayoutId 导致解析器错误“bad indentation of a mapping entry”。

Yaml 文件:

---
name: 1x1+1x1_1x1  
  LayoutId: 3A1B6753-4F92-4DCD-A1E3-6462374EC897
  LayoutType: ControlRoomGrid
  ConfiguredSegments:
    SegmentConfiguration:
      Height: 50
      Id: None
      Left: 0
      SerializationId: true
      Top: 0
      Width: 50
      Index: 0
    SegmentConfiguration:
      Height: 50
      Id: None
      Left: 0
      SerializationId: true
      Top: 50
      Width: 50
      Index: 0
    SegmentConfiguration:
      Height: 100
      Id: None
      Left: 50
      SerializationId: true
      Top: 0
      Width: 50
      Index: 0
  IntendedResolution:
    Height:
      100
    Width:
      100
  PlaneType: A
---

我已经花了将近一个小时来解决这个问题,但无法找到问题所在。

【问题讨论】:

    标签: node.js yaml


    【解决方案1】:

    你不能创建这样的对象。如果你想创建一个名为name 的对象,你应该像这样使用它:

    name:  
      LayoutId: 3A1B6753-4F92-4DCD-A1E3-6462374EC897
      LayoutType: ControlRoomGrid
      ConfiguredSegments:
        ...
    

    否则,如果您不想创建名为name 的对象,则需要将name 字段和其他字段保持在同一行中。

    name: 1x1+1x1_1x1  
    LayoutId: 3A1B6753-4F92-4DCD-A1E3-6462374EC897
    LayoutType: ControlRoomGrid
    ConfiguredSegments:
      ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 2019-04-08
      • 2017-06-14
      相关资源
      最近更新 更多