2016-10-24 2 views
0

유효하지 않은 입력에 대한 오류 메시지를 사용자 정의하는 방법은 무엇입니까?유효하지 않은 입력에 대한 오류 메시지를 사용자 정의하는 방법은 무엇입니까?

{ 
    "$schema": "http://json-schema.org/draft-04/schema#", 
    "type": "object", 
    "properties": { 
    "username": { 
     "type": "string", 
     "pattern": "^[A-Za-z0-9-_.]+$", 
     "minLength": 3 
    }, 
    "password": { 
     "type": "string", 
     "minLength": 8, 
     "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d\\W]$" 
    } 
    }, 
    "required": [ 
    "username", 
    "password" 
    ], 
    "errors": [ 
    { 
     "property": "username", 
     "message": "min 3 characters, do not use spaces or special characters" 
    } 
    ] 
} 

예를 들어, 사용자 이름 입력이 불필요 분 길이 또는 정규식 패턴 지정 오류 메시지가 지원되지 min 3 characters, do not use spaces or special characters

답변

1

디스플레이 하나 지정 메시지를 만족하지 않는 경우. 그러나 다음 버전의 JSON Schema에서 이와 같은 기능을 추가하기위한 논의가 진행 중입니다.

관련 문제