Code Monkey home page Code Monkey logo

Comments (4)

SeanWhoCodes avatar SeanWhoCodes commented on September 22, 2024 1

@yanns - No worries and I also just came back from my holiday.

As suggested, I raised #952 to demonstrate the unexpected behaviours related to arbitrary input objects and Args. From what I can see, the tests indicate the following:

  • build with custom input argument: arguments of custom input types work fine as long as they are not optional;
  • build with optional custom input argument and defined input: optional arguments of custom input types wrap the optional results inside another Option (e.g. Some(Some(CustomInput("Hello Sangria"))));

The findings above match what I observed previously, although circeDecoderFromInput from sangria-circe was used in my original code snippet, but I'm using argonautDecoderFromInput from sangria-argonaut in the tests to be consistent with other existing ones.

from sangria.

SeanWhoCodes avatar SeanWhoCodes commented on September 22, 2024 1

@yanns - Amazing! @@ InputObjectResult does fix the problem!

It makes sense to me now that we need the @@ tags in the following argument scenarios:

  • Optional Object types: Argument[Option[EchoMessageInput @@ InputObjectResult]]
  • Optional Scala types: Argument[Option[Int @@ CoercedScalaResult]]

Thanks so much for your help!

from sangria.

yanns avatar yanns commented on September 22, 2024

Thanks for the detailed report. Sorry I missed the notification somehow.
At first sight, I thought it was similar to #434
But I'm not totally sure.

Could you open a PR with a failing test in https://github.com/sangria-graphql/sangria/blob/main/modules/core/src/test/scala/sangria/schema/ArgsSpec.scala ?

from sangria.

yanns avatar yanns commented on September 22, 2024

Thanks a lot for the PR!

By using @@ InputObjectResult, I could make it work: 4d81bbf

Is it something that also fix your case?

from sangria.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.