diff --git a/packages/example-getting-started/src/controllers/todo.controller.ts b/packages/example-getting-started/src/controllers/todo.controller.ts index aad4865d16cf..2e58030c68fa 100644 --- a/packages/example-getting-started/src/controllers/todo.controller.ts +++ b/packages/example-getting-started/src/controllers/todo.controller.ts @@ -43,6 +43,12 @@ export class TodoController { @param.body('todo', TodoSchema) todo: Todo, ): Promise { + // REST adapter does not coerce parameter values coming from string sources + // like path & query. As a workaround, we have to cast the value to a number + // ourselves. + // See https://github.com/strongloop/loopback-next/issues/750 + id = +id; + return await this.todoRepo.replaceById(id, todo); } @@ -52,6 +58,12 @@ export class TodoController { @param.body('todo', TodoSchema) todo: Todo, ): Promise { + // REST adapter does not coerce parameter values coming from string sources + // like path & query. As a workaround, we have to cast the value to a number + // ourselves. + // See https://github.com/strongloop/loopback-next/issues/750 + id = +id; + return await this.todoRepo.updateById(id, todo); }