nicot 1.1.34 → 1.1.35
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/dist/index.cjs +25 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +25 -1
- package/dist/index.mjs.map +3 -3
- package/dist/src/utility/metadata.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -257,7 +257,8 @@ var ParseBoolObjectPipe = class {
|
|
|
257
257
|
|
|
258
258
|
// src/decorators/property.ts
|
|
259
259
|
function swaggerDecorator(options, injected = {}) {
|
|
260
|
-
|
|
260
|
+
const notRequiredButHasDefault = options.required == null && options.default != null;
|
|
261
|
+
const apiPropertyDec = ApiProperty2({
|
|
261
262
|
default: options.default,
|
|
262
263
|
required: !!(options.required && options.default == null),
|
|
263
264
|
example: options.default,
|
|
@@ -265,6 +266,18 @@ function swaggerDecorator(options, injected = {}) {
|
|
|
265
266
|
...injected,
|
|
266
267
|
...options.propertyExtras || {}
|
|
267
268
|
});
|
|
269
|
+
if (notRequiredButHasDefault) {
|
|
270
|
+
return MergePropertyDecorators2([
|
|
271
|
+
apiPropertyDec,
|
|
272
|
+
Metadata.set(
|
|
273
|
+
"notRequiredButHasDefault",
|
|
274
|
+
true,
|
|
275
|
+
"notRequiredButHasDefaultFields"
|
|
276
|
+
)
|
|
277
|
+
]);
|
|
278
|
+
} else {
|
|
279
|
+
return apiPropertyDec;
|
|
280
|
+
}
|
|
268
281
|
}
|
|
269
282
|
function validatorDecorator(options) {
|
|
270
283
|
const decs = [];
|
|
@@ -2055,6 +2068,17 @@ var RestfulFactory = class _RestfulFactory {
|
|
|
2055
2068
|
}
|
|
2056
2069
|
}
|
|
2057
2070
|
}
|
|
2071
|
+
const notRequiredButHasDefaultFields = getSpecificFields(
|
|
2072
|
+
this.entityClass,
|
|
2073
|
+
"notRequiredButHasDefault"
|
|
2074
|
+
).filter((f) => !outputFieldsToOmit.has(f));
|
|
2075
|
+
for (const field of notRequiredButHasDefaultFields) {
|
|
2076
|
+
const oldApiProperty = getApiProperty2(resultDto, field);
|
|
2077
|
+
ApiProperty6({
|
|
2078
|
+
...oldApiProperty,
|
|
2079
|
+
required: true
|
|
2080
|
+
})(resultDto.prototype, field);
|
|
2081
|
+
}
|
|
2058
2082
|
const res = RenameClass(
|
|
2059
2083
|
resultDto,
|
|
2060
2084
|
`${this.getEntityClassName()}ResultDto`
|