nest-prisma_doc-gen 1.0.11 → 1.0.13

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.
@@ -42,7 +42,7 @@ export class DocGenDto {
42
42
  this.classValidators.add("IsEnum");
43
43
  this.imports.add(`import { ${Array.from(this.enums)} } from '@prisma/client';`);
44
44
  }
45
- this.imports.add(`import { ${Array.from(this.classValidators)} } from 'src/utils/validators';`);
45
+ this.imports.add(`import { ${Array.from(this.classValidators)} } from 'src/_core/validators';`);
46
46
  return [
47
47
  `${Array.from(this.imports).join("\n")}`,
48
48
  `export class ${this.name}Dto {
@@ -108,7 +108,7 @@ export class DocGenField {
108
108
  props.push(`example: true`);
109
109
  }
110
110
  else if (this.scalarField.kind === "enum") {
111
- props.push(`example: ${this.scalarField.type}[0]`);
111
+ props.push(`example: Object.values(${this.scalarField.type})[0]`);
112
112
  }
113
113
  else if (this.scalarField.type === "Int") {
114
114
  props.push(`example: 777`);
@@ -154,7 +154,7 @@ export class DocGenField {
154
154
  return this.type;
155
155
  }
156
156
  };
157
- const optionalFlag = this.isRequired ? "" : "?";
157
+ const optionalFlag = this.isRequired ? "!" : "?";
158
158
  const validators = this.sanitizeValidators();
159
159
  const apiExample = this.buildApiExample().join(", ");
160
160
  return {
package/dist/main.js CHANGED
@@ -38,7 +38,6 @@ export class DocGen {
38
38
  }
39
39
  build() {
40
40
  this.fields.file.save();
41
- // this.enums.file.save();
42
41
  for (const model of this.models) {
43
42
  model.save();
44
43
  }
@@ -1,5 +1,5 @@
1
- import { promises as fs } from "fs";
2
- import * as path from "path";
1
+ import { promises as fs } from "node:fs";
2
+ import * as path from "node:path";
3
3
  export class PrismaUtils {
4
4
  static async readPrismaFolderDatamodel(dir) {
5
5
  const prismaFiles = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nest-prisma_doc-gen",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Auto generates ApiProperties from schema.prisma",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",