nicot 1.1.34 → 1.1.36
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 +28 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +28 -2
- package/dist/index.mjs.map +3 -3
- package/dist/src/utility/metadata.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -321,8 +321,14 @@ var ParseBoolObjectPipe = class {
|
|
|
321
321
|
};
|
|
322
322
|
|
|
323
323
|
// src/decorators/property.ts
|
|
324
|
+
var NotRequiredButHasDefaultDec = () => Metadata.set(
|
|
325
|
+
"notRequiredButHasDefault",
|
|
326
|
+
true,
|
|
327
|
+
"notRequiredButHasDefaultFields"
|
|
328
|
+
);
|
|
324
329
|
function swaggerDecorator(options, injected = {}) {
|
|
325
|
-
|
|
330
|
+
const notRequiredButHasDefault = options.required == null && options.default != null;
|
|
331
|
+
const apiPropertyDec = (0, import_swagger2.ApiProperty)({
|
|
326
332
|
default: options.default,
|
|
327
333
|
required: !!(options.required && options.default == null),
|
|
328
334
|
example: options.default,
|
|
@@ -330,6 +336,14 @@ function swaggerDecorator(options, injected = {}) {
|
|
|
330
336
|
...injected,
|
|
331
337
|
...options.propertyExtras || {}
|
|
332
338
|
});
|
|
339
|
+
if (notRequiredButHasDefault) {
|
|
340
|
+
return (0, import_nesties3.MergePropertyDecorators)([
|
|
341
|
+
apiPropertyDec,
|
|
342
|
+
NotRequiredButHasDefaultDec()
|
|
343
|
+
]);
|
|
344
|
+
} else {
|
|
345
|
+
return apiPropertyDec;
|
|
346
|
+
}
|
|
333
347
|
}
|
|
334
348
|
function validatorDecorator(options) {
|
|
335
349
|
const decs = [];
|
|
@@ -381,7 +395,8 @@ var UuidColumn = (options = {}) => {
|
|
|
381
395
|
type: String,
|
|
382
396
|
format: "uuid",
|
|
383
397
|
example: "550e8400-e29b-41d4-a716-446655440000"
|
|
384
|
-
})
|
|
398
|
+
}),
|
|
399
|
+
...options.generated ? [NotRequiredButHasDefaultDec()] : []
|
|
385
400
|
]);
|
|
386
401
|
};
|
|
387
402
|
var intMaxList = {
|
|
@@ -2082,6 +2097,17 @@ var RestfulFactory = class _RestfulFactory {
|
|
|
2082
2097
|
}
|
|
2083
2098
|
}
|
|
2084
2099
|
}
|
|
2100
|
+
const notRequiredButHasDefaultFields = getSpecificFields(
|
|
2101
|
+
this.entityClass,
|
|
2102
|
+
"notRequiredButHasDefault"
|
|
2103
|
+
).filter((f) => !outputFieldsToOmit.has(f));
|
|
2104
|
+
for (const field of notRequiredButHasDefaultFields) {
|
|
2105
|
+
const oldApiProperty = (0, import_nesties10.getApiProperty)(resultDto, field);
|
|
2106
|
+
(0, import_swagger7.ApiProperty)({
|
|
2107
|
+
...oldApiProperty,
|
|
2108
|
+
required: true
|
|
2109
|
+
})(resultDto.prototype, field);
|
|
2110
|
+
}
|
|
2085
2111
|
const res = (0, import_nesties11.RenameClass)(
|
|
2086
2112
|
resultDto,
|
|
2087
2113
|
`${this.getEntityClassName()}ResultDto`
|