FormidableLabs / groqd

A schema-unaware, runtime and type-safe query builder for GROQ.
https://commerce.nearform.com/open-source/groqd
MIT License
230 stars 16 forks source link

Issue with objects with dynamic keys #294

Open adrian-at-stink opened 4 months ago

adrian-at-stink commented 4 months ago

Is there an existing issue for this?

Code of Conduct

Question

I have the following query

 q("products").filter().deref().grab({
        product_copy: q.string().nullable(),
        product_description: q.object({
          _type: q.string(),
          "en": q.string().optional().nullable(),
          "it": q.string().optional(),
          "fr": q.string().optional(),
          "de": q.string().optional(),
          "es": q.string().optional(),
          "ko": q.string().optional(),
          "ja": q.string().optional(),
          "zh": q.string().optional(),
          "zhhk": q.string().optional(),
          "ar": q.string().optional(),
        }),

i've hard coded the keys as I can't find a way to have these dynamic. Is this possible?