Skip to content

Commit

Permalink
Change warning to error for when a property is defined in JSON repres…
Browse files Browse the repository at this point in the history
…entation of table but not in markdown table (#248)
  • Loading branch information
millicentachieng authored Feb 5, 2024
1 parent 5501a5c commit 2307495
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 0 additions & 5 deletions ApiDoctor.Validation/DocFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,11 +1154,6 @@ private void PostProcessResources(List<ResourceDefinition> foundResources, List<
{
paramsToRemove.Add(param);
}
else
{
issues.Warning(ValidationErrorCode.AdditionalPropertyDetected,
$"Property '{param.Name}' found in resource definition for '{onlyResource.Name}', but not described in markdown table.");
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions ApiDoctor.Validation/DocSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ public bool ScanDocumentation(string tags, IssueLogger issues)
{
EnsureDefinedInDocs(param.Type.CustomTypeName, definedTypes, resource.SourceFile, resourceIssues.For(param.Name));
}

// if parameter does not have a description, then it's from the resource JSON definition
if (string.IsNullOrEmpty(param.Description) && !param.Name.Contains('@'))
{
if (string.IsNullOrWhiteSpace(resource.BaseType) || !resource.ResolvedBaseTypeReference.HasOrInheritsProperty(param.Name))
{
issues.Error(ValidationErrorCode.AdditionalPropertyDetected,
$"Property '{param.Name}' found in resource definition for '{resource.Name}', but not described in markdown table.");
}
}
}

if (!string.IsNullOrEmpty(resource.KeyPropertyName) &&
Expand Down

0 comments on commit 2307495

Please sign in to comment.