feat: wildcard to resolvers , and find that load_resolvers are not added
This commit is contained in:
parent
e27b0ae42b
commit
b6b39a457c
4
main.py
4
main.py
|
@ -9,9 +9,7 @@ from services.schema import resolvers
|
||||||
from settings import DEV_SERVER_PID_FILE_NAME, SENTRY_DSN, MODE
|
from settings import DEV_SERVER_PID_FILE_NAME, SENTRY_DSN, MODE
|
||||||
|
|
||||||
import_module("resolvers")
|
import_module("resolvers")
|
||||||
combined_resolvers = {**resolvers[0], **service_resolvers} # assuming resolvers is a list with one dictionary as its first item
|
schema = make_executable_schema(load_schema_from_path("inbox.graphql"), resolvers) # type: ignore
|
||||||
|
|
||||||
schema = make_executable_schema(load_schema_from_path("inbox.graphql"), combined_resolvers) # type: ignore
|
|
||||||
|
|
||||||
|
|
||||||
async def start_up():
|
async def start_up():
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
from ariadne import ScalarType, QueryType, MutationType
|
from ariadne import ScalarType, QueryType, MutationType
|
||||||
from resolvers.service import service_resolvers
|
|
||||||
|
|
||||||
datetime_scalar = ScalarType("DateTime")
|
datetime_scalar = ScalarType("DateTime")
|
||||||
|
|
||||||
|
|
||||||
@datetime_scalar.serializer
|
@datetime_scalar.serializer
|
||||||
def serialize_datetime(value):
|
def serialize_datetime(value):
|
||||||
return value.isoformat
|
return value.isoformat()
|
||||||
|
|
||||||
|
|
||||||
query = QueryType()
|
query = QueryType()
|
||||||
|
|
||||||
|
@query.field("_service")
|
||||||
|
def resolve_service(*_):
|
||||||
|
print("Inside the _service resolver")
|
||||||
|
# For now, return a placeholder SDL.
|
||||||
|
sdl = "type Query { _service: _Service } type _Service { sdl: String }"
|
||||||
|
return {"sdl": sdl}
|
||||||
|
|
||||||
mutation = MutationType()
|
mutation = MutationType()
|
||||||
resolvers = [query, mutation, datetime_scalar, service_resolvers]
|
|
||||||
|
resolvers = [query, mutation, datetime_scalar]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user