whefter / nestjs-joi

Easy to use JoiPipe as an interface between joi and NestJS with optional decorator-based schema construction.
MIT License
25 stars 12 forks source link

nest-joi does not validate when dto is in another project #22

Open cursomeancore opened 1 year ago

cursomeancore commented 1 year ago

Hello,

I have a project that uses a local dependency via npm link. Everything works fine except when I move the dto files to the local dependency in another project. The JoiSchemaOptions and JoiSchema decorators don't seem to have any effect when I import from the local dependency

// local dependency
@JoiSchemaOptions({
  allowUnknown: false,
})
export class ExampleDto {

  @JoiSchema([CREATE], Joi.email().required())
  email!: string;
}
// main proyect
import { ExampleDto } from '@example/example-common/dto/example.dto';

/*... */

@Post()
async signUp(@Body() exampleDto : ExampleDto) {
  // validation doesn't work
}

Thanks

whefter commented 1 year ago

Hi,

can you please create a minimal reproduction repo? This might have nothing to do with the module itself.