NodeJS YAMLException:Map项的缩进错误

n1bvdmb6  于 2023-04-29  发布在  Node.js
关注(0)|答案(2)|浏览(123)

在下面的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
---

我已经花了差不多一个小时来解决这个问题,并不能找到什么是错误的。

ljsrvy3e

ljsrvy3e1#

你不能创建这样的对象。如果你想创建一个名为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:
  ...
ffscu2ro

ffscu2ro2#

ul{
width: 300px;
height: 80px;
background: #F6F1E9;
}
li{
margin-top: 10px;
}
<p>It's a broken yarn.lock file issue. To solve this issue:</p>
<ul>
<li>Delete yarn.lock file</li>
<li>Run 'yarn install'</li>
<li>Run 'yarn start'</li>
</ul>

<p>Also, ensure that you have a stable internet connection</p>

相关问题