nest-prisma_doc-gen 1.0.4 → 1.0.5

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.
@@ -88,6 +88,7 @@ export class DocGenField {
88
88
  const fieldName = this.scalarField.name;
89
89
  const props = [];
90
90
  const scalarDbName = this.scalarField.dbName ?? "genericDbName";
91
+ console.log(this.scalarField);
91
92
  if (this.isEntity) {
92
93
  if (this.isList) {
93
94
  props.push(`example: [generateExample(${this.type})]`);
@@ -102,7 +103,7 @@ export class DocGenField {
102
103
  else if (helpers.isDate(this.scalarField)) {
103
104
  props.push(`example: '2025-09-03T03:00:00.000Z'`);
104
105
  }
105
- else if (this.scalarField.isId || (this.scalarField.isReadOnly && scalarDbName.split("_").includes("id"))) {
106
+ else if (this.scalarField.isId || Helper.splitByUpperCase(this.scalarField.name).includes("Id")) {
106
107
  props.push(`example: 'cmfxu4njg000008l52v7t8qze'`);
107
108
  }
108
109
  else if (this.scalarField.type === "Boolean") {
@@ -137,6 +137,9 @@ export class Helper {
137
137
  else
138
138
  return "any";
139
139
  }
140
+ static splitByUpperCase(str) {
141
+ return str.split(/(?=[A-Z])/);
142
+ }
140
143
  isDate(field) {
141
144
  return field.kind === "scalar" && field.type === "DateTime";
142
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nest-prisma_doc-gen",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Auto generates ApiProperties from schema.prisma",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",