graphQuery for rich text fields

This question is a follow up as a result of the above question. We are forced to use graphQuery because we are unable to get groups inside of a group without graphQuery. As a result, I'm attempting to change our other queries so that we have a pattern in the way we query prismic. However, I appear unable to do some of the same things as before.

Specifically, I used fetchLinks before to get linked items in some of our richtext. I can't seem to find a way to "reach into" the rich text with graphQuery to have it get linked content that way. Below is an example:

document is the document type
paragraph is a slice type
text_block_paragraph is a rich text field
definition is a link type within the above text field

{
  document {
    ...documentFields
    body {
      ...on paragraph {
        non-repeat {
          ...non-repeatFields
          text_block_paragraph {
            definition
          }
        }
      }
    }
  }
}

The above query does not work. It gives a 400.

I have tried all sorts of different shapes but can not seem to access or do anything within the rich text field text_block_paragraph. It works just fine if I don't try and do anything within it but if I do anything inside it breaks.

There seems be answers to other questions regarding rich text that allude to this being possible but I can not find any guidance on the syntax to do so.

For extra reference, the fetchLinks query that works just fine looks something like:

{ 'fetchLinks': ['definition.definition'] }

Is this indeed possible? If so what is the syntax?

Thank you

Hi Jim,

What you're trying to do here isn't possible. You're only able to get the Rich Text field in its entirety.

I'm not sure I fully understand your use case, can you explain it in more detail?

Hi Phil,

The goal is to have all the queries be in the same sort of style. So instead of some using graphQuery, and some using fetchLinks, having them all be the same method. Also, ideally we are not making multiple calls and can get all the data we need for a page within one call.

There are links in some Rich Text fields, and getting those with fetchLinks works. However, since it's necessary for me to use graphQuery to get at a link within a group (as per the linked question), I'd like to convert all our queries to graphQuery.

Is this not possible?

Thanks,
Jim

If you're looking to reach the link inside something else that isn't in the repeatable zone. This isn't possible because text_block_paragraph would need to be a group

text_block_paragraph {
      definition
}

If your use case is having many links together, then the group field is the best way to go.