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 8715 10941 +2226
=========================================
+ Hits 8715 10941 +2226 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
00578d3 to
c21aef9
Compare
# Conflicts: # .spelling
530fefd to
4dde26f
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.
f74cfac to
f42f75e
Compare
f42f75e to
d3012ee
Compare
d3012ee to
006a997
Compare
006a997 to
5e1a040
Compare
| /// According to RFC 6570, certain characters are reserved and must be percent-encoded. | ||
| /// This type ensures its content doesn't contain those reserved characters. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
| pub struct UriSafeString(Cow<'static, str>); |
There was a problem hiding this comment.
| pub struct UriSafeString(Cow<'static, str>); | |
| pub struct UriString(Cow<'static, str>); |
or UriParameter?
| } | ||
|
|
||
| /// Marks types that, when [`Display`ed](std::fmt::Display), are valid for URI use. | ||
| pub trait UriSafe: private::Sealed + Display + Debug {} |
There was a problem hiding this comment.
Can we unseal this trait?
I actually encountered a scenario where I have my own type that I want to mark as UriSafe.
Fixes:
Improvements: