github.com/weaviate/weaviate@v1.24.6/adapters/handlers/graphql/test/helper/schema_fixtures.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 helper 13 14 import ( 15 "github.com/weaviate/weaviate/entities/models" 16 "github.com/weaviate/weaviate/entities/schema" 17 "github.com/weaviate/weaviate/usecases/config" 18 ) 19 20 var SimpleSchema = CreateSimpleSchema(config.VectorizerModuleText2VecContextionary) 21 22 func CreateSimpleSchema(vectorizer string) schema.Schema { 23 return schema.Schema{ 24 Objects: &models.Schema{ 25 Classes: []*models.Class{ 26 { 27 Class: "SomeThing", 28 Vectorizer: vectorizer, 29 Properties: []*models.Property{ 30 { 31 Name: "intField", 32 DataType: []string{"int"}, 33 }, 34 }, 35 }, 36 { 37 Class: "CustomVectorClass", 38 Vectorizer: config.VectorizerModuleNone, 39 Properties: []*models.Property{ 40 { 41 Name: "intField", 42 DataType: []string{"int"}, 43 }, 44 }, 45 }, 46 { 47 Vectorizer: vectorizer, 48 Class: "SomeAction", 49 Properties: []*models.Property{ 50 { 51 Name: "intField", 52 DataType: []string{"int"}, 53 }, 54 { 55 Name: "uuidField", 56 DataType: []string{"uuid"}, 57 }, 58 { 59 Name: "uuidArrayField", 60 DataType: []string{"uuid[]"}, 61 }, 62 { 63 Name: "location", 64 DataType: []string{"geoCoordinates"}, 65 }, 66 { 67 Name: "phone", 68 DataType: []string{"phoneNumber"}, 69 }, 70 { 71 Name: "hasAction", 72 DataType: []string{"SomeAction"}, 73 }, 74 { 75 Name: "hasActions", 76 DataType: []string{"SomeAction"}, 77 }, 78 }, 79 }, 80 }, 81 }, 82 } 83 } 84 85 // CarSchema contains a car which has every primitive field and a ref field there is 86 var CarSchema = schema.Schema{ 87 Objects: &models.Schema{ 88 Classes: []*models.Class{ 89 { 90 Class: "Manufacturer", 91 Properties: []*models.Property{ 92 { 93 Name: "name", 94 DataType: schema.DataTypeText.PropString(), 95 Tokenization: models.PropertyTokenizationWhitespace, 96 }, 97 }, 98 }, 99 { 100 Class: "Car", 101 Properties: []*models.Property{ 102 { 103 Name: "horsepower", 104 DataType: []string{"int"}, 105 }, 106 { 107 Name: "weight", 108 DataType: []string{"number"}, 109 }, 110 { 111 Name: "modelName", 112 DataType: schema.DataTypeText.PropString(), 113 Tokenization: models.PropertyTokenizationWhitespace, 114 }, 115 { 116 Name: "madeBy", 117 DataType: []string{"Manufacturer"}, 118 }, 119 { 120 Name: "startOfProduction", 121 DataType: []string{"date"}, 122 }, 123 { 124 Name: "stillInProduction", 125 DataType: []string{"boolean"}, 126 }, 127 }, 128 }, 129 }, 130 }, 131 }