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
Introduce a type_names crate to enhance consistency, readability, and maintainability of type names and implementing specialized naming conventions for TypeName, PropertyName, and RelationshipName. These changes ensure that each naming type enforces its own standard convention while centralizing logic for easier extensibility and reuse.
Implement methods on NamingConvention for converting, asserting, and detecting cases
- [ ] pub fn to_case(&self, input: &str) -> String // converts to this NamingConvention
- [ ] pub fn is_case(&self, input: &str) -> bool // asserts the supplied str conforms to this NamingConvention
- [ ] pub fn detect_case(input: &str) -> NamingConvention // Detects the naming convention of a given string. It uses precedence rules to resolve ambiguities.
Specialized TypeNames:
The following are all TypeNames. They are introduced to enhance type safety and to allow different naming conventions for different types
PropertyName -- specializes TypeName and enforces snake_case naming convention
evomimic
changed the title
Introduce TypeName Module with Standardized Naming Conventions
Introduce TypeName Crate with Standardized Naming Conventions
Dec 11, 2024
Introduce a
type_names
crate to enhance consistency, readability, and maintainability of type names and implementing specialized naming conventions for TypeName, PropertyName, and RelationshipName. These changes ensure that each naming type enforces its own standard convention while centralizing logic for easier extensibility and reuse.Dependencies
Crate Structure:
type_names crate
TypeName
TypeName is a specialized newtype wrapper around MapString that used as the key for all MAP Types.
Implement the following traits:
Deref
-- so TypeName can act like a MapString (avoiding the need to use .0)AsRef
-- to allow seamless borrowing of the inner MapStringBorrow
-- For usage in collections like HashMap or BTreeMapFrom
-- convenience for creating a TypeName from a MapString:Implement a
to_string
method that returns a clone of the inner MapStringNaming Conventions:
Leverage the Inflector crate to detect, convert, and assert string naming conventions.
Define a NamingConvention enum
pub enum NamingConvention { ClassCase, SnakeCase, ScreamingSnakeCase, }
Implement methods on NamingConvention for converting, asserting, and detecting cases
- [ ]
pub fn to_case(&self, input: &str) -> String
// converts to this NamingConvention- [ ]
pub fn is_case(&self, input: &str) -> bool
// asserts the supplied str conforms to this NamingConvention- [ ]
pub fn detect_case(input: &str) -> NamingConvention
// Detects the naming convention of a given string. It uses precedence rules to resolve ambiguities.Specialized TypeNames:
The following are all TypeNames. They are introduced to enhance type safety and to allow different naming conventions for different types
Public API
Handle Ripple Effects
Testing
Definition of Done
The text was updated successfully, but these errors were encountered: