Skip to content

Ensure that YAML marshalling maintains field ordering #235

Closed
@elezar

Description

@elezar

When outputing the following spec as YAML:

cdi.Spec{
	Version: "v0.3.0",
	Kind:    "example.com/class",
	ContainerEdits: cdi.ContainerEdits{
	DeviceNodes: []*cdi.DeviceNode{
		{
			Path: "/dev/foo",
		},
	},
}

We get the following output:

---
cdiVersion: v0.3.0
containerEdits:
  deviceNodes:
  - path: /dev/foo
devices: null
kind: example.com/class

Which does not maintain ordering of the fields as defines in the spec.

The JSON output is as follows:

{"cdiVersion":"v0.3.0","kind":"example.com/class","devices":null,"containerEdits":{"deviceNodes":[{"path":"/dev/foo"}]}}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions