GithubHelp home page GithubHelp logo

Comments (5)

anzecesar avatar anzecesar commented on May 31, 2024 1

Yes, according to graphql docs:

Then it's up to our implementation to define how that type should be serialized, deserialized, and validated. For example, you could specify that the Date type should always be serialized into an integer timestamp, and your client should know to expect that format for any date fields.

The sad part here is as you pointed out already, there is no way to infer this serialisation just from the schema alone. DateTime could be encoded as a String or as an Int or anything in between :). So much of strongly typed 😂

I think your solution in #29 makes most sense.

I could give implementing it a shot :).

I'm closing this in favour of #29.

from sbt-graphql.

muuki88 avatar muuki88 commented on May 31, 2024

Thanks for your detailed bug report 👍

We don't have any test for scalar type definitions like you posted. It could very well be that this feature is missing.

Do you have the time and interest to do a pull request 😎? I'll be more than happy to help you 🤗

from sbt-graphql.

jonas avatar jonas commented on May 31, 2024

Yes, scalar types are currently ignored.

I don't remember how sangria represents it should be a matter of generating a type alias similar to how it is done for the built-in ID scalar type.

from sbt-graphql.

muuki88 avatar muuki88 commented on May 31, 2024

@jonas is right. The type alias makes sense if it's actually only an alias. On the other hand there a some use cases for custom scalars, e.g. DateTime. Sangria's section on custom scalar types describes how to implement them.

For custom scalar types we would need additional imports ( #29 ) as we cannot generate code for something we don't know ;)

from sbt-graphql.

muuki88 avatar muuki88 commented on May 31, 2024

Thanks a lot @anzecesar 😊 looking forward to a pull request. If you need any help, just open the pull request with the code you already have and we are more than happy to help 😊

from sbt-graphql.

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.