graphql-python / graphql-python/graphene
Failed to print schema with InputObjectType with DateTime field with default_value
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 818
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Declaring a DateTime with default_value in InputObjectType makes schema unprintable due to unsupported conversion in `graphql/utils/ast_from_value.py`
InputObjectType declared as:
```
class Filters(InputObjectType):
datetime_after = DateTime(required=False, default_value=datetime.min)
datetime_before = DateTime(required=False, default_value=datetime.max)
```
normally attached to the Query
causes `print(schema)` failing with:
```
(...)
File "lib/python3.8/site-packages/graphql/utils/schema_printer.py", line 205, in _print_input_value
default_value = " = " + print_ast(ast_from_value(arg.default_value, arg.type))
File "lib/python3.8/site-packages/graphql/utils/ast_from_value.py", line 53, in ast_from_value
assert isinstance(value, dict)
AssertionError
```
Without default_value it works.
I'm using default values like shown in #856 but even without this support in ast_from_value is clearly missing.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Tái hiện lỗi khi in schema với Filters InputObjectType và các giá trị mặc định DateTime được nêu trong issue. Bắt đầu tại graphql/utils/ast_from_value.py, sau đó kiểm tra vị trí gọi trong schema_printer.py; hoàn tất khi print(schema) thực thi thành công khi các trường DateTime có các giá trị default_value.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- graphql, python
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100