public string Stringify(ContractFieldDesc fieldDesc) { return(_template.Render(new { fieldDesc.IsDeprecated, fieldDesc.Description, fieldDesc.Example, Name = _options.FieldNamingStrategy.GetPropertyName(fieldDesc.Name, false), fieldDesc.DeprecationCause, JsonProperty = fieldDesc.JsonName, QueryName = fieldDesc.QueryName, IsNullable = fieldDesc.Type is NullableDesc, PropType = FieldTypeStringify(fieldDesc.Type), Validations = fieldDesc.Validation.Select(ValidationStringify), CustomAttrs = fieldDesc.CustomAttributes.Select(_ => _.AttributeStr) })); }
private string MayBeMissing(ContractFieldDesc fieldDesc) { return(fieldDesc.MayBeMissing ? "?" : ""); }
private string FieldName(ContractFieldDesc fieldDesc) { return(fieldDesc.JsonName ?? _options.FieldNamingStrategy.GetPropertyName(fieldDesc.Name, false)); }
public string Stringify(ContractFieldDesc fieldDesc) { return($@"{_jsDoc.Format(fieldDesc)}{FieldName(fieldDesc)}{MayBeMissing(fieldDesc)}: {FieldTypeStringify(fieldDesc.Type)}"); }