MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / normalizeCollectionNodeStyles

Function normalizeCollectionNodeStyles

internal/config/config.go:1921–1943  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1919// lists and maps readable. Empty sequences retain flow style ([]) so empty list markers
1920// remain compact.
1921func 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
1945func removeLegacyOpenAICompatAPIKeys(root *yaml.Node) {
1946 if root == nil || root.Kind != yaml.MappingNode {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected