MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / SortedMapKeys

Function SortedMapKeys

pkg/codegen/utils.go:349–356  ·  view source on GitHub ↗

SortedMapKeys takes a map with keys of type string and returns a slice of those keys sorted lexicographically.

(m map[string]T)

Source from the content-addressed store, hash-verified

347// SortedMapKeys takes a map with keys of type string and returns a slice of those
348// keys sorted lexicographically.
349func SortedMapKeys[T any](m map[string]T) []string {
350 keys := make([]string, 0, len(m))
351 for k := range m {
352 keys = append(keys, k)
353 }
354 slices.Sort(keys)
355 return keys
356}
357
358// SortedSchemaKeys returns the keys of the given SchemaRef dictionary in sorted
359// order, since Golang scrambles dictionary keys. This isn't a generic key sort, because

Calls

no outgoing calls

Tested by

no test coverage detected