@joktec/skills 0.1.7 → 0.1.8

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.
@@ -22,6 +22,7 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
22
22
  - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
23
23
  - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
24
24
  - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
25
+ - Do not add `swagger.type` just because a column has a primitive, date, array, nested JSON class, or relation type. The wrapper infers Swagger metadata from TypeScript design type and JokTec options. Use `swagger` only to override an inferred shape.
25
26
  - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
26
27
  - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
27
28
 
@@ -47,6 +47,7 @@ Wrapper philosophy:
47
47
 
48
48
  - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
49
49
  - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
50
+ - do not add `swagger.type` for normal scalar/date fields, arrays, nested JSON classes, or relations when the wrapper can infer the shape
50
51
  - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
51
52
  - keep storage write behavior and API documentation behavior distinct when needed
52
53
 
@@ -85,12 +86,32 @@ Common mappings:
85
86
  | `@Expose()` | default behavior of `@Column(...)` |
86
87
  | `@Expose({ groups })` | `@Column({ groups })` |
87
88
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
88
- | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
89
+ | `@ApiProperty(...)` | Prefer native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength`; use `swagger` only as an override |
89
90
  | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
90
91
  | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
91
92
  | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
92
93
  | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
93
94
 
95
+ ## Swagger Metadata Rules
96
+
97
+ The `@Column` wrapper already composes Swagger metadata. During migrations, keep entity code small and avoid redundant `swagger` declarations:
98
+
99
+ - Do not add `swagger: { type: String }` for string columns.
100
+ - Do not add `swagger: { type: Number }` for numeric columns.
101
+ - Do not add `swagger: { type: Boolean }` for boolean columns.
102
+ - Do not add `swagger: { type: Date }` for date, datetime, or timestamp columns.
103
+ - Do not add `swagger: { type: String, isArray: true }` for `simple-array` or reflected array fields unless the OpenAPI shape must differ from the entity field.
104
+ - Do not add `swagger: { type: NestedClass }` when `nested: NestedClass` is already present.
105
+ - Do not add `swagger: { type: () => Entity }` on `Column({ kind: 'relation', type: () => Entity })`; the relation wrapper keeps the Swagger type lazy to avoid circular schema evaluation.
106
+
107
+ Use `swagger` only for actual overrides, for example:
108
+
109
+ - an OpenAPI primitive differs from the TypeScript property type, such as a SQL decimal represented as `string`
110
+ - a property needs `oneOf`, `anyOf`, `allOf`, custom `items`, or a deliberately shortened example
111
+ - a generated schema needs an explicit read/write/deprecated override that cannot be represented by wrapper options
112
+
113
+ If a relation wrapper still triggers a circular Swagger error in a consumer project, inspect `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts` and the installed implementation first. Do not paper over the issue by adding `swagger.type` to every relation; identify whether the installed package version has lazy relation Swagger support.
114
+
94
115
  ## Read-Only Metadata
95
116
 
96
117
  `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate:
@@ -22,6 +22,7 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
22
22
  - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
23
23
  - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
24
24
  - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
25
+ - Do not add `swagger.type` just because a column has a primitive, date, array, nested JSON class, or relation type. The wrapper infers Swagger metadata from TypeScript design type and JokTec options. Use `swagger` only to override an inferred shape.
25
26
  - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
26
27
  - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
27
28
 
@@ -47,6 +47,7 @@ Wrapper philosophy:
47
47
 
48
48
  - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
49
49
  - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
50
+ - do not add `swagger.type` for normal scalar/date fields, arrays, nested JSON classes, or relations when the wrapper can infer the shape
50
51
  - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
51
52
  - keep storage write behavior and API documentation behavior distinct when needed
52
53
 
@@ -85,12 +86,32 @@ Common mappings:
85
86
  | `@Expose()` | default behavior of `@Column(...)` |
86
87
  | `@Expose({ groups })` | `@Column({ groups })` |
