nest-prisma_doc-gen 1.0.4 → 1.0.6

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.
@@ -87,7 +87,6 @@ export class DocGenField {
87
87
  buildApiExample() {
88
88
  const fieldName = this.scalarField.name;
89
89
  const props = [];
90
- const scalarDbName = this.scalarField.dbName ?? "genericDbName";
91
90
  if (this.isEntity) {
92
91
  if (this.isList) {
93
92
  props.push(`example: [generateExample(${this.type})]`);
@@ -102,7 +101,7 @@ export class DocGenField {
102
101
  else if (helpers.isDate(this.scalarField)) {
103
102
  props.push(`example: '2025-09-03T03:00:00.000Z'`);
104
103
  }
105
- else if (this.scalarField.isId || (this.scalarField.isReadOnly && scalarDbName.split("_").includes("id"))) {
104
+ else if (this.scalarField.isId || Helper.splitByUpperCase(this.scalarField.name).includes("Id")) {
106
105
  props.push(`example: 'cmfxu4njg000008l52v7t8qze'`);
107
106
  }
108
107
  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.6",
4
4
  "description": "Auto generates ApiProperties from schema.prisma",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,6 @@
28
28
  "author": "Alessandro Lepore",
29
29
  "license": "ISC",
30
30
  "dependencies": {
31
- "@esbuild/win32-x64": "^0.25.11",
32
31
  "@prisma/internals": "^6.17.1",
33
32
  "ajv": "^8.17.1",
34
33
  "ajv-formats": "^3.0.1",