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

Optional Nullable types throwing error #6

Open
TristenHarr opened this issue Dec 12, 2024 · 0 comments
Open

Optional Nullable types throwing error #6

TristenHarr opened this issue Dec 12, 2024 · 0 comments

Comments

@TristenHarr
Copy link
Collaborator

@connector.register_query
def foo(inp: Optional[str] = None):
print(inp)
return f"{inp}"

When you leave the type blank, it works. However, when you try to fill out the type:

query MyQuery {
foo(inp: "hey")
}

You get an error:

v View in Docker Deskapp_python-1      |     await super().__call__(scope, receive, send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
app_python-1      |     await self.middleware_stack(scope, receive, send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
vapp_python-1      |     raise exc
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
app_python-1      |     await self.app(scope, receive, _send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
app_python-1      |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
app_python-1      |     raise exc Config   w Enable Watch
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
app_python-1      |     await app(scope, receive, sender)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
app_python-1      |     await self.middleware_stack(scope, receive, send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
app_python-1      |     await route.handle(scope, receive, send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
app_python-1      |     await self.app(scope, receive, send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
app_python-1      |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
app_python-1      |     raise exc Config   w Enable Watch
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
app_python-1      |     await app(scope, receive, sender)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
app_python-1      |     response = await func(request)tch
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
app_python-1      |     raw_response = await run_endpoint_function(
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
app_python-1      |     return await dependant.call(**values)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/hasura_ndc/server.py", line 71, in execute_query
app_python-1      |     return await instrumentation.with_active_span(
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/hasura_ndc/instrumentation.py", line 138, in with_active_span
app_python-1      |     retval = await retvalEnable Watch
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/hasura_ndc/function_connector.py", line 351, in query
app_python-1      |     root_args[k] = self.cast_to_type(v.value, arg_type)
app_python-1      |   File "/functions/venv/lib/python3.10/site-packages/hasura_ndc/function_connector.py", line 333, in cast_to_type
app_python-1      |     elif origin is not None and issubclass(origin, BaseModel):
app_python-1      |   File "/usr/local/lib/python3.10/abc.py", line 123, in __subclasscheck__
app_python-1      |     return _abc_subclasscheck(cls, subclass)
app_python-1      | TypeError: issubclass() arg 1 must be a class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant