Skip to content

fix: 의견 수합 폼 스키마 검증 로직 개선#96

Merged
youngminss merged 10 commits intodevelopfrom
hotfix/fix-nickname-validation
Feb 20, 2026
Merged

fix: 의견 수합 폼 스키마 검증 로직 개선#96
youngminss merged 10 commits intodevelopfrom
hotfix/fix-nickname-validation

Conversation

@RookieAND
Copy link
Collaborator

@RookieAND RookieAND commented Feb 20, 2026

🎯 PR 제목

fix: 의견 수합 폼 스키마 검증 로직 개선 (Hotfix Task)

📑 작업 상세 내역

  • 버그 수정

    • preferredMenus 스키마 타입 에러를 수정합니다
  • 리팩토링

    • preferredMenus 검증에 isUndefined 유틸을 사용합니다
    • 개별 스키마를 export하여 컴포넌트에서 직접 사용합니다
    • NicknameStep에서 사용하지 않는 import를 제거합니다
    • DistanceStep에서 스키마 기반 validation을 적용합니다
    • DislikeStep에서 스키마 기반 validation을 적용합니다
    • PreferenceStep에서 스키마 기반 validation을 적용합니다

🙏 리뷰 요청 사항

  • preferredMenus의 first 필드가 optional로 변경되었지만 refine으로 검증되는지 확인해주세요
  • 각 Step 컴포넌트에서 스키마 기반 validation이 올바르게 동작하는지 테스트해주세요
  • useWatch compute 패턴이 일관성 있게 적용되었는지 확인해주세요

📃 참고 자료

  • 변경된 스키마:
    • preferredMenusSchema: first를 optional로 변경 + refine 검증 추가
    • distanceRangeSchema, dislikedFoodSchema export 추가
  • 적용된 패턴:
    • getValues 제거 → useWatch compute에서 값 직접 추출
    • 수동 검증 로직 제거 → schema.safeParse() 사용

🖼️ 작업 결과물

  • TypeScript 타입 에러 해결 (omit으로 first 제거 시 발생하던 에러)
  • 일관된 validation 패턴 적용 (모든 Step에서 스키마 기반 검증)
  • 불필요한 getValues 호출 제거로 코드 간소화

semantic-release-bot and others added 8 commits February 19, 2026 16:31
## [1.3.0](v1.2.0...v1.3.0) (2026-02-19)

### Features

