MCPcopy Index your code
hub / github.com/coder/coder / inferInputType

Function inferInputType

scripts/modeloptionsgen/main.go:244–256  ·  view source on GitHub ↗

inferInputType decides the appropriate frontend input widget for a field based on its schema type and enum values.

(typeName string, enum []string)

Source from the content-addressed store, hash-verified

242// inferInputType decides the appropriate frontend input widget for
243// a field based on its schema type and enum values.
244func inferInputType(typeName string, enum []string) string {
245 if len(enum) > 0 {
246 return "select"
247 }
248 switch typeName {
249 case "boolean":
250 return "select"
251 case "array", "object":
252 return "json"
253 default:
254 return "input"
255 }
256}

Callers 1

extractFieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected