You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is tricky to validate, given we want generally want to leverage lazy loading. When calling validate-schema, the following happens in order:
Laravel boots and calls service providers
Presumably, a service provider registers the programmatic types within TypeRegistry
The command is actually called
The schema files are loaded and parsed
Schema validation starts, traversing the schema starting from the root query types
A usage of MyEnum is encountered, triggering a call to the lazy type loader - which is TypeRegistry::get()
Since the programmatic type is already registered, the AST is never considered, thus no duplicate is detected
Lazy type loading is great for performance, we generally want to avoid loading all the types into the schema. During validation, we actually want that, but the order of registering the types and the mechanism of type loading makes it so that programmatic types have precedence and duplicates are undetected. I am sure we can fix this somehow, but we have to keep performance and convenience in mind.
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
php artisan lighthouse:validate-schema
The defined schema is valid.
Output/Logs
Click to expand
Lighthouse Version
4.18.0
The text was updated successfully, but these errors were encountered: