Skip to content

isWebsite does not support internal domains or ports #74

Description

@mdryden

Expected Behavior

Urls like "http://localhost:8000" or ""http://foo.com:8080" pass isWebsite() validator.

Actual Behavior

Any URL with a port or without a domain suffix will fail the regex matching.

Steps to Reproduce the Problem

  1. Create a string validator which uses isWebsite (eg: validate(MyCommand::myUrl).isNotEmpty().isWebsite()
  2. Pass it a value with a port or an internal domain name,

Example Code or Link to a Project

data class MyCommand(
    val url1: String,
    val url2: String,
) : BaseCommand() {
    init {
        validate(this) {
            validate(MyCommand::url1).isNotEmpty().isWebsite()
            validate(MyCommand::url2).isNotEmpty().isWebsite()
        }
    }
}

Json Payload

{
    "url1": "http://localhost/",
    "url2": "http://mydomain.com:8000"
}

Environment

  • Valiktor version: 0.12.0
  • JDK/JRE version: 17
  • Platform/OS: Windows

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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