Skip to content

Enforcing data types #26

@dsbw

Description

@dsbw

Howdy,

I've been using this (very helpful, thank you!) library for a project where I take data from a database via graphql and then put it into a JavaFX table control, which has raised an interesting issue that I'm wondering how other people handle.

Let's say I have a database field which is some kind of floating point (double or money or whatever). It's specified as Float on the GraphQL side, but when it's a round number, like 1.0, the JSON comes in as "1" and ends up as a Long. Most of the time, this isn't a problem, but using a Long in the JavaFX table column set for Double causes a type exception.

I think my handling for this is going to be on the table side, so that it detects longs and coerces to doubles accordingly, which will work for the table but not for any other circumstance where the Long/Double discrepancy might arise.

The real issue is, I think, json/read-str, which doesn't take into account the GraphQL type (and why would it?), so I was wondering if anyone else had the problem and how they'd handled it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions