nest-prisma_doc-gen 1.0.14 → 1.0.16

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.
@@ -9,7 +9,7 @@ export class DocGenDto {
9
9
  imports = new Set([
10
10
  `${Static.AUTO_GENERATED_COMMENT}`,
11
11
  `import { ApiProperty, IntersectionType } from '@nestjs/swagger'`,
12
- `import { DefaultIdDto } from '../generic.dto'`,
12
+ `import { DefaultIdDtoDG } from '../generic.dto'`,
13
13
  ]);
14
14
  classValidators = new Set();
15
15
  enums = new Set();
@@ -49,12 +49,12 @@ export class DocGenDto {
49
49
  this.imports.add(`import { ${Array.from(this.classValidators)} } from 'src/_core/validators';`);
50
50
  return [
51
51
  `${Array.from(this.imports).join("\n")}`,
52
- `export class ${this.name}Dto {
52
+ `export class ${this.name}DtoDG {
53
53
  ${sanitizedFields}
54
54
  }`,
55
- `export class ${this.name}WithIdDto extends IntersectionType(
56
- ${this.name}Dto,
57
- DefaultIdDto,
55
+ `export class ${this.name}WithIdDtoDG extends IntersectionType(
56
+ ${this.name}DtoDG,
57
+ DefaultIdDtoDG,
58
58
  ) {}`,
59
59
  ].join("\n\n");
60
60
  }
@@ -79,7 +79,7 @@ export class DocGenField {
79
79
  }
80
80
  else if (this.kind === "object") {
81
81
  this.isResponse = true;
82
- this.type = `${this.scalarType}Res`;
82
+ this.type = `${this.scalarType}ResDG`;
83
83
  }
84
84
  else if (this.kind === "scalar") {
85
85
  this.type = Helper.prismaScalarToTs(this.scalarType);
@@ -110,7 +110,9 @@ export class DocGenField {
110
110
  }
111
111
  else if (this.scalarField.kind === "enum") {
112
112
  const example = [`example: Object.values(${this.scalarField.type})`];
113
- this.isArray ?? example.push("[0]");
113
+ if (!this.isArray) {
114
+ example.push("[0]");
115
+ }
114
116
  props.push(example.join());
115
117
  }
116
118
  else if (this.scalarField.type === "Int") {
@@ -7,7 +7,7 @@ export class DocGenGeneric {
7
7
  import { IsString, IsNotEmpty } from 'src/_core/validators';
8
8
  `;
9
9
  const validatorProps = `
10
- export class DefaultIdDto {
10
+ export class DefaultIdDtoDG {
11
11
  @ApiProperty({ type: 'string', example: 'cmfxu4njg000008l52v7t8qze', required: true })
12
12
  @IsString()
13
13
  @IsNotEmpty()
@@ -39,7 +39,7 @@ export class DocGenResponse {
39
39
  }
40
40
  return [
41
41
  `${Array.from(this.imports).join("\n")}`,
42
- `export class ${this.name}Res {
42
+ `export class ${this.name}ResDG {
43
43
  ${sanitizedFields}
44
44
  }`,
45
45
  ].join("\n\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nest-prisma_doc-gen",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Auto generates ApiProperties from schema.prisma",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",