Skip to content

Validator URL is not allowing a valid URL #61236

@andrefpoliveira

Description

@andrefpoliveira

Symfony version(s) affected

7.3.1

Description

I understand that it is a weird format, Chrome is able to open the following format:
https://example.com:/something/here

However, the validator throws an error saying that it is not valid.

Is it possible to change this behavior? I don't mind contributing with a PR if you think this change makes sense

How to reproduce

<?php

declare(strict_types=1);

use OpenApi\Attributes as OpenApi;
use Symfony\Component\Validator\Constraints as Assert;

#[OpenApi\Schema]
readonly class Dto
{
    public function __construct(
        #[Assert\Url]
        public ?string $url,
    ) {
    }
}

Possible Solution

Make the port part optional? Maybe switch from (:[0-9]+)? to (:[0-9]*)??

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy