GCTC-NTGC / gc-digital-talent

GC Digital Talent is the new recruitment platform for digital and tech jobs in the Government of Canada. // Talents numériques du GC est la nouvelle plateforme de recrutement pour les emplois numériques et technologiques au gouvernement du Canada.
https://talent.canada.ca
GNU Affero General Public License v3.0
16 stars 7 forks source link

♻️ Make localized enums discoverable #10861

Closed esizer closed 1 week ago

esizer commented 2 weeks ago

♻️ 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

esizer commented 2 weeks 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: