INNER CODE UNIT · Go

Lookup

kubecolor/kubecolor · internal/cmd/configschema/main.go:157

func Lookup(t reflect.Type) jsonschema.ID {
	switch t.Name() {
	case "Color", "Slice", "Preset", "Paging", "Duration", "DurationSlice":
		return jsonschema.ID("#/$defs/" + Namer(t.Name()))
	default:
		return ""
	}
}

// Namer allows customizing of type names.
func Namer(s string) string {
	switch s {
	case "GUID":
		return "guid"
	case "Slice":
		return "colorSlice"
	}
	var sb strings.Builder

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…