Support `Decimal` in types, inputs and where filters
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- graphql, postgresql, python
- Ambito
- api, backend-api-design
Direzione di ricerca
Start in src/fraiseql/core/graphql_type.py, where the issue reports the unsupported output type, then inspect fraiseql.types.Money and its MoneyScalar mapping. The examples named in the issue can show how Decimal annotations are used. Done means Decimal has a defined input and output behavior, or the error points users to Money, with the scalar choice documented next to Money.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Found while fixing examples for #565.
decimal.Decimal in a @fraiseql.type field fails the schema build with
Unsupported output type: <class 'decimal.Decimal'> (src/fraiseql/core/graphql_type.py).
It is the natural type for money, and about 60 annotations in the examples use it
(enterprise_patterns 26, ecommerce 16, hybrid_tables 6, filtering 5, documented_api/ 4, and
others).
Decimal also fails as an input field (Invalid type passed to convert_type_to_graphql_input: <class 'decimal.Decimal'>), as a query argument, and in generated where inputs:
create_graphql_where_input maps Decimal to DecimalFilter
(src/fraiseql/sql/graphql_where_generator.py:180), whose own Decimal fields can't be built, so
any WhereInput for a type with a Decimal field fails. docs/reference/scalar-types-cheatsheet.md
recommends price: Decimal for money.
fraiseql.types.Money is not a workaround today. It is MoneyField
(src/fraiseql/types/__init__.py:75), which has no entry in convert_scalar_to_graphql
(src/fraiseql/types/scalars/graphql_utils.py), so it fails the same way:
Unsupported output type: <class 'fraiseql.types.scalars.money.MoneyField'>. This is general:
only 11 of the 53 scalar markers exported from fraiseql.types are mapped (to be filed
separately). Only the raw price: MoneyScalar builds, and it can't be made optional
(MoneyScalar | None is a TypeError) and silently rounds to 4 places.
Proposal: add a Decimal scalar (serialized as a string, parsed to Decimal; not Float, which
loses precision for money), mapped from decimal.Decimal for output, input and DecimalFilter.
Check that the JSONB passthrough path keeps precision (psycopg may already load JSONB numbers as
float). Don't point the error at Money until Money itself works.
Edited 2026-10-21 after an independent re-check on 419569fa: Decimal also fails as input, argument and in WhereInput; fraiseql.types.Money fails the same way, so it's not a workaround. Relabelled bug.
- Lingua principale
- Python
- Stelle
- 23
- Fork
- 3
- Merge medio
- 10h 6m
- PR unite (30g)
- 7
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fraiseql/fraiseql-python
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
fraiseql/fraiseql-python#610 ·
I maintainer di solito rispondono entro 1 giorno
-
order_by ignores registered table_columns: a field with its own SQL column sorts on the JSONBAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
fraiseql/fraiseql-python#609 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di fraiseql/fraiseql-python
Issue simili
-
docs(contributing): the two things that silently block a PRForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaavailable documentation good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 95/100
Nixitov/Riptide-Native#944 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
JTHCode/secretguard#24 ·
I maintainer di solito rispondono entro 1 giorno
-
area: middleware documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
omarelshamy25x/shamy-hijri#63 ·
I maintainer di solito rispondono entro 1 giorno