Skip to content

Commit

Permalink
Report error if base URL in example request is not in config
Browse files Browse the repository at this point in the history
  • Loading branch information
millicentachieng committed Feb 2, 2024
1 parent 8a1b087 commit 7282f40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ApiDoctor.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2570,7 +2570,7 @@ private static HttpRequest PreProcessUrlForSnippetGeneration(HttpRequest request
if (!(request.Url.Substring(0, 6).Equals("/beta/") || request.Url.Substring(0, 6).Equals("/v1.0/")))
{
//Log the error for the documentation to be fixed.
issues.Warning(ValidationErrorCode.InvalidUrlString, $"The url: {request.Url} does not start a supported api version( /v1.0/ or /beta/ ). File: {method.SourceFile}");
issues.Warning(ValidationErrorCode.InvalidUrlString, $"The url: {request.Url} does not start with a supported api version( /v1.0/ or /beta/ ). File: {method.SourceFile}");

if (method.SourceFile.DisplayName.Contains("beta"))
{
Expand Down
1 change: 1 addition & 0 deletions ApiDoctor.Publishing/CSDL/csdlextensionmethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static string RequestUriPathOnly(this MethodDefinition method, IssueLogge
{
if (path.StartsWith(scheme, StringComparison.OrdinalIgnoreCase))
{
issues.Error(ValidationErrorCode.InvalidUrlString, $"{method.Identifier}: Unexpected base URL found in '{method.Request.FirstLineOnly()}'");
int pathStartIndex = path.IndexOf('/', scheme.Length);
if (pathStartIndex != -1)
{
Expand Down

0 comments on commit 7282f40

Please sign in to comment.