Support `Decimal` in types, inputs and where filters
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- graphql, postgresql, python
- Área
- api, backend-api-design
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 23
- Forks
- 3
- Merge medio
- 10 h 6 min
- PR fusionados (30 d)
- 7
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de fraiseql/fraiseql-python
-
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
fraiseql/fraiseql-python#610 ·
Los mantenedores suelen responder en 1 día
-
order_by ignores registered table_columns: a field with its own SQL column sorts on the JSONBAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
fraiseql/fraiseql-python#609 ·
Los mantenedores suelen responder en 1 día
Todos los issues de fraiseql/fraiseql-python
Issues similares
-
docs(contributing): the two things that silently block a PRPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoavailable documentation good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 95/100
Nixitov/Riptide-Native#944 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
JTHCode/secretguard#24 ·
Los mantenedores suelen responder en 1 día
-
area: middleware documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
omarelshamy25x/shamy-hijri#63 ·
Los mantenedores suelen responder en 1 día