github.com/weaviate/weaviate@v1.24.6/entities/modulecapabilities/config.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package modulecapabilities 13 14 import ( 15 "context" 16 17 "github.com/weaviate/weaviate/entities/models" 18 "github.com/weaviate/weaviate/entities/moduletools" 19 "github.com/weaviate/weaviate/entities/schema" 20 ) 21 22 // ClassConfigurator is an optional capability interface which a module MAY 23 // implement. If it is implemented, all methods will be called when the user 24 // adds or updates a class which has the module set as the vectorizer 25 type ClassConfigurator interface { 26 // ClassDefaults provides the defaults for a per-class module config. The 27 // module provider will merge the props into the user-specified config with 28 // the user-provided values taking precedence 29 ClassConfigDefaults() map[string]interface{} 30 31 // PropertyConfigDefaults provides the defaults for a per-property module 32 // config. The module provider will merge the props into the user-specified 33 // config with the user-provided values taking precedence. The property's 34 // dataType MAY be taken into consideration when deciding defaults. 35 // dataType is not guaranteed to be non-nil, it might be nil in the case a 36 // user specified an invalid dataType, as some validation only occurs after 37 // defaults are set. 38 PropertyConfigDefaults(dataType *schema.DataType) map[string]interface{} 39 40 // ValidateClass MAY validate anything about the class, except the config of 41 // another module. The specified ClassConfig can be used to easily retrieve 42 // the config specific for the module. For example, a module could iterate 43 // over class.Properties and call classConfig.Property(prop.Name) to validate 44 // the per-property config. A module MUST NOT extract another module's config 45 // from class.ModuleConfig["other-modules-name"]. 46 ValidateClass(ctx context.Context, class *models.Class, 47 classConfig moduletools.ClassConfig) error 48 }