Graphql custom pagination

Hello, I have my schema as follows:

type Procedure {
title: String
detail: [ProcedureTranslation]

type ProcedureTranslation {
description: String
language: String

so I would want to only retrieve a procedure with only the current language provided, something like

  findProcedureByID(id: "dummyIDforExample"){
    detail(filter: { language: "DE" }){

This way I can retrieve only those with “DE” language (ideally just one)

for what I have read so far, maybe defining a @resolver with a UDF from the top would be the way, so I can have something like findProcedureByIdAndLanguage(id, lang)... so I can find the Procedure, and attach de ProcedureTranslation in the way

is that the only way to go? or can I have like a custom resolver called in a nested list element?

besides that, if I make this UDF, do I have to specify the Collection name? is there something like “use the collection you’re been attached to” ???

if you want to suggest me another approach to handle the multi-language in a better way, I’m open to ideas since I’m just starting this project

Thanks in advance!

Hi @whitte!

It is not possible to provide a custom resolver for fields in a user-defined type. But I am with you, that is something I wish we had.

So creating a top-level Query field with a custom resolver is the way to go.

1 Like