@ditojs/server 2.77.1 → 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.
Files changed (2) hide show
  1. package/package.json +10 -10
  2. 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.77.1",
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.77.1",
30
- "@ditojs/build": "^2.77.0",
31
- "@ditojs/router": "^2.77.0",
32
- "@ditojs/utils": "^2.77.0",
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",
@@ -47,7 +47,7 @@
47
47
  "koa-compose": "^4.1.0",
48
48
  "koa-compress": "^5.1.1",
49
49
  "koa-conditional-get": "^3.0.0",
50
- "koa-helmet": "^8.0.3",
50
+ "koa-helmet": "^9.0.0",
51
51
  "koa-mount": "^4.2.0",
52
52
  "koa-passport": "^6.0.0",
53
53
  "koa-response-time": "^2.1.0",
@@ -63,11 +63,11 @@
63
63
  "passthrough-counter": "^1.0.0",
64
64
  "picocolors": "^1.1.1",
65
65
  "picomatch": "^4.0.3",
66
- "pino": "^10.1.0",
66
+ "pino": "^10.3.0",
67
67
  "pino-pretty": "^13.1.3",
68
68
  "pluralize": "^8.0.0",
69
69
  "repl": "^0.1.3",
70
- "type-fest": "^5.3.1",
70
+ "type-fest": "^5.4.1",
71
71
  "uuid": "^13.0.0"
72
72
  },
73
73
  "peerDependencies": {
@@ -85,10 +85,10 @@
85
85
  "@types/koa-session": "^6.4.5",
86
86
  "@types/koa-static": "^4.0.4",
87
87
  "@types/koa__cors": "^5.0.1",
88
- "@types/node": "^25.0.3",
88
+ "@types/node": "^25.0.10",
89
89
  "knex": "^3.1.0",
90
90
  "objection": "^3.1.5",
91
91
  "typescript": "^5.9.3"
92
92
  },
93
- "gitHead": "a8b76adf6fd81c8c43779c281605b7f28c97913c"
93
+ "gitHead": "f87ce5ce121a30830776774cd447014afef5b8ec"
94
94
  }
@@ -29,7 +29,11 @@ export function convertSchema(
29
29
  mergeDefinitions(parentEntry.definitions, definitions)
30
30
  }
31
31
  }
32
- return schema
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
- // Make nullable work with enum, see the issue for more details:
123
- // https://github.com/ajv-validator/ajv/issues/1471
124
- if (schema.nullable && schema.enum && !schema.enum.includes(null)) {
125
- schema.enum.push(null)
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