private void NestedExpand(ExpandClause clause) { var nestedParser = new ExpandClauseParser(_parser, clause.NestedExpands); clause.NestedExpandParameter = Expression.Parameter(clause.ItemType); nestedParser.Parse(clause.NestedExpandParameter); }
public QueryParser(Parameters parameters, GraphSchema graph, IClassCache cache) { IsParsed = false; ClassProperties = graph.Vertices .Select(v => v.Value.Properties) .SelectMany(x => x).Select(x => x.Name) .Distinct(); OrderBy = new OrderByClauseParser <TRootVertex>(x => _GetTokens(x), parameters.OrderBy, graph, TermHelper.OrderByTerms); Select = new SelectClauseParser <TRootVertex>(x => _GetTokens(x), parameters.Select, graph, TermHelper.SelectTerms); Filter = new FilterClauseParser <TRootVertex>(x => _GetTokens(x), parameters.Filter, TermHelper.FilterTerms); Expand = new ExpandClauseParser <TRootVertex>(x => _GetTokens(x), parameters.Expand, graph, Select, Filter, TermHelper.ExpandTerms); _Graph = graph; Cache = cache; Parse(); }
private void InitializeExpand(HttpContext httpContext, ILogger logger, ModelStateDictionary modelStateDictionary) { if (httpContext.Request.Query.TryGetValue("$expand", out var values)) { var binder = httpContext.RequestServices.GetRequiredService <IOpenApiTypeHandler>(); foreach (var value in values) { var parser = new ExpandClauseParser(binder, value, _expandClauses, modelStateDictionary); try { parser.Parse(_parameter); } catch (Exception e) { logger.LogError(e, "failed to parse $expand clause"); modelStateDictionary.TryAddModelException("$expand", e); } } } }