Skip to content

[bug]: Missing email validation in harbor user create command #815

@PrasunaEnumarthy

Description

@PrasunaEnumarthy

Description

The harbor user create command accepts an --email flag but does not validate the input format before sending the request to the API.

Currently, invalid email values are accepted by the CLI and passed directly to the Harbor API, resulting in delayed API errors instead of early validation at the CLI level

Steps to Reproduce

Run the following command with an invalid email:

harbor user create --username bob --password Secret123! --email "not_an_email" 

Expected Behavior

The CLI should validate the email format locally and return a clear error message before making the API request.

Example:

Error: invalid email format

Actual Behavior

The CLI accepts the invalid email and sends the request to the API, which may result in a less clear or delayed error response.

Environment

  • OS: Any
  • Tool version: Latest (or current main branch)
  • Other relevant details: Not environment-specific

Additional Context

Adding early validation improves CLI usability by:

  • Preventing unnecessary API calls
  • Providing faster feedback to users
  • Aligning with existing validation patterns in other commands

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions