Skip to content

updateById is not triggering DB validaiton #7390

@patelmayankce

Description

@patelmayankce

Steps to reproduce

Current Behavior

My Field configuration

@property({
    type: 'string',
    required: true,
    jsonSchema: {
      minLength: 2,
      transform: ['trim'],
    },
  })
  name: string;

this.repository.create({ name: ' ' }) = > This throw an error which is good

this.repository.updateById(id, { name: ' ' }) = > This function directly bypass the validation configured in model

Expected Behavior

this.repository.updateById(id, { name: ' ' }) = > This method call should throw an error based on model configuration.

Additional information

Commands

  1. node -e 'console.log(process.platform, process.arch, process.versions.node)'
  2. npm ls --prod --depth 0 | grep loopback

Output

  1. darwin x64 12.16.1

├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── [email protected]
├── [email protected]

Related Issues

See Reporting Issues for more tips on writing good issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    RepositoryIssues related to @loopback/repository packagebug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions