Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Subclass built-in scalars without creating new GraphQL type

Open
#1,553 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
graphql, python

Research direction

Start by tracing the Scalar.get_type() behavior and how Meta.name affects schema generation, using the NormalizedDecimal example from the issue. Done means a scalar subclass can retain its custom serialization logic while the schema exposes the superclass scalar type; add focused tests for both behaviors.

Written by the indexing model from the issue text.

Description

✨ enhancement

Is your feature request related to a problem? Please describe.
I'd like to be able to customise serialization logic for some scalars, e.g. a NormalizedDecimal that inherits from Decimal but calls .normalize() on the value during serialization. Unfortunately, this results in the GraphQL schema containing a new NormalizedDecimal scalar that clients don't know how to deserialize.

Describe the solution you'd like
I'd like the type to still be that of the superclass in the schema, e.g. Decimal in the above example.

Describe alternatives you've considered
I've tried overriding Scalar.get_type() to return the type of the superclass, but then the subclass doesn't function as intended, e.g. the custom serialization logic doesn't get invoked. I've also tried setting Meta.name to that of the superclass, but that also results in the custom serialization logic not being invoked.

Dominant language
Python
Stars
8.2k
Forks
818
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from graphql-python/graphene

All issues in graphql-python/graphene

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.