Support `Decimal` in types, inputs and where filters
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- graphql, postgresql, python
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 23
- Fork
- 3
- Merge trung bình
- 10 giờ 6 phút
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fraiseql/fraiseql-python
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
fraiseql/fraiseql-python#610 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
order_by ignores registered table_columns: a field with its own SQL column sorts on the JSONBĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
fraiseql/fraiseql-python#609 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fraiseql/fraiseql-python
Issue tương tự
-
docs(contributing): the two things that silently block a PRCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởavailable documentation good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 95/100
Nixitov/Riptide-Native#944 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
JTHCode/secretguard#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainer thường phản hồi trong vòng 1 ngày