Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to print schema with InputObjectType with DateTime field with default_value #1293

Open
lookpl opened this issue Dec 8, 2020 · 1 comment
Labels

Comments

@lookpl
Copy link

lookpl commented Dec 8, 2020

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.

@lookpl lookpl added the 🐛 bug label Dec 8, 2020
@ransomw
Copy link
Contributor

ransomw commented Jul 9, 2023

appears to be resolved by current version of graphene/graphql-core, or at least the same bug but with Enum instead of DateTime is resolved.

erikwrede added a commit that referenced this issue Jul 19, 2023
…ult_value (#1293) (#1513)

* test [1293]: regression test print schema with InputObjectType with DateTime field with default_value

* chore: clarify test title and assertion

---------

Co-authored-by: Erik Wrede <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants