apollographql / apollographql/federation
Federation Feature Request: define custom scalars and scalar logic in gateway
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 727
- Forks
- 276
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 1
Description
It would be nice if there was a way to define a custom scalar in the gateway as well as provide the logic to resolve that scalar. It does not make sense to have to define the scalar logic in each microservice. Take DateTime for example, it is likely the most microservices in a project will use this, but each microservice now needs to implement the logic.
For a user standpoint, scalars should always behave the same. Having a developer implement the logic in each service could lead to inconsistent results and it leads to duplicated code.
To take this a step further, the gateway should be able to define "global" objects like a scalar definition and description.
I was unable to find a way to do this. If it exists, please point me in the right direction.
I hope you will see a use case for this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the gateway's federation schema and scalar configuration, then compare how DateTime is defined and resolved across the microservices; done means the gateway can define a shared scalar, its description, and resolution logic consistently for consumers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend-api-design, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100