@webtypen/webframez-core 0.2.38 → 0.2.39

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.
@@ -137,12 +137,17 @@ class DataBuilder {
137
137
  }
138
138
  }
139
139
  if (typeof fields[key].schema === "object") {
140
- if (value && value.length > 0) {
141
- for (let i in value) {
142
- const entryPath = fieldPath + "[" + i + "]";
143
- errors = yield this.validateFields(db, type, fields[key].schema, req.body.data, errors, entryPath);
140
+ if (fields[key].type === "array") {
141
+ if (value && value.length > 0) {
142
+ for (let i in value) {
143
+ const entryPath = fieldPath + "[" + i + "]";
144
+ errors = yield this.validateFields(db, type, fields[key].schema, req, errors, entryPath);
145
+ }
144
146
  }
145
147
  }
148
+ else if (fields[key].type === "object") {
149
+ errors = yield this.validateFields(db, type, fields[key].schema, req, errors, fieldPath);
150
+ }
146
151
  }
147
152
  if (fields[key].validation && fields[key].validation.trim() !== "") {
148
153
  // @ToDo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -183,11 +183,15 @@ export class DataBuilder {
183
183
  }
184
184
 
185
185
  if (typeof fields[key].schema === "object") {
186
- if (value && value.length > 0) {
187
- for (let i in value) {
188
- const entryPath = fieldPath + "[" + i + "]";
189
- errors = await this.validateFields(db, type, fields[key].schema, req.body.data, errors, entryPath);
186
+ if (fields[key].type === "array") {
187
+ if (value && value.length > 0) {
188
+ for (let i in value) {
189
+ const entryPath = fieldPath + "[" + i + "]";
190
+ errors = await this.validateFields(db, type, fields[key].schema, req, errors, entryPath);
191
+ }
190
192
  }
193
+ } else if (fields[key].type === "object") {
194
+ errors = await this.validateFields(db, type, fields[key].schema, req, errors, fieldPath);
191
195
  }
192
196
  }
193
197