Skip to content

Should _all_ GraphQL scalars be present in a schema? #222

@rmosolgo

Description

@rmosolgo

Let's say I'm working on my BCaaS app (bean counter as a service). My only inputs are Ints and my only return values are Ints. Should my schema still contain GraphQL scalars like String and Float? Or is it appropriate to leave those types out, since they aren't used?

It looks like graphql-js leaves out unused scalars. This approach makes sense to me. GraphQL's predefined scalars aren't "universals", instead, they're saving the user a step of defining their own. In that way, like an unused custom scalar, if a predefined scalar isn't used, it's not present in the schema.

Is that intended? Or should all GraphQL schemas contain the predefined scalar types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions