Files
openapi-clean-arch-gen/templates
didavila d47afb6ff1
All checks were successful
Lint / lint (pull_request) Successful in 31s
fix: body param and 2xx response codes in repository generation
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
..