Skip to content

bug: Mentor registration unsubmittable when UI-optional technical/focus areas are empty (backend @NotEmpty) #295

Description

@yingliu-data

Bug Report

Mentor registration cannot be submitted when the user leaves "technical areas" or "mentorship focus areas" empty — even though the UI presents these as optional — because the backend requires them.

  • Frontend src/schemas/mentorSchema.ts:107-134 declares technicalAreas and mentorshipFocusAreas as .optional().default([]), and the step components (Step3DomainSkills.tsx, Step4ProgrammingSkills.tsx) tell the user none are mandatory.
  • Backend domain/platform/mentorship/Skills.java declares both areas and mentorshipFocus as @NotEmpty, and MentorDto.skills is @NotNull @Valid.

Reproduction

A mentor completes the 5-step form selecting no technical areas (explicitly allowed by the UI) and submits → POST /api/platform/v1/mentors returns 400 with a validation error → the submission fails after the user has filled in the entire form.

The failure is made worse by the error-handling bug where the registration page reads errorData.error while the backend returns { message }, so the user sees only a generic "Failed to submit application" with no hint about the empty required fields.

Severity

High

Potential Risk

  • Mentors who follow the UI's guidance cannot register at all; drop-off after completing a long multi-step form.

Suggested Fix

Decide the intended contract and align both ends:

  • If these fields are truly required: make them required in the Zod schema and mark the steps as mandatory with inline validation before the final submit.
  • If they should be optional: relax the backend @NotEmpty constraints on Skills.areas/mentorshipFocus (and adjust any dependent logic).
  • Separately, fix the registration error handler to read body.message so the real validation error is surfaced.
  • Add an end-to-end test for a minimal mentor registration matching whichever contract is chosen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions