Commit Graph

21 Commits

Author SHA1 Message Date
79ea7dfc7e feat: enhance logging and linting functionality with detailed reports
All checks were successful
Lint / lint (pull_request) Successful in 16s
2026-03-26 13:03:10 +01:00
didavila
d47afb6ff1 fix: body param and 2xx response codes in repository generation
All checks were successful
Lint / lint (pull_request) Successful in 31s
Bug 1 - Body as positional argument (api.repository.impl.mustache):
MRepository HTTP methods accept a single RequestOptions object as second
argument. The template was incorrectly passing body as a separate positional
argument (e.g. this.post('/url', body)), causing:
  'Type X has no properties in common with type RequestOptions'
Fix: merge body into the options object using ES6 shorthand { body }, and
introduce hasOptions / hasBothParamsAndBody flags to build a single unified
options literal covering all scenarios:
  - no options    → this.post('/url')
  - params only   → this.get('/url', { params: { search } })
  - body only     → this.post('/url', { body })
  - params + body → this.post('/url', { params: { search }, body })

Bug 2 - Only 200 responses read (clean-arch.generator.ts):
The generator was hardcoded to read op.responses['200'], silently ignoring
201 Created, 202 Accepted, etc. POST endpoints returning 201 were generated
as Observable<void> instead of their actual return type.
Fix: resolve the first available success code from [200, 201, 202, 203].

New fields added to TagOperation type:
  - uppercaseHttpMethod: string
  - hasOptions: boolean
  - hasBothParamsAndBody: boolean

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 11:17:37 +01:00
didavila
463626da0c feat: add .spec.ts generation for models, mappers, repositories and use-cases
Add 4 new Mustache templates for generating unit test specs:
- model-entity.spec.mustache: tests instantiation, property setting, mock builder
- mapper.spec.mustache: tests per-property DTO→Entity mapping, instanceof, all fields
- api.repository.impl.spec.mustache: tests HTTP method, response mapping, error propagation
- api.use-cases.impl.spec.mustache: tests repository delegation, observable forwarding

Generator changes:
- Add uppercaseHttpMethod to TagOperation for spec HTTP assertions
- Add testValue to TagOperationParam for auto-generated test arguments
- Add resolveTestParamValue utility for primitive/complex type test literals
- Add specs counter to GeneratedCount and GenerationReport
- Wire 4 new renderTemplate calls in schema and tag loops
- Update report generator to count .spec.ts files

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 10:52:58 +01:00
didavila
9c14a070c6 feat: add linting option and implement linting for generated TypeScript files 2026-03-25 11:10:08 +01:00
didavila
917cc3b9cf feat: add mock generation for DTOs, models, and repositories with corresponding templates 2026-03-25 11:01:21 +01:00
f09e19265b Merge branch 'main' into feat/translate-to-english
All checks were successful
Lint / lint (pull_request) Successful in 5m58s
2026-03-25 08:25:23 +00:00
didavila
5f34aa2f89 feat: translate comments and logs to English for better accessibility 2026-03-25 08:44:39 +01:00
dd6bb3e755 Merge branch 'main' into fix/fix-lint
Some checks failed
Lint / lint (pull_request) Failing after 5m58s
# Conflicts:
#	main.ts
2026-03-25 08:35:49 +01:00
700597a9e8 fix: fix lint in files and add a pipe for checking
All checks were successful
Lint / lint (pull_request) Successful in 10m28s
2026-03-25 08:33:10 +01:00
b8d2fd8582 feat: add tag/endpoint selection mechanism 2026-03-24 19:51:48 +01:00
a90f7ba078 feat: add base url mechanism 2026-03-24 19:28:28 +01:00
4aeb108c55 feat: add base url mechanism 2026-03-24 19:15:47 +01:00
didavila
5229a3ad45 refactor: separate return and param imports in Clean Architecture generator 2026-03-24 16:40:34 +01:00
didavila
e008144813 refactor: normalize array type notation from Array<T> to T[] in generators and type mapper 2026-03-24 16:27:10 +01:00
didavila
e8c919ee76 feat: collect and render model imports for referenced types in Clean Architecture generation 2026-03-24 16:02:17 +01:00
didavila
a97c3b22fa feat: enhance TagOperation interface with detailed parameter structure and update return type handling in generator 2026-03-24 15:52:11 +01:00
didavila
031bdb4b3a feat: add classVarName to operations in generateCleanArchitecture function 2026-03-24 15:44:10 +01:00
didavila
f4d9340137 feat: add returnTypeVarName and returnBaseTypeVarName to TagOperation interface and update generator function 2026-03-24 15:37:26 +01:00
didavila
3fe2333a03 feat: implement toCamelCase utility function and update Clean Architecture generator to use it 2026-03-24 15:12:52 +01:00
didavila
d1bcf06439 feat: Add DTO imports processing and update model template for cleaner architecture 2026-03-24 12:20:50 +01:00
didavila
bd67e6c6d1 feat: Implement Clean Architecture code generation with Mustache templates
- Added `clean-arch.generator.ts` for generating models, mappers, repositories, use cases, and providers based on OpenAPI specs.
- Introduced `dto.generator.ts` to invoke `openapi-generator-cli` for generating DTOs and organizing them.
- Created `report.generator.ts` to generate a JSON report of the generation process.
- Implemented `analyzer.ts` for parsing OpenAPI/Swagger files and extracting relevant data.
- Defined new types in `cli.types.ts`, `generation.types.ts`, `openapi.types.ts`, and `swagger.types.ts` for better type safety.
- Added utility functions in `filesystem.ts` for creating directory structures and cleaning up temporary files.
- Developed logging utilities in `logger.ts` for better console output.
- Included OpenAPI generator checks and installation in `openapi-generator.ts`.
- Added type mapping utility in `type-mapper.ts` for converting OpenAPI types to TypeScript types.
- Updated `package.json` scripts to lint all TypeScript files.
- Modified `tsconfig.json` to include all TypeScript files in the project.
2026-03-24 11:16:45 +01:00