feat: use #[validate(r#enum = ...) instead of #[validate(enumerate = ...)#111
Merged
feat: use #[validate(r#enum = ...) instead of #[validate(enumerate = ...)#111
#[validate(r#enum = ...) instead of #[validate(enumerate = ...)#111Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new r#enum validation attribute as a replacement for the deprecated enumerate attribute, aligning the API more closely with JSON Schema's "enum" keyword. The change maintains backward compatibility by keeping enumerate functional but deprecated.
Key changes:
- Added new
r#enumvalidation attribute alongside the existingenumerateattribute - Renamed internal functions and traits from
*enumerate*to*enum*variants - Added deprecation warnings for the old
enumerateattribute - Updated test files to use the new
r#enumsyntax
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
crates/serde_valid_derive/src/attribute.rs |
Added Enum = "r#enum" variant to the validation enum with PartialEq, Eq derives |
crates/serde_valid_derive/src/attribute/field_validate/meta/meta_name_value.rs |
Added warning system integration and deprecation notice for enumerate |
crates/serde_valid_derive/src/attribute/field_validate/generic/enum.rs |
Renamed functions from *enumerate* to *enum* variants |
crates/serde_valid_derive/src/attribute/field_validate/generic.rs |
Updated module import from enumerate to r#enum |
crates/serde_valid_derive/src/error.rs |
Renamed error function and filtered Enumerate from suggestions |
crates/serde_valid_derive/src/warning.rs |
Simplified function naming in warning generation |
crates/serde_valid/src/validation/generic/enum.rs |
Renamed trait from ValidateEnumerate to ValidateEnum with deprecated backward-compatible method |
crates/serde_valid/src/validation/generic.rs |
Re-exported both new and old trait names for compatibility |
crates/serde_valid/tests/*.rs |
Updated test files to use r#enum syntax |
crates/serde_valid/README.md |
Updated documentation to reference new r#enum attribute |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…age to `ValidateEnumerate`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.