Skip to content

Enums collisions are not detected when validating schema with native enums #1962

@crezra

Description

@crezra

Describe the bug
When using native enums, as showcased here https://lighthouse-php.com/master/the-basics/types.html#native-php-definition coupled with https://github.com/BenSampo/laravel-enum
Enum name collisions are not detected when running php artisan lighthouse:validate-schema

Expected behavior/Solution
Validating schema should detect enum name collisions when using native php enums

Steps to reproduce

  1. install https://github.com/BenSampo/laravel-enum
  2. create a new enum MyEnum.php
<?php

declare(strict_types=1);

namespace App\Enums;

use BenSampo\Enum\Enum;

class MyEnum extends Enum
{
    public const DONE = 'DONE';
}   
  1. create a new graphql enum with the same name
enum MyEnum {
    DONE
}
  1. run php artisan lighthouse:validate-schema
  2. Output is The defined schema is valid.
    Output/Logs
Click to expand
# Add in log output/error messages here

Lighthouse Version
4.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionRequires input from multiple people

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions