Skip to content

Commit

Permalink
Read decorator style length requirements from parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
cdupuis committed Jun 9, 2020
1 parent 3b9513c commit 73cf7ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/api/context/parameterPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ export function commandRequestParameterPromptFactory<T>(ctx: HandlerContext): Pa
continue;
}
// Verify minLength
if (parameterDefinition.minLength !== undefined && !!value && value.length < parameterDefinition.minLength) {
const minLength = parameterDefinition.minLength || (parameterDefinition as any).min_length;
if (minLength !== undefined && !!value && value.length < minLength) {
requiredMissing = true;
continue;
}
// Verify maxLength
if (parameterDefinition.maxLength !== undefined && !!value && value.length > parameterDefinition.maxLength) {
const maxLength = parameterDefinition.maxLength || (parameterDefinition as any).max_length;
if (maxLength !== undefined && !!value && value.length > maxLength) {
requiredMissing = true;
continue;
}
Expand Down

0 comments on commit 73cf7ae

Please sign in to comment.