* Calendar 및 BottomSheet 컴포넌트 구현 ([#85](#85)) ([afd5007](afd5007)), closes [#848B9C](https://github.com/Nexters/yogieat/issues/848B9C)
* 랜딩 페이지 일러스트레이션을 Lottie 애니메이션으로 교체 ([#92](#92)) ([11d70f2](11d70f2))
- first 필드를 optional로 변경하여 omit 사용 시 타입 에러 해결
- refine으로 최소 1개 선택 검증 추가
- preferredMenusSchema export 추가

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- distanceRangeSchema.safeParse로 검증
- useWatch compute에서 값 직접 가져오기
- getValues 제거

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- dislikedFoodSchema.safeParse로 검증
- useWatch compute에서 값 직접 가져오기
- getValues 제거

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- preferredMenusSchema.safeParse로 검증
- useWatch compute에서 값 직접 가져오기
- getValues 제거

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@RookieAND RookieAND added the 🐞 Fix 버그 수정 및 이슈 해결 label Feb 20, 2026
@RookieAND RookieAND self-assigned this Feb 20, 2026
@RookieAND RookieAND requested a review from youngminss February 20, 2026 11:50
@github-actions github-actions bot added 🐞 Fix 버그 수정 및 이슈 해결 and removed 🐞 Fix 버그 수정 및 이슈 해결 labels Feb 20, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @RookieAND, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 의견 수합 폼의 스키마 유효성 검증 로직을 전반적으로 개선합니다. preferredMenus 스키마의 타입 에러를 해결하고, 각 폼 단계에서 스키마 기반의 일관된 유효성 검증 패턴을 적용하여 코드의 안정성과 가독성을 향상시켰습니다. 불필요한 getValues 호출을 제거하고 개별 스키마를 노출함으로써 컴포넌트의 유효성 검증 로직을 간소화했습니다.

Highlights

  • 스키마 타입 에러 수정 및 검증 로직 개선: preferredMenus 스키마의 타입 에러를 수정하고, 'first' 필드가 선택 사항이 되면서 'refine' 검증 로직을 추가하여 유효성 검사를 강화했습니다.
  • 개별 스키마 외부 노출: nicknameSchema, distanceRangeSchema, dislikedFoodSchema, preferredMenusSchema 등 개별 스키마를 외부로 노출하여 각 컴포넌트에서 직접 활용할 수 있도록 개선했습니다.
  • 스키마 기반 유효성 검증 적용: NicknameStep, DistanceStep, DislikeStep, PreferenceStep 컴포넌트에서 useWatch의 compute 함수 내에서 schema.safeParse()를 사용하여 스키마 기반의 유효성 검증 로직을 적용했습니다.
  • useWatch compute 패턴 일관성 확보: 폼 값을 가져오기 위해 getValues를 호출하는 대신 useWatch의 compute 패턴을 활용하여 값을 직접 추출하도록 변경하여 코드의 일관성과 간결성을 높였습니다.
  • 불필요한 코드 제거: NicknameStep에서 사용하지 않는 isUndefined 유틸리티 import를 제거했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/pageComponents/gathering/opinion/DislikeStep.tsx
    • dislikedFoodSchema를 임포트하고, getValues 호출을 제거하며, useWatch의 compute 로직을 스키마 기반 유효성 검증으로 업데이트했습니다.
  • src/pageComponents/gathering/opinion/DistanceStep.tsx
    • isUndefined 임포트를 제거하고, distanceRangeSchema를 임포트하며, getValues 호출을 제거하고, useWatch의 compute 로직을 스키마 기반 유효성 검증으로 업데이트했습니다.
  • src/pageComponents/gathering/opinion/NicknameStep.tsx
    • isUndefined 임포트를 제거하고, nicknameSchema를 임포트하며, useWatch의 compute 로직을 스키마 기반 유효성 검증으로 업데이트했습니다.
  • src/pageComponents/gathering/opinion/PreferenceStep.tsx
    • preferredMenusSchema를 임포트하고, getValues 호출을 제거하며, useWatch의 compute 로직을 스키마 기반 유효성 검증으로 업데이트했습니다.
  • src/schemas/gathering/index.ts
    • nicknameSchema, dislikedFoodSchema, distanceRangeSchema, preferredMenusSchema 등 새로운 개별 스키마들을 외부로 노출하도록 추가했습니다.
  • src/schemas/gathering/opinionForm.schema.ts
    • isUndefined 유틸리티를 임포트하고, distanceRangeSchema를 외부로 노출하도록 변경했으며, opinionFormSchema 내부에 정의되어 있던 스키마들을 nicknameSchema, dislikedFoodSchema, preferredMenusSchema로 분리하여 외부로 노출했습니다. 또한, preferredMenusSchema에 first 필드가 정의되었는지 확인하는 refine 검증 로직을 추가했습니다.
Activity
  • 이 PR에는 아직 어떠한 활동도 기록되지 않았습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@RookieAND RookieAND added the ☑️ Need Review 작업이 완료되어 리뷰를 기다리고 있는 PR 입니다 label Feb 20, 2026
@github-actions github-actions bot added 🐞 Fix 버그 수정 및 이슈 해결 and removed 🐞 Fix 버그 수정 및 이슈 해결 labels Feb 20, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 PR은 의견 수합 폼의 각 단계에서 사용되는 유효성 검사 로직을 개선하는 내용을 담고 있습니다. Zod 스키마를 기반으로 유효성 검사를 수행하도록 리팩토링되었으며, 이를 위해 공통 스키마를 여러 개의 작은 스키마로 분리하고 각 컴포넌트에서 직접 사용하도록 변경되었습니다. 코드 변경 사항은 전반적으로 긍정적이며, 유효성 검사 메시지의 오타 수정에 대한 한 가지 의견을 남겼습니다.

.string()
.trim()
.min(1, "이름을 입력해주세요")
.max(8, "이름은은 8자 이내로 입력해주세요")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

닉네임 유효성 검사 에러 메시지에 오타가 있습니다. '이름은은'을 '이름은'으로 수정하는 것이 좋겠습니다.

Suggested change
.max(8, "이름은은 8자 이내로 입력해주세요")
.max(8, "이름은 8자 이내로 입력해주세요")

Comment on lines +49 to 56
const { nickname, disabled } = useWatch({
control,
name: "nickname",
compute: (nickname) => ({
nickname,
disabled: !nicknameSchema.safeParse(nickname).success,
}),
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

각 Step 별로 별도의 인증 로직을 작성하지 말고, Zod Schema 를 활용한 Validation 으로 유효성 검사를 진행하도록 역할 위임

message: '"상관없음"은 다른 음식과 함께 선택할 수 없습니다.',
}),
preferredMenus: z.object({
export const nicknameSchema = z
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NOTE]
추후 각 Form 의 Schema 에 대해서는 아래와 같이 수정 예정

  1. refactor: 타입 정의를 enum으로 통일하여 타입 안정성 개선 #95 에서 진행 중인 Enum 타입을 적용하여 z.enum 반영
  2. 각 문항 별 Validation 을 z.refine 으로 작성하여 커스텀 Rule 반영
  3. 각 스텝 별 Footer 에 zodObject.safeParse 메서드로 유효성 검사하도록 반영

@youngminss youngminss changed the base branch from main to develop February 20, 2026 15:16
@youngminss
Copy link
Member

@RookieAND
사용하지 않는 컴포넌트 제거, 이름 입력 step 은 StepIndicator 제거해야한다는 요구사항 누락된 것 추가했으니 참고해줘~
87b6ffe

@youngminss youngminss merged commit 447cc7f into develop Feb 20, 2026
3 checks passed
@youngminss youngminss removed the ☑️ Need Review 작업이 완료되어 리뷰를 기다리고 있는 PR 입니다 label Feb 20, 2026
github-actions bot pushed a commit that referenced this pull request Feb 20, 2026
## [1.3.0-beta.2](v1.3.0-beta.1...v1.3.0-beta.2) (2026-02-20)

### Features

* 지역 선택 스텝 신규 지역 chip 5개 추가 ([#97](#97)) ([98d2575](98d2575))

### Bug Fixes

* 의견 수합 폼 스키마 검증 로직 개선 ([#96](#96)) ([447cc7f](447cc7f))
github-actions bot pushed a commit that referenced this pull request Feb 20, 2026
## [1.4.0](v1.3.0...v1.4.0) (2026-02-20)

### Features

* 지역 선택 스텝 신규 지역 chip 5개 추가 ([#97](#97)) ([98d2575](98d2575))

### Bug Fixes

* 의견 수합 폼 스키마 검증 로직 개선 ([#96](#96)) ([447cc7f](447cc7f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 Fix 버그 수정 및 이슈 해결

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants