private static GraphQLSchema BuildSchema(GraphQLModel model) { var schemas = model.schemasById.Values; return(new GraphQLSchema { Query = new AppQueriesGraphType(model, schemas) }); }
private static GraphQLSchema BuildSchema(GraphQLModel model, int pageSizeContents, int pageSizeAssets) { var schemas = model.schemasById.Values; return(new GraphQLSchema { Query = new AppQueriesGraphType(model, pageSizeContents, pageSizeAssets, schemas) }); }
private static GraphQLSchema BuildSchema(GraphQLModel model, int pageSizeContents, int pageSizeAssets, List <ISchemaEntity> schemas) { var schema = new GraphQLSchema { Query = new AppQueriesGraphType(model, pageSizeContents, pageSizeAssets, schemas) }; return(schema); }
private async Task <GraphQLModel> GetModelAsync(IAppEntity app) { var cacheKey = CreateCacheKey(app.Id, app.Version.ToString()); var modelContext = Cache.Get <GraphQLModel>(cacheKey); if (modelContext == null) { var allSchemas = await appProvider.GetSchemasAsync(app.Id); modelContext = new GraphQLModel(app, allSchemas.Where(x => x.IsPublished), urlGenerator); Cache.Set(cacheKey, modelContext, CacheDuration); } return(modelContext); }
private async Task <(bool HasError, object Response)> QueryInternalAsync(GraphQLModel model, GraphQLExecutionContext ctx, GraphQLQuery query) { if (string.IsNullOrWhiteSpace(query.Query)) { return(false, new { data = new object() }); } var result = await model.ExecuteAsync(ctx, query); if (result.Errors?.Any() == true) { return(false, new { data = result.Data, errors = result.Errors }); } else { return(false, new { data = result.Data }); } }
private static GraphQLSchema BuildSchema(GraphQLModel model, List <ISchemaEntity> schemas) { var schema = new GraphQLSchema { Query = new AppQueriesGraphType(model, schemas) }; schema.RegisterType(ContentInterfaceGraphType.Instance); var schemasWithFields = schemas.Where(x => x.SchemaDef.Fields.Count > 0); if (schemasWithFields.Any()) { schema.Mutation = new AppMutationsGraphType(model, schemasWithFields); } return(schema); }
private static GraphQLSchema BuildSchema(GraphQLModel model, int pageSizeContents, int pageSizeAssets, List <ISchemaEntity> schemas) { var schema = new GraphQLSchema { Query = new AppQueriesGraphType( model, pageSizeContents, pageSizeAssets, schemas) }; var schemasWithFields = schemas.Where(x => x.SchemaDef.Fields.Count > 0); if (schemasWithFields.Any()) { schema.Mutation = new AppMutationsGraphType(model, schemasWithFields); } return(schema); }
public sealed record CacheEntry(GraphQLModel Model, string Hash, Instant Created);
private static IObjectGraphType FindDataType(GraphQLModel model, string schema) { var type = (IObjectGraphType)model.Schema.AllTypes.Single(x => x.Name == schema); return((IObjectGraphType)type.GetField("flatData").ResolvedType.Flatten()); }