svelte-reflector 1.3.10 → 1.3.11

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.
@@ -66,12 +66,16 @@ export class ArrayProp {
66
66
  return `${this.name}${required}: ${sanitizedType}[]${nullable}`;
67
67
  }
68
68
  bundleBuild() {
69
- const result = () => {
70
- if (this._isPrimitiveType || this.isEnum)
71
- return "";
72
- return ".map((obj) => obj.bundle())";
73
- };
74
- return `${this.name}: this.${this.name}${result()}`;
69
+ if (this._isPrimitiveType || this.isEnum) {
70
+ return `${this.name}: this.${this.name}`;
71
+ }
72
+ if (this.isNullable) {
73
+ return `${this.name}: this.${this.name} == null ? this.${this.name} : this.${this.name}.map((obj) => obj.bundle())`;
74
+ }
75
+ if (!this.isRequired) {
76
+ return `${this.name}: this.${this.name}?.map((obj) => obj.bundle())`;
77
+ }
78
+ return `${this.name}: this.${this.name}.map((obj) => obj.bundle())`;
75
79
  }
76
80
  queryBundleBuild() {
77
81
  return `${this.name}: this.${this.name}?.values`;
@@ -95,7 +95,9 @@ export class PrimitiveProp {
95
95
  };
96
96
  const buildedExample = this.customType
97
97
  ? `${this.example}`
98
- : `params?.empty || isEmpty ? ${this.fallbackExample} : ${this.example}`;
98
+ : this.rawType === "boolean" && this.fallbackExample === false && this.example === true
99
+ ? `!(params?.empty || isEmpty)`
100
+ : `params?.empty || isEmpty ? ${this.fallbackExample} : ${this.example}`;
99
101
  const effectivelyNullable = this.isEffectivelyNullable;
100
102
  const keyExpr = effectivelyNullable ? `params?.data?.${name} ?? null` : `params?.data?.${name}`;
101
103
  let typeParam = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-reflector",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "description": "Reflects zod types from openAPI schemas",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",