Skip to content

PhoneNumber does not enforce E.164 as the docs say it should. #2891

@jonhester

Description

@jonhester

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Scalars package version under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug
PhoneNumber is incredibly lenient to the point that it does not enforce E.164 at all. It even allows for spaces, dashes, etc now. It was broken by the regex changing in https://github.com/graphql-hive/graphql-scalars/pull/2719/files#diff-7b580a994395c83b5489f2f0e1878d71af265ad8edb99f13ec7f3405d7ca02caL4.

Docs stating it validates E.164 for reference: https://the-guild.dev/graphql/scalars/docs/scalars/phone-number

To Reproduce Steps to reproduce the behavior:
123 is considered a valid phone number now. Pre the above commit it was not.

Expected behavior

Environment:

  • OS:
  • GraphQL Scalars Version:
  • NodeJS:

Additional context

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