mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-08-30 21:12:35 +00:00
feat(spectypes): add support for PostGIS and pgvector types
* Implement custom types: SqlGeometry, SqlGeography, SqlHalfVector, SqlSparseVector, SqlBitVector * Add spatial filter operators and vector similarity operators * Include metadata and OpenAPI reporting for geometry/vector column types * Create tests for EWKB and WKT conversions
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/bitechdev/ResolveSpec/pkg/modelregistry"
|
||||
"github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
)
|
||||
|
||||
// OpenAPISpec represents the OpenAPI 3.0 specification structure
|
||||
@@ -440,6 +441,28 @@ func (g *Generator) generatePropertySchema(field reflect.StructField) *Schema {
|
||||
schema.Description = desc
|
||||
}
|
||||
|
||||
// spectypes PostGIS / pgvector wrappers get dedicated schemas.
|
||||
if n, ok := spectypes.SQLTypeName(field.Type); ok {
|
||||
switch n {
|
||||
case "geometry", "geography":
|
||||
schema.Type = "object"
|
||||
schema.Format = "geojson"
|
||||
return schema
|
||||
case "vector", "halfvec":
|
||||
schema.Type = "array"
|
||||
schema.Items = &Schema{Type: "number"}
|
||||
schema.Format = "vector"
|
||||
return schema
|
||||
case "sparsevec":
|
||||
schema.Type = "object"
|
||||
schema.Format = "sparsevec"
|
||||
return schema
|
||||
case "bit":
|
||||
schema.Type = "string"
|
||||
return schema
|
||||
}
|
||||
}
|
||||
|
||||
switch fieldType.Kind() {
|
||||
case reflect.String:
|
||||
schema.Type = "string"
|
||||
|
||||
Reference in New Issue
Block a user