You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add frontmatter mapped_pages URL validation with URI format checking (#1899)
* Initial plan
* Add frontmatter mapped_pages URL validation
- Added validation to ensure mapped_pages URLs start with https://www.elastic.co/guide
- Emits clear error messages with guidance on how to fix invalid URLs
- Added comprehensive test coverage for validation scenarios
- All existing tests continue to pass
Co-authored-by: reakaleek <[email protected]>
* Add URI well-formed validation to mapped_pages URLs
- Enhanced validation to include Uri.IsWellFormedUriString check
- Added test cases for malformed URIs, invalid characters, and non-absolute URIs
- URLs must now be both properly prefixed AND well-formed absolute URIs
Co-authored-by: cotti <[email protected]>
* Addressing PR comments
Co-authored-by: reakaleek <[email protected]>
* Restore global.json file to proper state
- Restored global.json content that was accidentally emptied in commit 05a6385
- Proper .NET 9.0.100 SDK configuration restored
- File now contains correct SDK version and rollForward settings
Co-authored-by: reakaleek <[email protected]>
* Run dotnet format
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: reakaleek <[email protected]>
Co-authored-by: Jan Calanog <[email protected]>
Co-authored-by: cotti <[email protected]>
Co-authored-by: Felipe Cotti <[email protected]>
Collector.EmitError(FilePath,$"Invalid mapped_pages URL: \"{url}\". All mapped_pages URLs must start with \"https://www.elastic.co/guide\". Please update the URL to reference content under the Elastic documentation guide.");
374
+
}
375
+
}
376
+
}
377
+
366
378
// TODO remove when migration tool and our demo content sets are updated
Collector.Diagnostics.Should().Contain(d =>d.Message.Contains("Invalid mapped_pages URL: \"https://www.elastic.co/docs/get-started/deployment-options\". All mapped_pages URLs must start with \"https://www.elastic.co/guide\". Please update the URL to reference content under the Elastic documentation guide."));
Collector.Diagnostics.Should().Contain(d =>d.Message.Contains("Invalid mapped_pages URL: \"https://www.elastic.co/docs/invalid-url\". All mapped_pages URLs must start with \"https://www.elastic.co/guide\""));
Collector.Diagnostics.Should().Contain(d =>d.Message.Contains("Invalid mapped_pages URL: \"https://github.com/elastic/docs-builder\". All mapped_pages URLs must start with \"https://www.elastic.co/guide\""));
Collector.Diagnostics.Should().Contain(d =>d.Message.Contains("Invalid mapped_pages URL: \"https://www.elastic.co/guide/[invalid-characters]\". All mapped_pages URLs must start with \"https://www.elastic.co/guide\""));
- "https://www.elastic.co/guide/invalid uri with spaces"
307
+
---
308
+
309
+
# Test Page
310
+
"""
311
+
)
312
+
{
313
+
[Fact]
314
+
publicvoidHasErrorsForInvalidScheme()
315
+
{
316
+
Collector.Diagnostics.Should().HaveCount(1);
317
+
Collector.Diagnostics.Should().Contain(d =>d.Message.Contains("Invalid mapped_pages URL: \"https://www.elastic.co/guide/invalid uri with spaces\". All mapped_pages URLs must start with \"https://www.elastic.co/guide\""));
Collector.Diagnostics.Should().Contain(d =>d.Message.Contains("Invalid mapped_pages URL: \"not-a-uri-at-all\". All mapped_pages URLs must start with \"https://www.elastic.co/guide\""));
0 commit comments