feat: Introduce the templated_uri crate family#265
Conversation
|
064cc90 to
5153dc6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #265 +/- ##
=========================================
Coverage 100.0% 100.0%
=========================================
Files 141 156 +15
Lines 8640 10801 +2161
=========================================
+ Hits 8640 10801 +2161 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
00578d3 to
c21aef9
Compare
# Conflicts: # .spelling
530fefd to
4dde26f
Compare
4dde26f to
01b8ba5
Compare
fe5df3f to
73be0ad
Compare
73be0ad to
f1c4899
Compare
|
Note that the logo I designed for when the crate was named "obscuri". The new name warrants a new logo. Also, you should update the PR title. |
|
Here are a bunch of things the AI recommends fixing: Analysis of
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new crate family for standards-compliant URI handling with templating, safety validation, and data classification support. However, there is a significant naming discrepancy: the PR title and description reference "obscuri" while the actual crate names are "templated_uri", "templated_uri_macros", and "templated_uri_macros_impl". The implementation provides RFC 6570 Level 3 compliant URI templating with compile-time safety guarantees and integration with the data_privacy crate for redaction support.
Changes:
- Adds three new crates:
templated_uri,templated_uri_macros, andtemplated_uri_macros_impl - Implements RFC 6570 URI templates with derive macros for type-safe URI construction
- Provides
UriSafetrait and validation to prevent URI injection vulnerabilities
Reviewed changes
Copilot reviewed 39 out of 40 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/templated_uri/src/lib.rs | Main library module with core types and re-exports |
| crates/templated_uri/src/uri.rs | Uri type implementation with templating support |
| crates/templated_uri/src/uri_safe.rs | UriSafe trait and validation logic |
| crates/templated_uri/src/uri_fragment.rs | Fragment traits for URI template parameters |
| crates/templated_uri/src/base_uri.rs | BaseUri type for scheme and authority handling |
| crates/templated_uri_macros/src/lib.rs | Procedural macro entry points |
| crates/templated_uri_macros_impl/src/lib.rs | Core macro implementation logic |
| crates/templated_uri_macros_impl/src/template_parser.rs | RFC 6570 template parser using chumsky |
| crates/templated_uri_macros_impl/src/struct_template.rs | Struct template macro implementation |
| crates/templated_uri_macros_impl/src/enum_template.rs | Enum template macro implementation |
| crates/templated_uri_macros_impl/src/uri_fragment.rs | Derive macro for UriFragment traits |
| Cargo.toml | Workspace dependency additions |
| README.md | Updated with new crate reference (naming issue) |
| CHANGELOG.md | Updated with new crate references (naming issues) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #![doc(html_logo_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/logo.png")] | ||
| #![doc(html_favicon_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/favicon.ico")] |
There was a problem hiding this comment.
The html_logo_url and html_favicon_url contain "CRATE_NAME" placeholder text that should be replaced with "templated_uri" to properly reference the assets for this specific crate.
| #![doc(html_logo_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/logo.png")] | |
| #![doc(html_favicon_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/favicon.ico")] | |
| #![doc(html_logo_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/templated_uri/logo.png")] | |
| #![doc(html_favicon_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/templated_uri/favicon.ico")] |
| #[expect(clippy::missing_panics_doc, reason = "impossible panic")] | ||
| pub fn with_port(self, port: u16) -> Self { | ||
| let host = self.authority.host(); | ||
| Self::new(self.scheme, format!("{host}:{port}")).expect("Scheme ahd host are already valid and port is a valid u16") |
There was a problem hiding this comment.
Typo in expect message: "ahd" should be "and". The message should read "Scheme and host are already valid..."
| Self::new(self.scheme, format!("{host}:{port}")).expect("Scheme ahd host are already valid and port is a valid u16") | |
| Self::new(self.scheme, format!("{host}:{port}")).expect("Scheme and host are already valid and port is a valid u16") |
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #![expect(clippy::option_if_let_else, reason = "Darling's macro exapansion currently uses this pattern")] |
There was a problem hiding this comment.
Typo in comment: "exapansion" should be "expansion".
| impl templated_uri::TemplatedPathAndQuery for #ident { | ||
| fn rfc_6570_template(&self) -> &'static core::primitive::str { | ||
| match self { | ||
| #(#variant_matches =>template_variant.rfc_6570_template()),* |
There was a problem hiding this comment.
Missing space after "=>". Should be => template_variant.rfc_6570_template() to match Rust formatting conventions.
| - [`data_privacy`](./crates/data_privacy/README.md) - Mechanisms to classify, manipulate, and redact sensitive data. | ||
| - [`fundle`](./crates/fundle/README.md) - Compile-time safe dependency injection for Rust. | ||
| - [`layered`](./crates/layered/README.md) - A foundational service abstraction for building composable, middleware-driven systems. | ||
| - [`obscuri`](./crates/obscuri/README.md) - Standards-compliant URI handling with templating, safety validation, and data classification |
There was a problem hiding this comment.
The PR title and description mention "obscuri" but the actual crate name is "templated_uri". This entry should read "templated_uri" instead of "obscuri" to match the actual crate name used throughout the codebase.
| description = "Standards-compliant URI handling with templating, safety validation, and data classification" | ||
| version = "0.1.0" | ||
| readme = "README.md" | ||
| keywords = ["oxidizer", "url", "psrsing", "templates", "uri"] |
There was a problem hiding this comment.
Typo in keyword: "psrsing" should be "parsing".
| keywords = ["oxidizer", "url", "psrsing", "templates", "uri"] | |
| keywords = ["oxidizer", "url", "parsing", "templates", "uri"] |
| #![doc(html_logo_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/logo.png")] | ||
| #![doc(html_favicon_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/favicon.ico")] |
There was a problem hiding this comment.
The html_logo_url and html_favicon_url contain "CRATE_NAME" placeholder text that should be replaced with "templated_uri_macros" to properly reference the assets for this specific crate.
| #![doc(html_logo_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/logo.png")] | |
| #![doc(html_favicon_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/CRATE_NAME/favicon.ico")] | |
| #![doc(html_logo_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/templated_uri_macros/logo.png")] | |
| #![doc(html_favicon_url = "https://media.githubusercontent.com/media/microsoft/oxidizer/refs/heads/main/crates/templated_uri_macros/favicon.ico")] |
| repository = "https://github.com/microsoft/oxidizer/tree/main/crates/templated_uri" | ||
|
|
||
| [package.metadata.cargo_check_external_types] | ||
| allowed_external_types = [ |
There was a problem hiding this comment.
I worry that we're having to expose all of these external types here. Are we OK coupling this crate to the http crate?
No description provided.