normalizeCollectionNodeStyles forces YAML collections to use block notation, keeping lists and maps readable. Empty sequences retain flow style ([]) so empty list markers remain compact.
(node *yaml.Node)
| 1919 | // lists and maps readable. Empty sequences retain flow style ([]) so empty list markers |
| 1920 | // remain compact. |
| 1921 | func normalizeCollectionNodeStyles(node *yaml.Node) { |
| 1922 | if node == nil { |
| 1923 | return |
| 1924 | } |
| 1925 | switch node.Kind { |
| 1926 | case yaml.MappingNode: |
| 1927 | node.Style = 0 |
| 1928 | for i := range node.Content { |
| 1929 | normalizeCollectionNodeStyles(node.Content[i]) |
| 1930 | } |
| 1931 | case yaml.SequenceNode: |
| 1932 | if len(node.Content) == 0 { |
| 1933 | node.Style = yaml.FlowStyle |
| 1934 | } else { |
| 1935 | node.Style = 0 |
| 1936 | } |
| 1937 | for i := range node.Content { |
| 1938 | normalizeCollectionNodeStyles(node.Content[i]) |
| 1939 | } |
| 1940 | default: |
| 1941 | // Scalars keep their existing style to preserve quoting |
| 1942 | } |
| 1943 | } |
| 1944 | |
| 1945 | func removeLegacyOpenAICompatAPIKeys(root *yaml.Node) { |
| 1946 | if root == nil || root.Kind != yaml.MappingNode { |
no outgoing calls
no test coverage detected