public override IFormBuilder <JObject> Field(string name, ActiveDelegate <JObject> active = null, ValidateAsyncDelegate <JObject> validate = null) { var field = new FieldJson(this, name); field.SetActive(active); field.SetValidate(validate); AddSteps(field.Before); Field(field); AddSteps(field.After); return(this); }
public override IFormBuilder <JObject> Field(string name, PromptAttribute prompt, ActiveDelegate <JObject> active = null, ValidateAsyncDelegate <JObject> validate = null) { var field = new FieldJson(this, name); field.SetPrompt(prompt); if (active != null) { field.SetActive(active); } if (validate != null) { field.SetValidate(validate); } return(Field(field)); }
private void Fields(JObject schema, string prefix, IList <string> fields) { if (schema["properties"] != null) { foreach (JProperty property in schema["properties"]) { var path = (prefix == null ? property.Name : $"{prefix}.{property.Name}"); var childSchema = (JObject)property.Value; var eltSchema = FieldJson.ElementSchema(childSchema); if (FieldJson.IsPrimitiveType(eltSchema)) { fields.Add(path); } else { Fields(childSchema, path, fields); } } } }