GraphQL fragment matcher

I have been working on utilizing the dynamic zone component using graphql fragments. I have been working off the tutorial and after having hit roadblock after roadblock (which forced me to get a better understanding of fragments and unions as im a noob!) i still havent managed to get things working.

Since i couldnt get things to work, i took a test run off the repo provided (which is genius btw!) which works as intended after some package updates.

However, in my own project my fragmentTypes.json seems to render very differently and is subsequently trowing me an error “Cannot read property ‘types’ of undefined”.

Excerpt of the repo’s fragmentTypes.json:

{
  "__schema": {
    "types": [
      {
        "kind": "UNION",
        "name": "Morph",
        "possibleTypes": [
          {
            "name": "UsersPermissionsMe"
          },
          {
            "name": "UsersPermissionsMeRole"
          }, 

          Etcetera

      {
        "kind": "UNION",
        "name": "PagesPageZoneDynamicZone",
        "possibleTypes": [
          {
            "name": "ComponentPostQuote"
          },
          {
            "name": "ComponentPostImage"
          },
          {
            "name": "ComponentPostRichText"
          }
        ]
      }

And the fragmentTypes.json rendered in my own project (notice how it is missing the " __schema" & “types” decleration:

{
  "possibleTypes": {
    "CollectionPageZoneDynamicZone": [
      "ComponentDynamicImageAndText",
      "ComponentDynamicImageSlider",
      "ComponentDynamicRichText"
    ],
    "GqlfragmentPageZoneDynamicZone": [
      "ComponentDynamicImageAndText",
      "ComponentDynamicImageSlider",
      "ComponentDynamicRichText"
    ],
    "Morph": [
      "UsersPermissionsMe",
      "UsersPermissionsMeRole",
      "UsersPermissionsLoginPayload",
      "UserPermissionsPasswordPayload",
      "Collection",
      Etcetera

In my reading up on the topic, i found that since apollo ^3.0 there has been a change in decleration and use of fragments, maybe that has something to do with it?
V2 fragment docs
^V3 fragment docs

Any help would be greatly appreciated!

I made some progress:

Instead of running the “generate” build script, i ran: “yarn -graphql-codegen” and it seemed to render a working possibleTypes schema!

TIme to fiddle in the frontend now :crazy_face:

Back at this… Been having a really weird bug where the collection ID is not being fetched in the dom (i think?)

So, started from a fresh boilerplate repo building back the codegen add-ons… Now cant get a properly rendered fragmentTypes.json again…

bashes head against a keyboard

Small update after lots of trial and error:

Used old graphql codegen packages, as per versions used in the tutorial repo; getting a proper rendered possibleTypes.json again.
So i definitely have issues declaring the proper config file for apollo 3.0