public IGraphQlDocument Run(Object topLevelObject, String operationName, String variables) { if (validation_errors) { return(this); } if (schema == null) { throw new Exception("Need to call 'validate' first"); } try { output = new GraphQlJObject(); var p = new GraphQlMainExecution(this, schema, output, topLevelObject, operationName, variables); } catch (GraphQlException e) { output = new GraphQlJObject(); output.AddException(e); } catch (Exception e) { output = new GraphQlJObject(); output.AddException(new GraphQlException(e, 0, 0)); } return(this); }
public IGraphQlDocument Validate(Type queryType) { if (custom == null) { custom = new GraphQlCustomiseSchema(); } try { schema = GraphQlSchemaLoader.GetSchema(queryType); if (schema == null) { schema = GraphQlSchemaLoader.InitializeSchema(queryType, custom); } var z = new GraphQlMainValidation(this, schema); } catch (GraphQlException e) { validation_errors = true; output = new GraphQlJObject(); output.AddException(e); } catch (Exception e) { validation_errors = true; output = new GraphQlJObject(); output.AddException(new GraphQlException(e, 0, 0)); } return(this); }
public GraphQlMainExecution(IGraphQlDocument document, __SchemaContainer schema, IGraphQlOutput output, Object topLevelObject, string operationName, String vars) : base(document, schema) { this.TopLevelObject = topLevelObject; this.output = output; GetTypeFunc = schema.GetType; var operation = GetTopLevelOperation(operationName); var variables = new Dictionary <string, Object>(); // not parsed variables yet output.PushObject("data"); ExecuteSelectionSet(new ModifiableSelectionSet(operation.selectionSet()), ExtractAppropriate__TypeForOperation(schema.__schema, operation), this.ExtractAppropriateObjectForOperation(topLevelObject, operation), variables); output.Pop(); }