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:
2026-08-29 21:27:42 +02:00
parent 798bb47e71
commit f259df1258
22 changed files with 2886 additions and 9 deletions
+23
View File
@@ -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"