fix: [item-master] 필드 수정 422 유효성 검증 오류 수정
- field_key regex를 숫자 시작도 허용하도록 변경 (기존 데이터 39건 호환) - Handler.php 422 응답에 errors 최상위 필드 추가 (프론트엔드 호환)
This commit is contained in:
@@ -84,6 +84,7 @@ public function render($request, Throwable $exception)
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '입력값 검증 실패',
|
||||
'errors' => $exception->errors(),
|
||||
'error' => [
|
||||
'code' => 422,
|
||||
'details' => $exception->errors(),
|
||||
|
||||
@@ -16,7 +16,7 @@ public function rules(): array
|
||||
return [
|
||||
'group_id' => 'nullable|integer',
|
||||
'field_name' => 'required|string|max:255',
|
||||
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/',
|
||||
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z0-9][a-zA-Z0-9_]*$/',
|
||||
'field_type' => 'required|in:textbox,number,dropdown,checkbox,date,textarea',
|
||||
'is_required' => 'nullable|boolean',
|
||||
'default_value' => 'nullable|string',
|
||||
|
||||
@@ -16,7 +16,7 @@ public function rules(): array
|
||||
return [
|
||||
'group_id' => 'nullable|integer|min:1', // 계층번호
|
||||
'field_name' => 'required|string|max:255',
|
||||
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/',
|
||||
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z0-9][a-zA-Z0-9_]*$/',
|
||||
'field_type' => 'required|in:textbox,number,dropdown,checkbox,date,textarea',
|
||||
'is_required' => 'nullable|boolean',
|
||||
'default_value' => 'nullable|string',
|
||||
|
||||
@@ -15,7 +15,7 @@ public function rules(): array
|
||||
{
|
||||
return [
|
||||
'field_name' => 'sometimes|string|max:255',
|
||||
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/',
|
||||
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z0-9][a-zA-Z0-9_]*$/',
|
||||
'field_type' => 'sometimes|in:textbox,number,dropdown,checkbox,date,textarea',
|
||||
'is_required' => 'nullable|boolean',
|
||||
'default_value' => 'nullable|string',
|
||||
|
||||
Reference in New Issue
Block a user