Skip to content
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

String without max_length annotation is compiling #34

Closed
myOmikron opened this issue Jan 4, 2023 · 0 comments
Closed

String without max_length annotation is compiling #34

myOmikron opened this issue Jan 4, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@myOmikron
Copy link
Member

Give the following struct definition:

#[derive(Model)]
pub(crate) struct Trainer {
    #[rorm(id)]
    pub(crate) id: i64,
    #[rorm(on_delete = "Cascade")]
    pub(crate) user: ForeignModel<User>,
    pub(crate) trainer_name: String,
    pub(crate) trainer_sprite: i16,
    #[rorm(default = 0)]
    pub(crate) money: i32,
    #[rorm(field = "TrainerFriend::F.origin")]
    pub(crate) friends: BackRef<TrainerFriend>,
}

When exporting the .models.json: The following snippet is produced:
{"Name":"trainer_name","Type":"varchar","Annotations":[{"Type":"not_null"}]}

Intended behavior:
There should be a compile time error when trying to use a String without a max_length annotation

@myOmikron myOmikron added the bug Something isn't working label Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants