Commit Graph

15 Commits

Author SHA1 Message Date
1d52da3805 test: assert repository call with specific parameters in observable completion
All checks were successful
Lint / lint (pull_request) Successful in 14s
2026-03-26 13:16:41 +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
99658800ed feat: ensure required fields are marked with '!' in generated model entities 2026-03-25 11:15:37 +01:00
didavila
917cc3b9cf feat: add mock generation for DTOs, models, and repositories with corresponding templates 2026-03-25 11:01:21 +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
ca63b85086 refactor: remove unused imports section from model template 2026-03-24 16:31:17 +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
82b734bc55 fix: correct import paths in use cases provider and update response mapping in repository implementation 2026-03-24 15:37:34 +01:00
didavila
fc3d95052c fix: update import paths for repository and mapper templates 2026-03-24 15:15:06 +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
9805a14111 fix: refactor providers to use makeEnvironmentProviders 2026-03-23 16:28:30 +01:00
didavila
4905f84d2c fix: fix template variable wrapping to fit java requirements 2026-03-23 15:06:11 +01:00
Blas Santome Ocampo
5ff88d8cf6 first commit 2026-03-23 09:35:15 +01:00