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.mjs
CHANGED
|
@@ -256,8 +256,14 @@ var ParseBoolObjectPipe = class {
|
|
|
256
256
|
};
|
|
257
257
|
|
|
258
258
|
// src/decorators/property.ts
|
|
259
|
+
var NotRequiredButHasDefaultDec = () => Metadata.set(
|
|
260
|
+
"notRequiredButHasDefault",
|
|
261
|
+
true,
|
|
262
|
+
"notRequiredButHasDefaultFields"
|
|
263
|
+
);
|
|
259
264
|
function swaggerDecorator(options, injected = {}) {
|
|
260
|
-
|
|
265
|
+
const notRequiredButHasDefault = options.required == null && options.default != null;
|
|
266
|
+
const apiPropertyDec = ApiProperty2({
|
|
261
267
|
default: options.default,
|
|
262
268
|
required: !!(options.required && options.default == null),
|
|
263
269
|
example: options.default,
|
|
@@ -265,6 +271,14 @@ function swaggerDecorator(options, injected = {}) {
|
|
|
265
271
|
...injected,
|
|
266
272
|
...options.propertyExtras || {}
|
|
267
273
|
});
|
|
274
|
+
if (notRequiredButHasDefault) {
|
|
275
|
+
return MergePropertyDecorators2([
|
|
276
|
+
apiPropertyDec,
|
|
277
|
+
NotRequiredButHasDefaultDec()
|
|
278
|
+
]);
|
|
279
|
+
} else {
|
|
280
|
+
return apiPropertyDec;
|
|
281
|
+
}
|
|
268
282
|
}
|
|
269
283
|
function validatorDecorator(options) {
|
|
270
284
|
const decs = [];
|
|
@@ -316,7 +330,8 @@ var UuidColumn = (options = {}) => {
|
|
|
316
330
|
type: String,
|
|
317
331
|
format: "uuid",
|
|
318
332
|
example: "550e8400-e29b-41d4-a716-446655440000"
|
|
319
|
-
})
|
|
333
|
+
}),
|
|
334
|
+
...options.generated ? [NotRequiredButHasDefaultDec()] : []
|
|
320
335
|
]);
|
|
321
336
|
};
|
|
322
337
|
var intMaxList = {
|
|
@@ -2055,6 +2070,17 @@ var RestfulFactory = class _RestfulFactory {
|
|
|
2055
2070
|
}
|
|
2056
2071
|
}
|
|
2057
2072
|
}
|
|
2073
|
+
const notRequiredButHasDefaultFields = getSpecificFields(
|
|
2074
|
+
this.entityClass,
|
|
2075
|
+
"notRequiredButHasDefault"
|
|
2076
|
+
).filter((f) => !outputFieldsToOmit.has(f));
|
|
2077
|
+
for (const field of notRequiredButHasDefaultFields) {
|
|
2078
|
+
const oldApiProperty = getApiProperty2(resultDto, field);
|
|
2079
|
+
ApiProperty6({
|
|
2080
|
+
...oldApiProperty,
|
|
2081
|
+
required: true
|
|
2082
|
+
})(resultDto.prototype, field);
|
|
2083
|
+
}
|
|
2058
2084
|
const res = RenameClass(
|
|
2059
2085
|
resultDto,
|
|
2060
2086
|
`${this.getEntityClassName()}ResultDto`
|