Buckets:
AnonymousSpottedToad/human_verified_bucket / codebase /python /DeepselSystems_deepsel /deepsel /utils /init_graphql.py
| """Initialize GraphQL schema from all models and mount at /graphql.""" | |
| import logging | |
| from typing import Callable | |
| from fastapi import FastAPI | |
| logger = logging.getLogger(__name__) | |
| def init_graphql(application: FastAPI, context_getter: Callable): | |
| logger.info("Initializing GraphQL schema") | |
| try: | |
| from deepsel.utils.graphql_schema import create_auto_schema | |
| graphql_schema = create_auto_schema() | |
| logger.info("GraphQL schema generated successfully") | |
| except Exception as e: | |
| logger.error(f"Failed to generate GraphQL schema: {e}", exc_info=True) | |
| import strawberry | |
| class Query: | |
| hello: str = strawberry.field(resolver=lambda: "Hello from GraphQL!") | |
| graphql_schema = strawberry.Schema(query=Query) | |
| logger.info("Using minimal fallback GraphQL schema") | |
| from strawberry.fastapi import GraphQLRouter | |
| graphql_router = GraphQLRouter(schema=graphql_schema, context_getter=context_getter) | |
| application.include_router(graphql_router, prefix="/graphql", tags=["GraphQL"]) | |
| logger.info("GraphQL endpoint initialized at /graphql") | |
Xet Storage Details
- Size:
- 1.15 kB
- Xet hash:
- cc49fe691dcdcb5e8662df68294eeb2dd148fcda695e1937c5224a3c35a034e2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.