Joi: support non-array variant of alternatives().try()

This commit is contained in:
spiffytech
2016-04-26 13:12:33 -04:00
parent 42a3162e0b
commit 748690dd90
2 changed files with 2 additions and 0 deletions

View File

@@ -734,6 +734,7 @@ namespace common {
schema = Joi.alternatives();
schema = Joi.alternatives().try(schemaArr);
schema = Joi.alternatives().try(schema, schema);
schema = Joi.alternatives(schemaArr);
schema = Joi.alternatives(schema, anySchema, boolSchema);

1
joi/joi.d.ts vendored
View File

@@ -691,6 +691,7 @@ declare module 'joi' {
export interface AlternativesSchema extends AnySchema<FunctionSchema> {
try(schemas: Schema[]): AlternativesSchema;
try(type1: Schema, type2: Schema, ...types: Schema[]): AlternativesSchema;
when<T>(ref: string, options: WhenOptions<T>): AlternativesSchema;
when<T>(ref: Reference, options: WhenOptions<T>): AlternativesSchema;
}