End NewSchemaLoader LoadSchema loads a schema based on its type
(input string)
| 36 | } // End NewSchemaLoader |
| 37 | // LoadSchema loads a schema based on its type |
| 38 | func (s *Loader) LoadSchema(input string) (string, error) { |
| 39 | schemaType, err := determineSchemaType(input) |
| 40 | if err != nil { |
| 41 | return "", fmt.Errorf("error determining schema type: %w", err) |
| 42 | } |
| 43 | loaderFunc, exists := s.loaders[schemaType] // Get loader function |
| 44 | if !exists { |
| 45 | return "", fmt.Errorf("loader function not found for schema type: %v", schemaType) |
| 46 | } |
| 47 | return loaderFunc(input) // Execute loader |
| 48 | } // End LoadSchema |
| 49 | // determineSchemaType determines the type of schema based on the input string |
| 50 | func determineSchemaType(input string) (Type, error) { |
| 51 | if isURL(input) { // Check URL first |
no test coverage detected