You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today the only way to slice the variable and validate each element is using a custom validatior inner a Joi.string() method like this:
import{Module}from'@nestjs/common';import{ConfigModule}from'@nestjs/config';importJoifrom'joi';
@Module({imports: [ConfigModule.forRoot({validationSchema: Joi.object({CACHE_URL: Joi.string().default('nats://localhost:4222').custom((value,helpers)=>{consturis=value.split(',').map((uri: string)=>uri.trim());for(consturiofuris){const{error}=Joi.string().uri().validate(uri);if(error)returnhelpers.error('any.invalid');}returnuris;}).messages({'any.invalid': "Each URI in CACHE_URL must be a valid list of URI's"});}),}),],})exportclassCacheModule{}
Do you have a new or modified API suggestion to solve the problem?
Maybe create a method .convert() to transform the current validation value and state into another Joi schema validation pipeline, like this:
Runtime
node.js
Runtime version
20.17.0
Module version
17.13.3
Used with
@nestjs/config
Any other relevant information
No response
What problem are you trying to solve?
Today I need to pass a list of uri's in a environment variable like this:
Today the only way to slice the variable and validate each element is using a custom validatior inner a Joi.string() method like this:
Do you have a new or modified API suggestion to solve the problem?
Maybe create a method
.convert()
to transform the current validation value and state into another Joi schema validation pipeline, like this:The text was updated successfully, but these errors were encountered: