MCPcopy Create free account
hub / github.com/cloudwan/gohan / OrderedLoadSchemasFromFiles

Method OrderedLoadSchemasFromFiles

schema/manager.go:307–326  ·  view source on GitHub ↗

OrderedLoadSchemasFromFiles calls LoadSchemaFromFile for each file in right order - first abstract then parent and rest on the end

(filePaths []string)

Source from the content-addressed store, hash-verified

305
306//OrderedLoadSchemasFromFiles calls LoadSchemaFromFile for each file in right order - first abstract then parent and rest on the end
307func (manager *Manager) OrderedLoadSchemasFromFiles(filePaths []string) error {
308 MaxDepth := 8 // maximum number of nested schemas
309 for i := MaxDepth; i > 0 && len(filePaths) > 0; i-- {
310 rest := make([]string, 0)
311 for _, filePath := range filePaths {
312 if filePath == "" {
313 continue
314 }
315 err := manager.LoadSchemaFromFile(filePath)
316 if err != nil && err.Error() != "data isn't map" {
317 if i == 1 {
318 return err
319 }
320 rest = append(rest, filePath)
321 }
322 }
323 filePaths = rest
324 }
325 return nil
326}
327
328//LoadSchemasFromFiles calls LoadSchemaFromFile for each of provided filePaths
329func (manager *Manager) LoadSchemasFromFiles(filePaths ...string) error {

Callers 1

getInitDbCommandFunction · 0.80

Calls 2

LoadSchemaFromFileMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected