YAMLException: bad indentation of a mapping entry

Viewed 5719

In the OpenAPI definition below, the parameter LayoutId causes the parser error "bad indentation of a mapping entry".

Yaml File:

---
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
---

I have spent almost an hour to solve this and am not able to find what is wrong.

1 Answers

You can't create an object like that. If you want to create an object named name you should use it like this:

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

Otherwise, If you don't want to create an object named name, you need to keep the name field and the other fields in the same line.

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