feat: add specs generator & fix body params #49
Reference in New Issue
Block a user
Delete Branch "feat/add-specs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves: #36
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>