87
88
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
88
- | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
89
+ | `@ApiProperty(...)` | Prefer native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength`; use `swagger` only as an override |
89
90
  | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
90
91
  | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
91
92
  | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
92
93
  | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
93
94
 
95
+ ## Swagger Metadata Rules
96
+
97
+ The `@Column` wrapper already composes Swagger metadata. During migrations, keep entity code small and avoid redundant `swagger` declarations:
98
+
99
+ - Do not add `swagger: { type: String }` for string columns.
100
+ - Do not add `swagger: { type: Number }` for numeric columns.
101
+ - Do not add `swagger: { type: Boolean }` for boolean columns.
102
+ - Do not add `swagger: { type: Date }` for date, datetime, or timestamp columns.
103
+ - Do not add `swagger: { type: String, isArray: true }` for `simple-array` or reflected array fields unless the OpenAPI shape must differ from the entity field.
104
+ - Do not add `swagger: { type: NestedClass }` when `nested: NestedClass` is already present.
105
+ - Do not add `swagger: { type: () => Entity }` on `Column({ kind: 'relation', type: () => Entity })`; the relation wrapper keeps the Swagger type lazy to avoid circular schema evaluation.
106
+
107
+ Use `swagger` only for actual overrides, for example:
108
+
109
+ - an OpenAPI primitive differs from the TypeScript property type, such as a SQL decimal represented as `string`
110
+ - a property needs `oneOf`, `anyOf`, `allOf`, custom `items`, or a deliberately shortened example
111
+ - a generated schema needs an explicit read/write/deprecated override that cannot be represented by wrapper options
112
+
113
+ If a relation wrapper still triggers a circular Swagger error in a consumer project, inspect `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts` and the installed implementation first. Do not paper over the issue by adding `swagger.type` to every relation; identify whether the installed package version has lazy relation Swagger support.
114
+
94
115
  ## Read-Only Metadata
95
116
 
96
117
  `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate:
@@ -450,6 +450,7 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
450
450
  - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
451
451
  - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
452
452
  - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
453
+ - Do not add `swagger.type` just because a column has a primitive, date, array, nested JSON class, or relation type. The wrapper infers Swagger metadata from TypeScript design type and JokTec options. Use `swagger` only to override an inferred shape.
453
454
  - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
454
455
  - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
455
456
 
@@ -511,6 +512,7 @@ Wrapper philosophy:
511
512
 
512
513
  - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
513
514
  - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
515
+ - do not add `swagger.type` for normal scalar/date fields, arrays, nested JSON classes, or relations when the wrapper can infer the shape
514
516
  - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
515
517
  - keep storage write behavior and API documentation behavior distinct when needed
516
518
 
@@ -549,12 +551,32 @@ Common mappings:
549
551
  | `@Expose()` | default behavior of `@Column(...)` |
550
552
  | `@Expose({ groups })` | `@Column({ groups })` |
551
553
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
552
- | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
554
+ | `@ApiProperty(...)` | Prefer native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength`; use `swagger` only as an override |
553
555
  | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
554
556
  | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
555
557
  | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
556
558
  | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
557
559
 
560
+ ## Swagger Metadata Rules
561
+
562
+ The `@Column` wrapper already composes Swagger metadata. During migrations, keep entity code small and avoid redundant `swagger` declarations:
563
+
564
+ - Do not add `swagger: { type: String }` for string columns.
565
+ - Do not add `swagger: { type: Number }` for numeric columns.
566
+ - Do not add `swagger: { type: Boolean }` for boolean columns.
567
+ - Do not add `swagger: { type: Date }` for date, datetime, or timestamp columns.
568
+ - Do not add `swagger: { type: String, isArray: true }` for `simple-array` or reflected array fields unless the OpenAPI shape must differ from the entity field.
569
+ - Do not add `swagger: { type: NestedClass }` when `nested: NestedClass` is already present.
570
+ - Do not add `swagger: { type: () => Entity }` on `Column({ kind: 'relation', type: () => Entity })`; the relation wrapper keeps the Swagger type lazy to avoid circular schema evaluation.
571
+
572
+ Use `swagger` only for actual overrides, for example:
573
+
574
+ - an OpenAPI primitive differs from the TypeScript property type, such as a SQL decimal represented as `string`
575
+ - a property needs `oneOf`, `anyOf`, `allOf`, custom `items`, or a deliberately shortened example
576
+ - a generated schema needs an explicit read/write/deprecated override that cannot be represented by wrapper options
577
+
578
+ If a relation wrapper still triggers a circular Swagger error in a consumer project, inspect `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts` and the installed implementation first. Do not paper over the issue by adding `swagger.type` to every relation; identify whether the installed package version has lazy relation Swagger support.
579
+
558
580
  ## Read-Only Metadata
559
581
 
560
582
  `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate:
