示例#1
0
 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)
     }));
 }
示例#2
0
 private string MayBeMissing(ContractFieldDesc fieldDesc)
 {
     return(fieldDesc.MayBeMissing ? "?" : "");
 }
示例#3
0
 private string FieldName(ContractFieldDesc fieldDesc)
 {
     return(fieldDesc.JsonName ??
            _options.FieldNamingStrategy.GetPropertyName(fieldDesc.Name, false));
 }
示例#4
0
 public string Stringify(ContractFieldDesc fieldDesc)
 {
     return($@"{_jsDoc.Format(fieldDesc)}{FieldName(fieldDesc)}{MayBeMissing(fieldDesc)}: {FieldTypeStringify(fieldDesc.Type)}");
 }