Skip to content

Feature/18

Flupsi requested to merge feature/18 into dev

For some fun prehistory, check out #18 (comment 42006)

The idea is to derive an exhaustive query from the mirrored schema.graphql -> #18

This was partially successful: At the frontend, we can now ask by string for any top-level query field and get a typed result. I have implemented this for posts, policies and pages.

I was not successful at merging all possible top-level queries into one, which was my original goal.

With type introspection, it would be possible to generalize the query generator or generate a total query, but that would require some typescript skills.

The partial solution means:

  • Top-level fields (a.k.a. directus collections) have to be named explicitly by the frontend.
  • When collections are renamed in directus, we get a type error (good)
  • When new collections are added, the frontend dev won't get any automatic notification (discoverability), so in that rare case, someone needs to tell them, and then the frontend dev can check the extended schema and add the new collection name into the typescripts (acceptable)

I'd say: not super hot, but close enough, so let's merge.

Edited by Flupsi

Merge request reports