graphql-python / graphql-python/graphene

Numpy NaN handling

Open
#852 7 comments 8 reactions 0 assignees View on GitHub
✨ enhancement 🙋 help wanted
Dominant language
Python
Stars
8.2k
Forks
818
PR merge metrics
No merged PRs in 30d

Description

Currently when a `[Float]` type resolves to `np.array([1, np.nan])` the generated payload is `[1, NaN]` which is not json-compilant (rather than `null`) without any warning. A custom scalar can do the job however as numpy is so widely used, maybe this should be supported out of the box?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how Graphene's Float scalar or generated payload serializes NumPy arrays containing NaN. Reproduce the reported [1, NaN] output and add coverage showing that NaN is emitted as JSON null without breaking normal float handling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.