Skip to content

[BUG] Country field accepts numeric input instead of validating names #1301

Description

@saidai-bhuvanesh

Bug Description

The country field in job search accepts numeric values instead of validating country names.

Affected Code

Job search form or validation

Issue

  1. Country field expected to be string
  2. Accepts numbers
  3. Passes to API that expects country codes
  4. Jobs search fails

Impact

  • Invalid API calls
  • Confusing errors
  • Poor UX

Suggested Fix

Validate country input:

const validCountries = ['US', 'GB', 'CA', 'AU', 'DE', 'FR'];

const jobSearchSchema = z.object({
  country: z.string()
    .length(2)
    .refine(val => validCountries.includes(val.toUpperCase()), {
      message: 'Invalid country code'
    })
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions