@ditojs/server 2.78.0 → 2.79.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.
- package/package.json +6 -6
- package/src/schema/schema.js +20 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.79.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dito.js Server – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
|
|
6
6
|
"repository": "https://github.com/ditojs/dito/tree/master/packages/server",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"node >= 18"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ditojs/admin": "^2.
|
|
30
|
-
"@ditojs/build": "^2.
|
|
31
|
-
"@ditojs/router": "^2.
|
|
32
|
-
"@ditojs/utils": "^2.
|
|
29
|
+
"@ditojs/admin": "^2.79.0",
|
|
30
|
+
"@ditojs/build": "^2.79.0",
|
|
31
|
+
"@ditojs/router": "^2.79.0",
|
|
32
|
+
"@ditojs/utils": "^2.79.0",
|
|
33
33
|
"@koa/cors": "^5.0.0",
|
|
34
34
|
"@koa/etag": "^5.0.2",
|
|
35
35
|
"@koa/multer": "^4.0.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"objection": "^3.1.5",
|
|
91
91
|
"typescript": "^5.9.3"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "f87ce5ce121a30830776774cd447014afef5b8ec"
|
|
94
94
|
}
|
package/src/schema/schema.js
CHANGED
|
@@ -29,7 +29,11 @@ export function convertSchema(
|
|
|
29
29
|
mergeDefinitions(parentEntry.definitions, definitions)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
// When the schema is null, a circular reference is being processed.
|
|
33
|
+
// Break the chain by cloning the original schema and converting it again:
|
|
34
|
+
return schema === null
|
|
35
|
+
? convertSchema({ ...original }, options, parentEntry)
|
|
36
|
+
: schema
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
const entry = {
|
|
@@ -103,26 +107,27 @@ export function convertSchema(
|
|
|
103
107
|
// TODO: Consider moving to `model` keyword instead that would support
|
|
104
108
|
// model validation and still could be combined with other keywords.
|
|
105
109
|
schema.$ref = type
|
|
106
|
-
// `$ref` doesn't play with `nullable`, so convert to `oneOf`
|
|
107
|
-
if (schema.nullable) {
|
|
108
|
-
delete schema.nullable
|
|
109
|
-
schema = {
|
|
110
|
-
oneOf: [
|
|
111
|
-
{ type: 'null' },
|
|
112
|
-
schema
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
110
|
}
|
|
117
111
|
}
|
|
118
112
|
}
|
|
119
113
|
if (excludeDefaults[schema.default]) {
|
|
120
114
|
delete schema.default
|
|
121
115
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
if (schema.nullable) {
|
|
117
|
+
if (schema.$ref) {
|
|
118
|
+
// `$ref` doesn't play with `nullable`, so convert to `oneOf`
|
|
119
|
+
delete schema.nullable
|
|
120
|
+
schema = {
|
|
121
|
+
oneOf: [
|
|
122
|
+
{ type: 'null' },
|
|
123
|
+
schema
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
} else if (schema.enum && !schema.enum.includes(null)) {
|
|
127
|
+
// Make nullable work with enum, see the issue for more details:
|
|
128
|
+
// https://github.com/ajv-validator/ajv/issues/1471
|
|
129
|
+
schema.enum.push(null)
|
|
130
|
+
}
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
// Convert properties last. This is needed for circular references
|