how to properly handle the camel naming in rust entity

Viewed 39

I am learning using rust to write a web service, now facing a problem that when I am compile my project, show warning like this:

warning: structure field `mvId` should have a snake case name
  --> src/biz/music/../../model/request/music/play_record_request.rs:18:9
   |
18 |     pub mvId: i64,
   |         ^^^^ help: convert the identifier to snake case: `mv_id`

this is the entity I am define:

#[derive(Debug, PartialEq, Eq, Deserialize,Serialize)]
pub struct PlayRecordRequest {
    pub id: i64,
    pub title: String,
    pub url: String,
    pub mvId: i64,
    pub album: Album,
    pub artist: Vec<Artist>
}

I could not rename the mvId to mv_id because the other system was named mvId so I must using mvId to receive. I have tried to find the allow annotation in rust like #[allow(non_camel_case_types)] but did not found the property annotation to handle this situation. what should I do to avoid this problem? any suggestion is grateful.

0 Answers
Related