@platformatic/sql-json-schema-mapper 3.54.0 → 3.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +21 -1
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -58,6 +58,26 @@ export function mapSQLTypeToOpenAPIType (sqlType) {
58
58
  }
59
59
  }
60
60
 
61
+ function mapSQLTypeToOpenAPISchema (field) {
62
+ if (field.sqlType === 'vector') {
63
+ const schema = {
64
+ type: 'array',
65
+ items: {
66
+ type: 'number'
67
+ }
68
+ }
69
+
70
+ if (field.vectorDimensions) {
71
+ schema.minItems = field.vectorDimensions
72
+ schema.maxItems = field.vectorDimensions
73
+ }
74
+
75
+ return schema
76
+ }
77
+
78
+ return { type: mapSQLTypeToOpenAPIType(field.sqlType) }
79
+ }
80
+
61
81
  export function mapSQLEntityToJSONSchema (entity, ignore = {}, noRequired = false) {
62
82
  const fields = entity.camelCasedFields
63
83
  const properties = {}
@@ -83,7 +103,7 @@ export function mapSQLEntityToJSONSchema (entity, ignore = {}, noRequired = fals
83
103
  additionalProperties: true
84
104
  }
85
105
  } else {
86
- properties[field.camelcase] = { type }
106
+ properties[field.camelcase] = mapSQLTypeToOpenAPISchema(field)
87
107
  }
88
108
  if (field.isNullable || noRequired || field.autoTimestamp) {
89
109
  properties[field.camelcase].nullable = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/sql-json-schema-mapper",
3
- "version": "3.54.0",
3
+ "version": "3.56.0",
4
4
  "description": "Map SQL entity to JSON schema",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "neostandard": "^0.12.0",
23
23
  "typescript": "^5.5.4",
24
24
  "why-is-node-running": "^2.2.2",
25
- "@platformatic/sql-mapper": "3.54.0"
25
+ "@platformatic/sql-mapper": "3.56.0"
26
26
  },
27
27
  "dependencies": {
28
28
  "code-block-writer": "^13.0.1",