Skip to content

feature: Add @IsIataCityCode decorator to validate 3-letter IATA city codes #2659

@tropical-coder

Description

@tropical-coder

Description

The library currently lacks a built-in validator for IATA 3-letter codes, which are the standard for city and airport identification in travel and logistics (e.g., NYC, LHR). Developers currently have to reimplement regex pattern matching manually or maintain their own lists of valid codes.

Proposed solution

Add a new @IsIataCityCode() decorator.

This validator should go beyond simple regex matching and verify the existence of the code.

  1. Format Check: Ensure the input is a 3-letter uppercase string.
  2. Validity Check: Validate the input against an internal array/set of known active IATA codes (e.g., derived from OpenTravelData or similar open datasets) to ensure the city/airport actually exists.

Example:

@IsIataCityCode()
city: string; 
// Valid: "KHI" (Karachi), "LHE" (Lahore)
// Invalid Format: "ny", "Karachi"
// Invalid Code: "ZZZ" (Correct format, but no such IATA code exists)

Metadata

Metadata

Assignees

No one assigned

    Labels

    flag: needs discussionIssues which needs discussion before implementation.type: featureIssues related to new features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions