-
Notifications
You must be signed in to change notification settings - Fork 17
feat(resource): support custom generated record names #432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,15 @@ impl Resource { | |
| /// Constraint identifier. | ||
| pub const NAME: &'static str = "quent.resource.v0.1.0"; | ||
|
|
||
| /// Encode this resource as a constraint payload. | ||
| /// | ||
| /// # Errors | ||
| /// | ||
| /// Returns an error if serialization fails. | ||
| pub fn constraint_data(&self) -> Result<String, serde_json::Error> { | ||
| serde_json::to_string(self) | ||
| } | ||
|
Comment on lines
+114
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Add direct coverage for the public payload contract. No changed test asserts that As per coding guidelines, “New Rust components must include accompanying tests.” 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
|
|
||
| /// Return the declared capacity names and definitions. | ||
| /// | ||
| /// Return `None` unless this is [`Self::Definition`]. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Cover equal names when no bounds record is produced.
The duplicate-name test only covers bounded capacities. Add a unit-resource or unbounded-capacity case with equal names and assert that
build()succeeds, matching thehas_boundscondition on Lines 106-108.As per coding guidelines, “New Rust components must include accompanying tests.”
🤖 Prompt for AI Agents
Source: Coding guidelines