@@ -158,6 +158,15 @@ pub(crate) fn check_schema(ctx: &mut Ctx) {
158158 Some ( "rename the field" . to_string ( ) ) ,
159159 ) ;
160160 }
161+ if !is_valid_schema_field_type ( & f. field_type ) {
162+ push_schema_err (
163+ ctx,
164+ f. loc . clone ( ) ,
165+ ErrorCode :: E209 ,
166+ format ! ( "invalid type in schema field: `{}`" , f. name) ,
167+ Some ( "use built-in types only (String, U32, etc.)" . to_string ( ) ) ,
168+ ) ;
169+ }
161170 } )
162171 }
163172 ctx. output . edges . push ( edge. clone ( ) . into ( ) ) ;
@@ -173,6 +182,15 @@ pub(crate) fn check_schema(ctx: &mut Ctx) {
173182 Some ( "rename the field" . to_string ( ) ) ,
174183 ) ;
175184 }
185+ if !is_valid_schema_field_type ( & f. field_type ) {
186+ push_schema_err (
187+ ctx,
188+ f. loc . clone ( ) ,
189+ ErrorCode :: E209 ,
190+ format ! ( "invalid type in schema field: `{}`" , f. name) ,
191+ Some ( "use built-in types only (String, U32, etc.)" . to_string ( ) ) ,
192+ ) ;
193+ }
176194 } ) ;
177195 ctx. output . nodes . push ( node. clone ( ) . into ( ) ) ;
178196 }
@@ -187,9 +205,27 @@ pub(crate) fn check_schema(ctx: &mut Ctx) {
187205 Some ( "rename the field" . to_string ( ) ) ,
188206 ) ;
189207 }
208+ if !is_valid_schema_field_type ( & f. field_type ) {
209+ push_schema_err (
210+ ctx,
211+ f. loc . clone ( ) ,
212+ ErrorCode :: E209 ,
213+ format ! ( "invalid type in schema field: `{}`" , f. name) ,
214+ Some ( "use built-in types only (String, U32, etc.)" . to_string ( ) ) ,
215+ ) ;
216+ }
190217 } ) ;
191218 ctx. output . vectors . push ( vector. clone ( ) . into ( ) ) ;
192219 }
193220}
194221
222+ fn is_valid_schema_field_type ( ft : & FieldType ) -> bool {
223+ match ft {
224+ FieldType :: Identifier ( _) => false ,
225+ FieldType :: Object ( _) => false ,
226+ FieldType :: Array ( inner) => is_valid_schema_field_type ( inner) ,
227+ _ => true ,
228+ }
229+ }
230+
195231const RESERVED_FIELD_NAMES : & [ & str ] = & [ "id" , "label" , "to_node" , "from_node" , "data" , "score" ] ;
0 commit comments