Closed esizer closed 1 week ago
Also, not that it is a huge issue but we could do this for regular enums as well :thinking: Right now we just copy and paste the same code and rename it for every enum we want to register.
Assuming we keep them fairly standard or write a contract, we could auto register anything in App\Enum
:thinking:
♻️ Debt/Refactor
Provide a way to discover all localized enums and implment it in the graphql provider registration.
🕵️ Details
With the move of localized enums to the server, we now need to register them a little differently in
lighthouse-php
graphql schema. Currently, we use a hard coded array of these enums to loop over. Unfortunately, this is going to be annoying to maintain and is open to human error.We would like a way to discover all the enums that have been localized and simply loop over those so they get registered automatically assuming they implement the
HasLocalization
trait.🙋♀️ Proposed Solution
@petertgiles found a package (
spatie/php-structure-discoverer
) that seems like it would be a good fit for this.✅ Acceptance Criteria
GraphQLServiceProvider