@@ -19,6 +19,7 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
19
19
  - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
20
20
  - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
21
21
  - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
22
+ - Do not add `swagger.type` just because a column has a primitive, date, array, nested JSON class, or relation type. The wrapper infers Swagger metadata from TypeScript design type and JokTec options. Use `swagger` only to override an inferred shape.
22
23
  - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
23
24
  - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
24
25
 
@@ -80,6 +81,7 @@ Wrapper philosophy:
80
81
 
81
82
  - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
82
83
  - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
84
+ - do not add `swagger.type` for normal scalar/date fields, arrays, nested JSON classes, or relations when the wrapper can infer the shape
83
85
  - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
84
86
  - keep storage write behavior and API documentation behavior distinct when needed
85
87
 
@@ -118,12 +120,32 @@ Common mappings:
118
120
  | `@Expose()` | default behavior of `@Column(...)` |
119
121
  | `@Expose({ groups })` | `@Column({ groups })` |
120
122
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
121
- | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
123
+ | `@ApiProperty(...)` | Prefer native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength`; use `swagger` only as an override |
122
124
  | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
123
125
  | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
124
126
  | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
125
127
  | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
126
128
 
129
+ ## Swagger Metadata Rules
130
+
131
+ The `@Column` wrapper already composes Swagger metadata. During migrations, keep entity code small and avoid redundant `swagger` declarations:
132
+
133
+ - Do not add `swagger: { type: String }` for string columns.
134
+ - Do not add `swagger: { type: Number }` for numeric columns.
135
+ - Do not add `swagger: { type: Boolean }` for boolean columns.
136
+ - Do not add `swagger: { type: Date }` for date, datetime, or timestamp columns.
137
+ - Do not add `swagger: { type: String, isArray: true }` for `simple-array` or reflected array fields unless the OpenAPI shape must differ from the entity field.
138
+ - Do not add `swagger: { type: NestedClass }` when `nested: NestedClass` is already present.
139
+ - Do not add `swagger: { type: () => Entity }` on `Column({ kind: 'relation', type: () => Entity })`; the relation wrapper keeps the Swagger type lazy to avoid circular schema evaluation.
140
+
141
+ Use `swagger` only for actual overrides, for example:
142
+
143
+ - an OpenAPI primitive differs from the TypeScript property type, such as a SQL decimal represented as `string`
144
+ - a property needs `oneOf`, `anyOf`, `allOf`, custom `items`, or a deliberately shortened example
145
+ - a generated schema needs an explicit read/write/deprecated override that cannot be represented by wrapper options
146
+
147
+ If a relation wrapper still triggers a circular Swagger error in a consumer project, inspect `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts` and the installed implementation first. Do not paper over the issue by adding `swagger.type` to every relation; identify whether the installed package version has lazy relation Swagger support.
148
+
127
149
  ## Read-Only Metadata
128
150
 
129
151
  `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate:
@@ -458,6 +458,7 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
458
458
  - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
459
459
  - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
460
460
  - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
461
+ - Do not add `swagger.type` just because a column has a primitive, date, array, nested JSON class, or relation type. The wrapper infers Swagger metadata from TypeScript design type and JokTec options. Use `swagger` only to override an inferred shape.
461
462
  - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
462
463
  - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
463
464
 
@@ -519,6 +520,7 @@ Wrapper philosophy:
519
520
 
520
521
  - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
521
522
  - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
523
+ - do not add `swagger.type` for normal scalar/date fields, arrays, nested JSON classes, or relations when the wrapper can infer the shape
522
524
  - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
523
525
  - keep storage write behavior and API documentation behavior distinct when needed
524
526
 
