Thunking is a way of deferring evaluation, so for instance you can specify a GraphQL thing that has a field that's an array of those same things even though at that moment the "thing" isn't valid yet.
I need to convert this schema to Perl Classes which each can take a JSON response and populate their corresponding object with that.
I don't believe that you do need that. What would you gain by doing so? GraphQL is all about APIs that can evolve without major-versioning, which means that these classes would need to constantly change too. I made the Perl GraphQL using OO because it seemed like a good idea, and I'd do it that way again. But I believe that OO programming must earn its keep, not be the default.

Your specific issue here may be that those "Ratio" things are GraphQL "scalar" types, and the Perl code isn't really set up to know what to do with those just with SDL information. In particular, the Perl GraphQL modules are very much for making a server-side service, and you are making client-side code. That doesn't need to know the whole schema. It only needs to know the particular query/queries to fill its own information needs. See, as linked in the "SEE ALSO" section of the GraphQL docs, http://graphql.org/graphql-js/ and the graphql-perl port at http://blogs.perl.org/users/ed_j/2017/10/graphql-perl---graphql-js-tutorial-translation-to-graphql-perl-and-mojoliciousplugingraphql.html.


In reply to Re: Converting a GraphQL schema into Perl classes by etj
in thread Converting a GraphQL schema into Perl classes by bliako

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.