MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / generateSchema

Function generateSchema

cmd/generateschema/main-generateschema.go:123–141  ·  view source on GitHub ↗
(template any, dir string, allowNull bool)

Source from the content-addressed store, hash-verified

121}
122
123func generateSchema(template any, dir string, allowNull bool) error {
124 settingsSchema := jsonschema.Reflect(template)
125 if allowNull {
126 allowNullValues(settingsSchema)
127 }
128
129 jsonSettingsSchema, err := json.MarshalIndent(settingsSchema, "", " ")
130 if err != nil {
131 return fmt.Errorf("failed to parse local schema: %w", err)
132 }
133 written, err := utilfn.WriteFileIfDifferent(dir, jsonSettingsSchema)
134 if !written {
135 fmt.Fprintf(os.Stderr, "no changes to %s\n", dir)
136 }
137 if err != nil {
138 return fmt.Errorf("failed to write local schema: %w", err)
139 }
140 return nil
141}
142
143func generateWidgetsSchema(dir string) error {
144 metaT := reflect.TypeOf(waveobj.MetaMapType(nil))

Callers 1

mainFunction · 0.85

Calls 2

WriteFileIfDifferentFunction · 0.92
allowNullValuesFunction · 0.85

Tested by

no test coverage detected