@@ -557,12 +559,32 @@ Common mappings:
557
559
  | `@Expose()` | default behavior of `@Column(...)` |
558
560
  | `@Expose({ groups })` | `@Column({ groups })` |
559
561
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
560
- | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
562
+ | `@ApiProperty(...)` | Prefer native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength`; use `swagger` only as an override |
561
563
  | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
562
564
  | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
563
565
  | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
564
566
  | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
565
567
 
568
+ ## Swagger Metadata Rules
569
+
570
+ The `@Column` wrapper already composes Swagger metadata. During migrations, keep entity code small and avoid redundant `swagger` declarations:
571
+
572
+ - Do not add `swagger: { type: String }` for string columns.
573
+ - Do not add `swagger: { type: Number }` for numeric columns.
574
+ - Do not add `swagger: { type: Boolean }` for boolean columns.
575
+ - Do not add `swagger: { type: Date }` for date, datetime, or timestamp columns.
576
+ - Do not add `swagger: { type: String, isArray: true }` for `simple-array` or reflected array fields unless the OpenAPI shape must differ from the entity field.
577
+ - Do not add `swagger: { type: NestedClass }` when `nested: NestedClass` is already present.
578
+ - Do not add `swagger: { type: () => Entity }` on `Column({ kind: 'relation', type: () => Entity })`; the relation wrapper keeps the Swagger type lazy to avoid circular schema evaluation.
579
+
580
+ Use `swagger` only for actual overrides, for example:
581
+
582
+ - an OpenAPI primitive differs from the TypeScript property type, such as a SQL decimal represented as `string`
583
+ - a property needs `oneOf`, `anyOf`, `allOf`, custom `items`, or a deliberately shortened example
584
+ - a generated schema needs an explicit read/write/deprecated override that cannot be represented by wrapper options
585
+
586
+ If a relation wrapper still triggers a circular Swagger error in a consumer project, inspect `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts` and the installed implementation first. Do not paper over the issue by adding `swagger.type` to every relation; identify whether the installed package version has lazy relation Swagger support.
587
+
566
588
  ## Read-Only Metadata
567
589
 
568
590
  `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate:
@@ -15,6 +15,7 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
15
15
  - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
16
16
  - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
17
17
  - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
18
+ - Do not add `swagger.type` just because a column has a primitive, date, array, nested JSON class, or relation type. The wrapper infers Swagger metadata from TypeScript design type and JokTec options. Use `swagger` only to override an inferred shape.
18
19
  - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
19
20
  - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
20
21
 
@@ -76,6 +77,7 @@ Wrapper philosophy:
76
77
 
77
78
  - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
78
79
  - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
80
+ - do not add `swagger.type` for normal scalar/date fields, arrays, nested JSON classes, or relations when the wrapper can infer the shape
79
81
  - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
80
82
  - keep storage write behavior and API documentation behavior distinct when needed
81
83
 
@@ -114,12 +116,32 @@ Common mappings:
114
116
  | `@Expose()` | default behavior of `@Column(...)` |
115
117
  | `@Expose({ groups })` | `@Column({ groups })` |
