andreachild commented on code in PR #3238: URL: https://github.com/apache/tinkerpop/pull/3238#discussion_r2421531724
########## gremlin-mcp/src/main/javascript/src/gremlin/models/graph-schema.ts: ########## @@ -0,0 +1,163 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @fileoverview Graph schema models for Gremlin database structure definition. + */ + +import { z } from 'zod'; + +/** + * Property definition for graph elements (vertices and edges). + */ +export const PropertySchema = z.object({ + /** The name of the property */ + name: z.string(), + /** The data type(s) of the property */ + type: z.array(z.string()), + /** A list of sample values for the property (optional for schema size optimization) */ + sample_values: z.array(z.unknown()).optional(), + /** Cardinality information (single, list, set) */ + cardinality: z.string().optional(), + /** A list of all possible values, if the property is determined to be an enum */ + enum: z.array(z.unknown()).optional(), +}); + +export type Property = z.infer<typeof PropertySchema>; + +/** + * Vertex type in the graph schema. + */ +export const VertexSchema = z.object({ + /** The label(s) that categorize this vertex type */ + labels: z.string(), + /** List of properties that can be assigned to this vertex type */ + properties: z.array(PropertySchema).default([]), + /** Count of vertices with this label */ + count: z.number().optional(), +}); + +export type Vertex = z.infer<typeof VertexSchema>; + +/** + * Relationship type in the graph schema. + */ +export const EdgeSchema = z.object({ + /** The type/category of the edge */ + type: z.string(), Review Comment: Should this be `label`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
