@tsed/schema 8.44.4 → 8.44.5

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.
@@ -18,7 +18,7 @@ function extractRequiredProps(obj, schema, options) {
18
18
  if (schema.get("properties")) {
19
19
  required = Object.entries(schema.get("properties")).reduce((required, [key, prop]) => {
20
20
  if (prop && prop.$selfRequired !== undefined) {
21
- return prop.$selfRequired ? required.concat(key) : required.filter((k) => k === key);
21
+ return prop.$selfRequired ? required.concat(key) : required.filter((k) => k !== key);
22
22
  }
23
23
  return required;
24
24
  }, required);
@@ -43,6 +43,10 @@ export function requiredMapper(obj, schema, options) {
43
43
  if (required.length) {
44
44
  obj.required = required;
45
45
  }
46
+ else {
47
+ // a required list inherited from a parent class can end up empty
48
+ delete obj.required;
49
+ }
46
50
  return obj;
47
51
  }
48
52
  defineSchemaMapper({ type: "required", transform: requiredMapper });
@@ -106,6 +106,8 @@ export function Optional() {
106
106
  break;
107
107
  case DecoratorTypes.PROP:
108
108
  store.parentSchema.removeRequired(store.propertyName);
109
+ // also drops the property from a required list inherited from a parent class
110
+ store.schema.$selfRequired = false;
109
111
  break;
110
112
  }
111
113
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/schema",
3
- "version": "8.44.4",
3
+ "version": "8.44.5",
4
4
  "description": "JsonSchema module for Ts.ED Framework",
5
5
  "keywords": [
6
6
  "JsonSchema",
@@ -34,7 +34,7 @@
34
34
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
35
35
  },
36
36
  "dependencies": {
37
- "@tsed/openspec": "8.44.4",
37
+ "@tsed/openspec": "8.44.5",
38
38
  "change-case": "^5.4.4",
39
39
  "json-schema": "0.4.0",
40
40
  "picomatch": "4.0.4",
@@ -43,11 +43,11 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@apidevtools/swagger-parser": "10.1.0",
46
- "@tsed/barrels": "8.44.4",
47
- "@tsed/core": "8.44.4",
48
- "@tsed/hooks": "8.44.4",
49
- "@tsed/openspec": "8.44.4",
50
- "@tsed/typescript": "8.44.4",
46
+ "@tsed/barrels": "8.44.5",
47
+ "@tsed/core": "8.44.5",
48
+ "@tsed/hooks": "8.44.5",
49
+ "@tsed/openspec": "8.44.5",
50
+ "@tsed/typescript": "8.44.5",
51
51
  "@types/fs-extra": "11.0.4",
52
52
  "@types/json-schema": "7.0.15",
53
53
  "@types/picomatch": "3.0.2",