116
118
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
117
- | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
119
+ | `@ApiProperty(...)` | Prefer native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength`; use `swagger` only as an override |
118
120
  | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
119
121
  | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
120
122
  | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
121
123
  | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
122
124
 
125
+ ## Swagger Metadata Rules
126
+
127
+ The `@Column` wrapper already composes Swagger metadata. During migrations, keep entity code small and avoid redundant `swagger` declarations:
128
+
129
+ - Do not add `swagger: { type: String }` for string columns.
130
+ - Do not add `swagger: { type: Number }` for numeric columns.
131
+ - Do not add `swagger: { type: Boolean }` for boolean columns.
132
+ - Do not add `swagger: { type: Date }` for date, datetime, or timestamp columns.
133
+ - Do not add `swagger: { type: String, isArray: true }` for `simple-array` or reflected array fields unless the OpenAPI shape must differ from the entity field.
134
+ - Do not add `swagger: { type: NestedClass }` when `nested: NestedClass` is already present.
135
+ - Do not add `swagger: { type: () => Entity }` on `Column({ kind: 'relation', type: () => Entity })`; the relation wrapper keeps the Swagger type lazy to avoid circular schema evaluation.
136
+
137
+ Use `swagger` only for actual overrides, for example:
138
+
139
+ - an OpenAPI primitive differs from the TypeScript property type, such as a SQL decimal represented as `string`
140
+ - a property needs `oneOf`, `anyOf`, `allOf`, custom `items`, or a deliberately shortened example
141
+ - a generated schema needs an explicit read/write/deprecated override that cannot be represented by wrapper options
142
+
143
+ If a relation wrapper still triggers a circular Swagger error in a consumer project, inspect `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts` and the installed implementation first. Do not paper over the issue by adding `swagger.type` to every relation; identify whether the installed package version has lazy relation Swagger support.
144
+
123
145
  ## Read-Only Metadata
124
146
 
125
147
  `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joktec/skills",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "description": "Hybrid agent skill pack for using @joktec/* libraries in consumer projects.",
6
6
  "license": "MIT",
package/skill-pack.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joktec/skills",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "sourceOfTruth": "../joktec-framework",
5
5
  "frameworkBaseline": {
6
6
  "repo": "https://github.com/joktec/joktec-framework",
@@ -22,6 +22,7 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
22
22
  - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
23
23
  - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
24
24
  - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
25
+ - Do not add `swagger.type` just because a column has a primitive, date, array, nested JSON class, or relation type. The wrapper infers Swagger metadata from TypeScript design type and JokTec options. Use `swagger` only to override an inferred shape.
25
26
  - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
26
27
  - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
27
28
 
@@ -47,6 +47,7 @@ Wrapper philosophy:
47
47
 
48
48
  - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
49
49
  - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
50
+ - do not add `swagger.type` for normal scalar/date fields, arrays, nested JSON classes, or relations when the wrapper can infer the shape
50
51
  - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
51
52
  - keep storage write behavior and API documentation behavior distinct when needed
52
53
 
@@ -85,12 +86,32 @@ Common mappings:
85
86
  | `@Expose()` | default behavior of `@Column(...)` |
86
87
  | `@Expose({ groups })` | `@Column({ groups })` |
87
88
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
88
- | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
89
+ | `@ApiProperty(...)` | Prefer native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength`; use `swagger` only as an override |
89
90
  | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
90
91
  | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
91
92
  | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
92
93
  | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
93
94
 
95
+ ## Swagger Metadata Rules
96
+
97
+ The `@Column` wrapper already composes Swagger metadata. During migrations, keep entity code small and avoid redundant `swagger` declarations:
98
+
99
+ - Do not add `swagger: { type: String }` for string columns.
100
+ - Do not add `swagger: { type: Number }` for numeric columns.
101
+ - Do not add `swagger: { type: Boolean }` for boolean columns.
102
+ - Do not add `swagger: { type: Date }` for date, datetime, or timestamp columns.
103
+ - Do not add `swagger: { type: String, isArray: true }` for `simple-array` or reflected array fields unless the OpenAPI shape must differ from the entity field.
104
+ - Do not add `swagger: { type: NestedClass }` when `nested: NestedClass` is already present.
105
+ - Do not add `swagger: { type: () => Entity }` on `Column({ kind: 'relation', type: () => Entity })`; the relation wrapper keeps the Swagger type lazy to avoid circular schema evaluation.
106
+
107
+ Use `swagger` only for actual overrides, for example:
108
+
109
+ - an OpenAPI primitive differs from the TypeScript property type, such as a SQL decimal represented as `string`
110
+ - a property needs `oneOf`, `anyOf`, `allOf`, custom `items`, or a deliberately shortened example
111
+ - a generated schema needs an explicit read/write/deprecated override that cannot be represented by wrapper options
112
+
113
+ If a relation wrapper still triggers a circular Swagger error in a consumer project, inspect `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts` and the installed implementation first. Do not paper over the issue by adding `swagger.type` to every relation; identify whether the installed package version has lazy relation Swagger support.
114
+
94
115
  ## Read-Only Metadata
95
116
 
96
117
  `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate: