MCPcopy Create free account
hub / github.com/Permify/permify / LoadSchema

Method LoadSchema

pkg/schema/loader.go:38–48  ·  view source on GitHub ↗

End NewSchemaLoader LoadSchema loads a schema based on its type

(input string)

Source from the content-addressed store, hash-verified

36} // End NewSchemaLoader
37// LoadSchema loads a schema based on its type
38func (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
50func determineSchemaType(input string) (Type, error) {
51 if isURL(input) { // Check URL first

Callers 3

coverageFunction · 0.80
validateFunction · 0.80
loader_test.goFile · 0.80

Calls 1

determineSchemaTypeFunction · 0.85

Tested by

no test coverage detected