Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove sees from YAML output #8559

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ public class ApiBuildOutput
[JsonProperty("seealso")]
public List<ApiLinkInfoBuildOutput> SeeAlsos { get; set; }

[YamlMember(Alias = "see")]
[JsonProperty("see")]
public List<ApiLinkInfoBuildOutput> Sees { get; set; }

[YamlMember(Alias = "inheritance")]
[MergeOption(MergeOption.Ignore)]
[JsonProperty("inheritance")]
Expand Down Expand Up @@ -230,7 +226,6 @@ private static ApiBuildOutput FromModel(ItemViewModel model, Dictionary<string,
Overload = ApiBuildOutputUtility.GetApiNames(model.Overload, references, model.SupportedLanguages),
Exceptions = GetCrefInfoList(model.Exceptions, references, model.SupportedLanguages),
SeeAlsos = GetLinkInfoList(model.SeeAlsos, references, model.SupportedLanguages),
Sees = GetLinkInfoList(model.Sees, references, model.SupportedLanguages),
Inheritance = GetReferenceList(model.Inheritance, references, model.SupportedLanguages, true),
Implements = model.Implements?.Select(u => ApiBuildOutputUtility.GetApiNames(u, references, model.SupportedLanguages)).ToList(),
InheritedMembers = GetReferenceList(model.InheritedMembers, references, model.SupportedLanguages),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ public class ApiReferenceBuildOutput
[JsonProperty("seealso")]
public List<ApiLinkInfoBuildOutput> SeeAlsos { get; set; }

[YamlMember(Alias = "see")]
[JsonProperty("see")]
public List<ApiLinkInfoBuildOutput> Sees { get; set; }

[YamlMember(Alias = "inheritance")]
[JsonProperty("inheritance")]
public List<ApiReferenceBuildOutput> Inheritance { get; set; }
Expand Down Expand Up @@ -229,7 +225,6 @@ public static ApiReferenceBuildOutput FromModel(ItemViewModel vm)
Overridden = ApiNames.FromUid(vm.Overridden),
Overload = ApiNames.FromUid(vm.Overload),
SeeAlsos = vm.SeeAlsos?.Select(ApiLinkInfoBuildOutput.FromModel).ToList(),
Sees = vm.Sees?.Select(ApiLinkInfoBuildOutput.FromModel).ToList(),
Inheritance = vm.Inheritance?.Select(FromUid).ToList(),
Implements = vm.Implements?.Select(ApiNames.FromUid).ToList(),
InheritedMembers = vm.InheritedMembers,
Expand All @@ -256,7 +251,6 @@ public void Expand(Dictionary<string, ApiReferenceBuildOutput> references, strin
Syntax?.Expand(references, supportedLanguages);
Overridden = ApiBuildOutputUtility.GetApiNames(Overridden?.Uid, references, supportedLanguages);
SeeAlsos?.ForEach(e => e.Expand(references, supportedLanguages));
Sees?.ForEach(e => e.Expand(references, supportedLanguages));
Exceptions?.ForEach(e => e.Expand(references, supportedLanguages));
Overload = ApiBuildOutputUtility.GetApiNames(Overload?.Uid, references, supportedLanguages);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ internal class MetadataItem : ICloneable
[JsonProperty("exceptions")]
public List<ExceptionInfo> Exceptions { get; set; }

[YamlMember(Alias = "see")]
[JsonProperty("see")]
public List<LinkInfo> Sees { get; set; }

[YamlMember(Alias = "seealso")]
[JsonProperty("seealso")]
public List<LinkInfo> SeeAlsos { get; set; }
Expand Down Expand Up @@ -171,8 +167,6 @@ public void CopyInheritedData(MetadataItem src)

if (Exceptions == null && src.Exceptions != null)
Exceptions = src.Exceptions.Select(e => e.Clone()).ToList();
if (Sees == null && src.Sees != null)
Sees = src.Sees.Select(s => s.Clone()).ToList();
if (SeeAlsos == null && src.SeeAlsos != null)
SeeAlsos = src.SeeAlsos.Select(s => s.Clone()).ToList();
if (Examples == null && src.Examples != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,20 +276,11 @@ public string FullNameForVB
[JsonProperty("seealso")]
public List<LinkInfo> SeeAlsos { get; set; }

[YamlMember(Alias = "see")]
[JsonProperty("see")]
public List<LinkInfo> Sees { get; set; }

[JsonIgnore]
[YamlIgnore]
[UniqueIdentityReference]
public List<string> SeeAlsosUidReference => SeeAlsos?.Where(s => s.LinkType == LinkType.CRef)?.Select(s => s.LinkId).ToList();

[JsonIgnore]
[YamlIgnore]
[UniqueIdentityReference]
public List<string> SeesUidReference => Sees?.Where(s => s.LinkType == LinkType.CRef)?.Select(s => s.LinkId).ToList();

[YamlMember(Alias = Constants.PropertyName.Inheritance)]
[MergeOption(MergeOption.Ignore)]
[JsonProperty(Constants.PropertyName.Inheritance)]
Expand Down
25 changes: 0 additions & 25 deletions src/Microsoft.DocAsCode.Dotnet/Parsers/XmlComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ internal class XmlComment

public List<ExceptionInfo> Exceptions { get; private set; }

public List<LinkInfo> Sees { get; private set; }

public List<LinkInfo> SeeAlsos { get; private set; }

public List<string> Examples { get; private set; }
Expand Down Expand Up @@ -74,7 +72,6 @@ private XmlComment(string xml, XmlCommentParserContext context)
Returns = GetReturns(nav, context);

Exceptions = GetExceptions(nav, context);
Sees = GetSees(nav, context);
SeeAlsos = GetSeeAlsos(nav, context);
Examples = GetExamples(nav, context);
Parameters = GetParameters(nav, context);
Expand Down Expand Up @@ -116,10 +113,6 @@ public void CopyInheritedData(XmlComment src)
{
Exceptions = src.Exceptions.Select(e => e.Clone()).ToList();
}
if (Sees == null && src.Sees != null)
{
Sees = src.Sees.Select(s => s.Clone()).ToList();
}
if (SeeAlsos == null && src.SeeAlsos != null)
{
SeeAlsos = src.SeeAlsos.Select(s => s.Clone()).ToList();
Expand Down Expand Up @@ -227,24 +220,6 @@ private List<ExceptionInfo> GetExceptions(XPathNavigator nav, XmlCommentParserCo
return result;
}

/// <summary>
/// To get `see` tags out
/// </summary>
/// <param name="xml"></param>
/// <param name="context"></param>
/// <returns></returns>
/// <see cref="SpecIdHelper"/>
/// <see cref="SourceSwitch"/>
private List<LinkInfo> GetSees(XPathNavigator nav, XmlCommentParserContext context)
{
var result = GetMultipleLinkInfo(nav, "/member/see").ToList();
if (result.Count == 0)
{
return null;
}
return result;
}

/// <summary>
/// To get `seealso` tags out
/// </summary>
Expand Down
8 changes: 0 additions & 8 deletions src/Microsoft.DocAsCode.Dotnet/Resolvers/ResolveReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ private IEnumerable<string> GetReferenceKeys(MetadataItem current)
}
}

if (current.Sees?.Count > 0)
{
foreach (var item in current.Sees.Where(l => l.LinkType == LinkType.CRef))
{
yield return item.LinkId;
}
}

if (current.SeeAlsos?.Count > 0)
{
foreach (var item in current.SeeAlsos.Where(l => l.LinkType == LinkType.CRef))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ public override MetadataItem DefaultVisit(ISymbol symbol)
}
}

if (item.Sees != null)
{
foreach (var i in item.Sees.Where(l => l.LinkType == LinkType.CRef))
{
AddReference(i.LinkId, i.CommentId);
}
}

if (item.SeeAlsos != null)
{
foreach (var i in item.SeeAlsos.Where(l => l.LinkType == LinkType.CRef))
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.DocAsCode.Dotnet/Visitors/VisitorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public static void FeedComments(MetadataItem item, XmlCommentParserContext conte
item.Summary = commentModel.Summary;
item.Remarks = commentModel.Remarks;
item.Exceptions = commentModel.Exceptions;
item.Sees = commentModel.Sees;
item.SeeAlsos = commentModel.SeeAlsos;
item.Examples = commentModel.Examples;
item.InheritDoc = commentModel.InheritDoc;
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.DocAsCode.Dotnet/YamlViewModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ public static ItemViewModel ToItemViewModel(this MetadataItem model)
Overridden = model.Overridden,
Overload = model.Overload,
Exceptions = model.Exceptions,
Sees = model.Sees,
SeeAlsos = model.SeeAlsos,
DerivedClasses = model.DerivedClasses,
Inheritance = model.Inheritance,
Expand Down
11 changes: 0 additions & 11 deletions test/Microsoft.DocAsCode.Dotnet.Tests/XmlCommentUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,6 @@ public int Main(string[] args)
context.PreserveRawInlineComments = true;
commentModel = XmlComment.Parse(input, context);

var sees = commentModel.Sees;
Assert.Equal(5, sees.Count);
Assert.Equal("Microsoft.DocAsCode.EntityModel.SpecIdHelper", sees[0].LinkId);
Assert.Null(sees[0].AltText);
Assert.Equal("System.String.Compare*", sees[2].LinkId);
Assert.Null(sees[1].AltText);
Assert.Equal("http://exception.com", sees[3].LinkId);
Assert.Equal("Global See section", sees[3].AltText);
Assert.Equal("http://exception.com", sees[4].AltText);
Assert.Equal("http://exception.com", sees[4].LinkId);

var seeAlsos = commentModel.SeeAlsos;
Assert.Equal(3, seeAlsos.Count);
Assert.Equal("System.IO.WaitForChangedResult", seeAlsos[0].LinkId);
Expand Down