@0kmpo/openapi-clean-arch-generator 1.3.14 β 1.4.0
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.
- package/README.md +132 -63
- package/dist/main.js +31 -3
- package/dist/package.json +1 -1
- package/dist/src/generators/clean-arch.generator.js +221 -145
- package/dist/src/generators/dto.generator.js +48 -24
- package/dist/src/generators/report.generator.js +6 -0
- package/dist/src/utils/config.js +3 -0
- package/dist/src/utils/example-validator.js +86 -0
- package/dist/src/utils/mock-value-resolver.js +19 -7
- package/dist/src/utils/name-formatter.js +133 -2
- package/dist/templates/api.repository.contract.mustache +1 -1
- package/dist/templates/api.repository.impl.mock.mustache +2 -2
- package/dist/templates/api.repository.impl.mustache +5 -5
- package/dist/templates/api.repository.impl.spec.mustache +2 -2
- package/dist/templates/api.use-cases.contract.mustache +1 -1
- package/dist/templates/api.use-cases.impl.mustache +2 -2
- package/dist/templates/api.use-cases.impl.spec.mustache +2 -2
- package/dist/templates/api.use-cases.mock.mustache +2 -2
- package/dist/templates/dto.mock.mustache +1 -1
- package/dist/templates/mapper.mustache +2 -2
- package/dist/templates/mapper.spec.mustache +2 -2
- package/dist/templates/model-entity.mustache +1 -1
- package/dist/templates/model-entity.spec.mustache +4 -0
- package/dist/templates/model.mock.mustache +2 -2
- package/dist/templates/repository.provider.mock.mustache +2 -2
- package/dist/templates/repository.provider.mustache +2 -2
- package/dist/templates/use-cases.provider.mock.mustache +2 -2
- package/dist/templates/use-cases.provider.mustache +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,18 +75,41 @@ Options:
|
|
|
75
75
|
-i, --input <file> OpenAPI/Swagger file (yaml or json) [default: swagger.yaml]
|
|
76
76
|
-o, --output <dir> Output directory [default: ./src/app]
|
|
77
77
|
-t, --templates <dir> Custom templates directory [default: ./templates]
|
|
78
|
+
-k, --base-name <name> Base name for generated folders (defaults to swagger filename)
|
|
78
79
|
-s, --select-endpoints Interactively select tags and endpoints to generate
|
|
80
|
+
-c, --config <file> Use a JSON configuration file (skips interactive prompts)
|
|
81
|
+
--init-config [file] Generate a JSON configuration file instead of generating code
|
|
79
82
|
--skip-install Skip dependency installation
|
|
83
|
+
--skip-lint Skip post-generation linting and formatting
|
|
80
84
|
--dry-run Simulate without writing files
|
|
81
85
|
-h, --help Show help
|
|
82
86
|
```
|
|
83
87
|
|
|
88
|
+
### Base name (`-k`)
|
|
89
|
+
|
|
90
|
+
The generator organises output into subfolders based on a **base name** derived from your OpenAPI file. By default it extracts the token immediately before `-swagger` in the filename:
|
|
91
|
+
|
|
92
|
+
| Filename | Derived base name |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `my-app-swagger.yaml` | `app` |
|
|
95
|
+
| `ecommerce-swagger.yaml` | `ecommerce` |
|
|
96
|
+
| `backoffice.yaml` | `backoffice` (+ warning) |
|
|
97
|
+
|
|
98
|
+
Use `-k` to override this value:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
generate-clean-arch -i api.yaml -k example1 # all files go under example1/
|
|
102
|
+
```
|
|
103
|
+
|
|
84
104
|
### Examples
|
|
85
105
|
|
|
86
106
|
```bash
|
|
87
107
|
# Generate from swagger.yaml into src/app
|
|
88
108
|
generate-clean-arch -i swagger.yaml -o ./src/app
|
|
89
109
|
|
|
110
|
+
# Override base name (folder organisation)
|
|
111
|
+
generate-clean-arch -i ecommerce-api-swagger.yaml -o src/app -k ecommerce
|
|
112
|
+
|
|
90
113
|
# Interactively select tags/endpoints
|
|
91
114
|
generate-clean-arch -i api.yaml -s
|
|
92
115
|
|
|
@@ -96,69 +119,72 @@ generate-clean-arch -i api.yaml -t ./my-templates
|
|
|
96
119
|
# Dry run (no files written)
|
|
97
120
|
generate-clean-arch -i swagger.yaml --dry-run
|
|
98
121
|
|
|
122
|
+
# Skip linting after generation
|
|
123
|
+
generate-clean-arch -i swagger.yaml --skip-lint
|
|
124
|
+
|
|
125
|
+
# Generate a config file to reuse later
|
|
126
|
+
generate-clean-arch --init-config generation-config.json
|
|
127
|
+
|
|
128
|
+
# Run using a config file (no interactive prompts)
|
|
129
|
+
generate-clean-arch -c generation-config.json
|
|
130
|
+
|
|
99
131
|
# Full example with all options
|
|
100
|
-
generate-clean-arch -i ./docs/api.yaml -o ./frontend/src/app -t ./custom-templates
|
|
132
|
+
generate-clean-arch -i ./docs/api.yaml -o ./frontend/src/app -t ./custom-templates -k myapp
|
|
101
133
|
```
|
|
102
134
|
|
|
103
135
|
## π Generated Structure
|
|
104
136
|
|
|
105
|
-
The generator creates the following structure following Clean Architecture:
|
|
137
|
+
The generator creates the following structure following Clean Architecture. All artefacts are organised under a **base name** folder (derived from the OpenAPI filename or set with `-k`), and within each layer further grouped by **tag subfolders** (one per API tag, or `shared` for types used across multiple tags):
|
|
106
138
|
|
|
107
139
|
```
|
|
108
140
|
src/app/
|
|
109
|
-
βββ
|
|
110
|
-
β βββ
|
|
111
|
-
β β βββ
|
|
112
|
-
β β β βββ
|
|
113
|
-
β β β
|
|
114
|
-
β β
|
|
115
|
-
β β
|
|
116
|
-
β β β
|
|
117
|
-
β β
|
|
118
|
-
β β
|
|
119
|
-
β β
|
|
120
|
-
β βββ
|
|
121
|
-
β β
|
|
122
|
-
β β βββ
|
|
123
|
-
β β
|
|
124
|
-
β β βββ
|
|
125
|
-
β β βββ
|
|
126
|
-
β β βββ
|
|
127
|
-
β β
|
|
128
|
-
β βββ
|
|
129
|
-
β
|
|
130
|
-
β
|
|
131
|
-
β
|
|
132
|
-
β
|
|
141
|
+
βββ <baseName>/ # Base name folder (e.g. "ecommerce")
|
|
142
|
+
β βββ <tag1>/ # Tag subfolder (camelCase, e.g. "user")
|
|
143
|
+
β β βββ data/dtos/ # Data Transfer Objects
|
|
144
|
+
β β β βββ user.dto.ts
|
|
145
|
+
β β β βββ user.dto.mock.ts
|
|
146
|
+
β β β βββ ...
|
|
147
|
+
β β βββ data/repositories/ # Repository implementations
|
|
148
|
+
β β β βββ user.repository.impl.ts
|
|
149
|
+
β β β βββ user.repository.impl.mock.ts
|
|
150
|
+
β β β βββ user.repository.impl.spec.ts
|
|
151
|
+
β β βββ data/mappers/ # DTO β Entity transformers
|
|
152
|
+
β β β βββ user.mapper.ts
|
|
153
|
+
β β β βββ user.mapper.spec.ts
|
|
154
|
+
β β βββ domain/repositories/ # Repository contracts
|
|
155
|
+
β β β βββ user.repository.contract.ts
|
|
156
|
+
β β βββ domain/use-cases/ # Use cases
|
|
157
|
+
β β β βββ user.use-cases.contract.ts
|
|
158
|
+
β β β βββ user.use-cases.impl.ts
|
|
159
|
+
β β β βββ user.use-cases.mock.ts
|
|
160
|
+
β β β βββ user.use-cases.impl.spec.ts
|
|
161
|
+
β β βββ di/repositories/ # Repository DI providers
|
|
162
|
+
β β β βββ user.repository.provider.ts
|
|
163
|
+
β β β βββ user.repository.provider.mock.ts
|
|
164
|
+
β β βββ di/use-cases/ # Use case DI providers
|
|
165
|
+
β β βββ user.use-cases.provider.ts
|
|
166
|
+
β β βββ user.use-cases.provider.mock.ts
|
|
167
|
+
β βββ <tag2>/ # Another tag (e.g. "productFormat")
|
|
168
|
+
β β βββ ... # Same internal structure
|
|
169
|
+
β βββ shared/ # Shared types (used by 0 or multiple tags)
|
|
133
170
|
β βββ ...
|
|
134
|
-
|
|
135
|
-
β βββ repositories/ # Repository contracts
|
|
136
|
-
β β βββ node.repository.contract.ts
|
|
137
|
-
β β βββ ...
|
|
138
|
-
β βββ use-cases/ # Use cases
|
|
139
|
-
β βββ node/
|
|
140
|
-
β β βββ node.use-cases.contract.ts
|
|
141
|
-
β β βββ node.use-cases.impl.ts
|
|
142
|
-
β β βββ node.use-cases.mock.ts
|
|
143
|
-
β β βββ node.use-cases.impl.spec.ts
|
|
144
|
-
β βββ ...
|
|
145
|
-
βββ di/ # Dependency injection
|
|
146
|
-
β βββ repositories/ # Repository providers
|
|
147
|
-
β β βββ node.repository.provider.ts
|
|
148
|
-
β β βββ node.repository.provider.mock.ts
|
|
149
|
-
β β βββ ...
|
|
150
|
-
β βββ use-cases/ # Use case providers
|
|
151
|
-
β βββ node.use-cases.provider.ts
|
|
152
|
-
β βββ node.use-cases.provider.mock.ts
|
|
153
|
-
β βββ ...
|
|
154
|
-
βββ entities/ # Domain entities
|
|
171
|
+
βββ entities/ # Domain entities (outside baseName)
|
|
155
172
|
βββ models/
|
|
156
|
-
βββ
|
|
157
|
-
βββ
|
|
158
|
-
βββ
|
|
159
|
-
βββ
|
|
173
|
+
βββ <tag1>/
|
|
174
|
+
β βββ user.model.ts
|
|
175
|
+
β βββ user.model.mock.ts
|
|
176
|
+
β βββ user.model.spec.ts
|
|
177
|
+
βββ shared/
|
|
178
|
+
βββ ...
|
|
160
179
|
```
|
|
161
180
|
|
|
181
|
+
### How the folder organisation works
|
|
182
|
+
|
|
183
|
+
1. **Base name** β derived from the OpenAPI filename (token before `-swagger`) or overridden with `-k`
|
|
184
|
+
2. **Tag subfolders** β each API tag gets its own camelCase folder (e.g. `User` β `user`, `Product Format` β `productFormat`)
|
|
185
|
+
3. **Shared types** β schemas used by zero or multiple tags land in `shared/`
|
|
186
|
+
4. **Layer grouping** β each tag subfolder mirrors the full Clean Architecture layers (`data/`, `domain/`, `di/`, `entities/`)
|
|
187
|
+
|
|
162
188
|
## π§ Template Customization
|
|
163
189
|
|
|
164
190
|
Templates live in `templates/` and use [Mustache](https://mustache.github.io/) syntax. Override them by passing your own directory with `-t`.
|
|
@@ -219,6 +245,20 @@ After each run a `generation-report.json` file is created:
|
|
|
219
245
|
"prettier": { "ran": true, "filesFormatted": 42 },
|
|
220
246
|
"eslint": { "ran": true, "filesFixed": 42 }
|
|
221
247
|
},
|
|
248
|
+
"warnings": {
|
|
249
|
+
"total": 2,
|
|
250
|
+
"exampleMismatches": [
|
|
251
|
+
{
|
|
252
|
+
"schemaName": "UserDto",
|
|
253
|
+
"propertyName": "age",
|
|
254
|
+
"declaredType": "string",
|
|
255
|
+
"exampleValue": 25,
|
|
256
|
+
"exampleJsType": "number",
|
|
257
|
+
"action": "coerced",
|
|
258
|
+
"coercedValue": "25"
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
},
|
|
222
262
|
"structure": {
|
|
223
263
|
"dtos": 15,
|
|
224
264
|
"repositories": 9,
|
|
@@ -231,27 +271,35 @@ After each run a `generation-report.json` file is created:
|
|
|
231
271
|
}
|
|
232
272
|
```
|
|
233
273
|
|
|
274
|
+
The report includes **example/type mismatch warnings** β when your OpenAPI schema declares a type (e.g. `string`) but the `example` value has a different JS type (e.g. a number). The generator either coerces the value or falls back to a type default and logs it here.
|
|
275
|
+
|
|
234
276
|
## π― Angular Integration Example
|
|
235
277
|
|
|
236
278
|
### 1. Generate code
|
|
237
279
|
|
|
238
280
|
```bash
|
|
239
|
-
generate-clean-arch -i ./docs/api.yaml -o ./src/app
|
|
281
|
+
generate-clean-arch -i ./docs/api.yaml -o ./src/app -k myapp
|
|
240
282
|
```
|
|
241
283
|
|
|
284
|
+
### Automatic environment API key detection
|
|
285
|
+
|
|
286
|
+
During generation the tool automatically searches for an `environment.ts` file (up to 8 levels deep, skipping `node_modules`, `.git`, `dist`, etc.). It extracts keys containing "api" and offers them for selection per tag. If no file or no matching keys are found, you'll be prompted to enter them manually.
|
|
287
|
+
|
|
288
|
+
Each tag's repositories use the selected environment key to configure the base URL for HTTP calls (e.g. `environment.apiUrl`).
|
|
289
|
+
|
|
242
290
|
### 2. Register providers
|
|
243
291
|
|
|
244
292
|
In your `app.config.ts` (Angular 17+ standalone):
|
|
245
293
|
|
|
246
294
|
```typescript
|
|
247
295
|
import { ApplicationConfig } from '@angular/core';
|
|
248
|
-
import {
|
|
249
|
-
import {
|
|
296
|
+
import { UserRepositoryProvider } from './myapp/user/di/repositories/user.repository.provider';
|
|
297
|
+
import { UserUseCasesProvider } from './myapp/user/di/use-cases/user.use-cases.provider';
|
|
250
298
|
|
|
251
299
|
export const appConfig: ApplicationConfig = {
|
|
252
300
|
providers: [
|
|
253
|
-
|
|
254
|
-
|
|
301
|
+
UserRepositoryProvider,
|
|
302
|
+
UserUseCasesProvider,
|
|
255
303
|
// ... rest of generated providers
|
|
256
304
|
]
|
|
257
305
|
};
|
|
@@ -261,18 +309,18 @@ export const appConfig: ApplicationConfig = {
|
|
|
261
309
|
|
|
262
310
|
```typescript
|
|
263
311
|
import { Component, inject } from '@angular/core';
|
|
264
|
-
import {
|
|
312
|
+
import { USER_USE_CASES } from './domain/use-cases/myapp/user/user.use-cases.contract';
|
|
265
313
|
|
|
266
314
|
@Component({
|
|
267
|
-
selector: 'app-
|
|
315
|
+
selector: 'app-users',
|
|
268
316
|
template: `...`
|
|
269
317
|
})
|
|
270
|
-
export class
|
|
271
|
-
readonly #
|
|
318
|
+
export class UsersComponent {
|
|
319
|
+
readonly #userUseCases = inject(USER_USE_CASES);
|
|
272
320
|
|
|
273
|
-
|
|
274
|
-
this.#
|
|
275
|
-
console.log(
|
|
321
|
+
loadUsers(): void {
|
|
322
|
+
this.#userUseCases.getUsers().subscribe((users) => {
|
|
323
|
+
console.log(users);
|
|
276
324
|
});
|
|
277
325
|
}
|
|
278
326
|
}
|
|
@@ -296,6 +344,18 @@ Specify the correct path with `-i`:
|
|
|
296
344
|
generate-clean-arch -i ./path/to/your/api.yaml
|
|
297
345
|
```
|
|
298
346
|
|
|
347
|
+
### Base name warning
|
|
348
|
+
|
|
349
|
+
If your OpenAPI file doesn't contain `-swagger` in the filename (e.g. `backoffice.yaml`), the generator uses the last token and emits a warning. Use `-k` to set it explicitly, or define it in your config file:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Via CLI
|
|
353
|
+
generate-clean-arch -i backoffice.yaml -k backoffice
|
|
354
|
+
|
|
355
|
+
# Via config file (-c)
|
|
356
|
+
generate-clean-arch -c generation-config.json # with "baseName": "backoffice" in the JSON
|
|
357
|
+
```
|
|
358
|
+
|
|
299
359
|
### Path aliases `@/` not resolving
|
|
300
360
|
|
|
301
361
|
Configure the aliases in your Angular project's `tsconfig.json`:
|
|
@@ -316,12 +376,21 @@ Configure the aliases in your Angular project's `tsconfig.json`:
|
|
|
316
376
|
2. Check the Mustache syntax
|
|
317
377
|
3. Use `--dry-run` to simulate without writing files
|
|
318
378
|
|
|
379
|
+
### Example/type mismatch warnings
|
|
380
|
+
|
|
381
|
+
When your OpenAPI schema declares a type (e.g. `type: string`) but the `example` value is a different JS type (e.g. `example: 25` β a number), the generator either coerces it or uses a type default. Check `generation-report.json` under `warnings.exampleMismatches` for details.
|
|
382
|
+
|
|
319
383
|
## π Notes
|
|
320
384
|
|
|
321
385
|
- The generator produces ready-to-use `.ts` files, it does not compile them
|
|
322
386
|
- Providers must be registered manually in your Angular module or config
|
|
323
387
|
- Requires Angular 17+ (uses the `inject()` function)
|
|
324
388
|
- Compatible with both standalone and module-based projects
|
|
389
|
+
- **Base name**: derived from the OpenAPI filename (token before `-swagger`), overridden with `-k`, or set in the config file (`-c`) as `"baseName"`
|
|
390
|
+
- **Tag organisation**: each API tag gets its own subfolder; shared types go in `shared/`
|
|
391
|
+
- **Environment detection**: automatically finds `environment.ts` and offers API keys per tag
|
|
392
|
+
- **Example validation**: type mismatches between declared types and example values are detected, coerced when possible, and reported in `generation-report.json`
|
|
393
|
+
- **Config workflow**: use `--init-config` to generate a `generation-config.json`, edit it to customise tags/endpoints/baseUrls/baseName, then reuse with `-c`
|
|
325
394
|
|
|
326
395
|
## π€ Contributing
|
|
327
396
|
|
package/dist/main.js
CHANGED
|
@@ -17,8 +17,10 @@ const clean_arch_generator_1 = require("./src/generators/clean-arch.generator");
|
|
|
17
17
|
const report_generator_1 = require("./src/generators/report.generator");
|
|
18
18
|
const lint_generator_1 = require("./src/generators/lint.generator");
|
|
19
19
|
const environment_finder_1 = require("./src/utils/environment-finder");
|
|
20
|
+
const example_validator_1 = require("./src/utils/example-validator");
|
|
20
21
|
const prompt_1 = require("./src/utils/prompt");
|
|
21
22
|
const config_1 = require("./src/utils/config");
|
|
23
|
+
const name_formatter_1 = require("./src/utils/name-formatter");
|
|
22
24
|
const package_json_1 = __importDefault(require("./package.json"));
|
|
23
25
|
// Disable HTML escaping so that < and > produce valid TypeScript generic types.
|
|
24
26
|
mustache_1.default.escape = function (text) {
|
|
@@ -36,6 +38,7 @@ commander_1.program
|
|
|
36
38
|
.option('--dry-run', 'Simulate without generating files')
|
|
37
39
|
.option('--skip-lint', 'Skip post-generation linting and formatting')
|
|
38
40
|
.option('-s, --select-endpoints', 'Interactively select which tags and endpoints to generate')
|
|
41
|
+
.option('-k, --base-name <name>', 'Base name for generated folders (defaults to swagger filename)')
|
|
39
42
|
.option('-c, --config <file>', 'Use a JSON configuration file (skips interactive prompts)')
|
|
40
43
|
.option('--init-config [file]', 'Generate a JSON configuration file instead of generating code')
|
|
41
44
|
.parse(process.argv);
|
|
@@ -62,6 +65,8 @@ async function main() {
|
|
|
62
65
|
options.skipInstall = generationConfig.skipInstall;
|
|
63
66
|
if (generationConfig.skipLint !== undefined)
|
|
64
67
|
options.skipLint = generationConfig.skipLint;
|
|
68
|
+
if (generationConfig.baseName)
|
|
69
|
+
options.baseName = generationConfig.baseName;
|
|
65
70
|
(0, logger_1.logDetail)('config', `Using configuration file: ${configFile}`);
|
|
66
71
|
}
|
|
67
72
|
(0, logger_1.logDetail)('config', `Input: ${options.input}`);
|
|
@@ -71,6 +76,8 @@ async function main() {
|
|
|
71
76
|
(0, logger_1.logError)(`File not found: ${options.input}`);
|
|
72
77
|
process.exit(1);
|
|
73
78
|
}
|
|
79
|
+
const baseName = options.baseName ?? (0, name_formatter_1.deriveBaseName)(options.input);
|
|
80
|
+
(0, logger_1.logDetail)('config', `Base name: ${baseName}`);
|
|
74
81
|
if (options.dryRun) {
|
|
75
82
|
(0, logger_1.logWarning)('DRY RUN mode β no files will be generated');
|
|
76
83
|
}
|
|
@@ -109,6 +116,7 @@ async function main() {
|
|
|
109
116
|
return;
|
|
110
117
|
}
|
|
111
118
|
(0, filesystem_1.createDirectoryStructure)(options.output);
|
|
119
|
+
(0, example_validator_1.clearExampleMismatches)();
|
|
112
120
|
// ββ SELECTION: tags and endpoints βββββββββββββββββββββββββββββββββββββββββ
|
|
113
121
|
let selectionFilter = {};
|
|
114
122
|
let tagApiKeyMap;
|
|
@@ -150,10 +158,27 @@ async function main() {
|
|
|
150
158
|
}
|
|
151
159
|
// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
152
160
|
const tempDir = (0, dto_generator_1.generateCode)(options.input, options.templates);
|
|
153
|
-
|
|
154
|
-
(0,
|
|
155
|
-
(0, clean_arch_generator_1.
|
|
161
|
+
// Compute schemaβtag map before organizeFiles so DTOs land in the right subfolder
|
|
162
|
+
const tagsMapForSchema = (0, clean_arch_generator_1.buildTagsMapFromAnalysis)(analysis, selectionFilter);
|
|
163
|
+
const schemaTagMap = (0, clean_arch_generator_1.buildSchemaTagMap)(analysis.swagger.components
|
|
164
|
+
?.schemas || {}, tagsMapForSchema);
|
|
165
|
+
(0, dto_generator_1.organizeFiles)(tempDir, options.output, schemaTagMap, baseName);
|
|
166
|
+
(0, dto_generator_1.addDtoImports)(options.output, baseName);
|
|
167
|
+
(0, clean_arch_generator_1.generateCleanArchitecture)(analysis, options.output, options.templates, tagApiKeyMap, selectionFilter, schemaTagMap, baseName);
|
|
156
168
|
(0, filesystem_1.cleanup)(tempDir);
|
|
169
|
+
// ββ EXAMPLE/TYPE MISMATCH WARNINGS βββββββββββββββββββββββββββββββββββββββββ
|
|
170
|
+
const mismatches = (0, example_validator_1.getExampleMismatches)();
|
|
171
|
+
if (mismatches.length > 0) {
|
|
172
|
+
console.log('');
|
|
173
|
+
(0, logger_1.logWarning)(`${mismatches.length} example/type mismatch(es) detected in OpenAPI schemas:`);
|
|
174
|
+
for (const m of mismatches) {
|
|
175
|
+
const action = m.action === 'coerced'
|
|
176
|
+
? `β coerced to ${JSON.stringify(m.coercedValue)}`
|
|
177
|
+
: 'β example ignored, using type default';
|
|
178
|
+
(0, logger_1.logWarning)(` ${m.schemaName}.${m.propertyName}: type '${m.declaredType}' but example is ${m.exampleJsType} (${JSON.stringify(m.exampleValue)}) ${action}`);
|
|
179
|
+
(0, logger_1.logDetail)('VALIDATE', `${m.schemaName}.${m.propertyName}: declared=${m.declaredType} example=${JSON.stringify(m.exampleValue)} (${m.exampleJsType}) action=${m.action}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
157
182
|
const noLintResult = {
|
|
158
183
|
prettier: { ran: false, filesFormatted: 0 },
|
|
159
184
|
eslint: { ran: false, filesFixed: 0 }
|
|
@@ -170,6 +195,9 @@ async function main() {
|
|
|
170
195
|
console.log(` - Use Cases: ${report.structure.useCases}`);
|
|
171
196
|
console.log(` - Providers: ${report.structure.providers}`);
|
|
172
197
|
console.log(` - Mocks: ${report.structure.mocks}`);
|
|
198
|
+
if (report.warnings.total > 0) {
|
|
199
|
+
console.log(`\n ${logger_1.colors.yellow}β οΈ ${report.warnings.total} example/type mismatch(es) (see above)${logger_1.colors.reset}`);
|
|
200
|
+
}
|
|
173
201
|
console.log(`\nπ Files generated in: ${logger_1.colors.cyan}${options.output}${logger_1.colors.reset}\n`);
|
|
174
202
|
}
|
|
175
203
|
main().catch((error) => {
|