diff --git a/ApiDoctor.Validation/DocFile.cs b/ApiDoctor.Validation/DocFile.cs
index b38ebc48..5735e697 100644
--- a/ApiDoctor.Validation/DocFile.cs
+++ b/ApiDoctor.Validation/DocFile.cs
@@ -36,7 +36,6 @@ namespace ApiDoctor.Validation
using MarkdownDeep;
using Newtonsoft.Json;
-
///
/// A documentation file that may contain one more resources or API methods
///
@@ -503,7 +502,7 @@ protected string PreviewOfBlockContent(Block block)
return contentPreview;
}
- protected Config.DocumentHeader CreateHeaderFromBlock(Block block)
+ protected static Config.DocumentHeader CreateHeaderFromBlock(Block block)
{
var header = new Config.DocumentHeader();
switch (block.BlockType)
@@ -1131,10 +1130,22 @@ private void PostProcessResources(List foundResources, List<
return;
}
+ var listOfTextToRemoveFromPropertyNames = DocSet.SchemaConfig?.TextToRemoveFromPropertyNames ?? [];
+ var parametersFromTableDefinition = table.Rows.Cast()
+ .Select(param =>
+ {
+ foreach (string text in listOfTextToRemoveFromPropertyNames)
+ {
+ param.Name = param.Name.Replace(text, "").Trim();
+ }
+ return param;
+ });
+
+
table.UsedIn.Add(onlyResource);
MergeParametersIntoCollection(
onlyResource.Parameters,
- table.Rows.Cast(),
+ parametersFromTableDefinition,
issues.For(onlyResource.Name),
addMissingParameters: true,
expectedInResource: true,
diff --git a/ApiDoctor.Validation/DocSet.cs b/ApiDoctor.Validation/DocSet.cs
index 664b07f5..fa67e864 100644
--- a/ApiDoctor.Validation/DocSet.cs
+++ b/ApiDoctor.Validation/DocSet.cs
@@ -411,6 +411,7 @@ public bool ScanDocumentation(string tags, IssueLogger issues)
$"Missing value for referenced base type in resource {resource.Name}");
}
+ var docIssues = issues.For(resource.SourceFile.DisplayName);
foreach (var param in resource.Parameters)
{
if (param.Type?.CustomTypeName != null)
@@ -423,7 +424,7 @@ public bool ScanDocumentation(string tags, IssueLogger issues)
{
if (string.IsNullOrWhiteSpace(resource.BaseType) || !resource.ResolvedBaseTypeReference.HasOrInheritsProperty(param.Name))
{
- issues.Error(ValidationErrorCode.AdditionalPropertyDetected,
+ docIssues.Error(ValidationErrorCode.AdditionalPropertyDetected,
$"Property '{param.Name}' found in resource definition for '{resource.Name}', but not described in markdown table.");
}
}
diff --git a/ApiDoctor.Validation/OData/Transformation/SchemaConfigFile.cs b/ApiDoctor.Validation/OData/Transformation/SchemaConfigFile.cs
index 0d9ed16d..fdbe9c47 100644
--- a/ApiDoctor.Validation/OData/Transformation/SchemaConfigFile.cs
+++ b/ApiDoctor.Validation/OData/Transformation/SchemaConfigFile.cs
@@ -43,11 +43,12 @@ public class SchemaConfig
{
public SchemaConfig()
{
- RequiredYamlHeaders = new string[] {};
- FoldersToSkip = new List();
- FilesToSkip = new List();
- TreatErrorsAsWarningsWorkloads = new List();
- SkipPermissionTableUpdateForWorkloads = new List();
+ RequiredYamlHeaders = [];
+ FoldersToSkip = [];
+ FilesToSkip = [];
+ TreatErrorsAsWarningsWorkloads = [];
+ SkipPermissionTableUpdateForWorkloads = [];
+
}
///
@@ -103,6 +104,12 @@ public SchemaConfig()
///
[JsonProperty("skipPermissionTableUpdateForWorkloads")]
public List SkipPermissionTableUpdateForWorkloads { get; set; }
+
+ ///
+ /// Text to remove from property names
+ ///
+ [JsonProperty("textToRemoveFromPropertyNames")]
+ public List TextToRemoveFromPropertyNames { get; set; }
}
public class SchemaDiffConfig