-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
Enumeration String no longer supports certain characters #1851
Comments
I am not sure, but it seems the error originate from within the derive macro, may be related to the upgrade to |
SeaORM version proc-macro derive panicked
message: `""` is not a valid identifier code: //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.0
use sea_orm::entity::prelude::*;
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "cate")]
pub enum Cate {
#[sea_orm(string_value = "開ける")]
開ける,
} |
@tyt2y3 Could you reopen this issue? It is still not working on 0.12.15 |
can you open a PR to submit a failing test case? @ghsang |
I've updated the examples to 0.12.15 Reproducible Example
|
Hello, @tyt2y3. I'm pretty confident I've just found the source of the error in the master branch. It's occurring in sea-orm-macros\src\derives\active_enum.rs: ...
let enum_variant_iden = format_ident!("{}Variant", ident);
let enum_variants: Vec<syn::Ident> = str_variants
.iter()
.map(|v| {
let v_cleaned = camel_case_with_escaped_non_uax31(v); // It turns the string into empty
format_ident!("{}", v_cleaned) // Error occurs here
})
.collect();
... When I bypass #[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "status")]
pub enum Status {
#[sea_orm(string_value = "Open")]
Open,
#[sea_orm(string_value = "열려_있는")]
열려있는,
#[sea_orm(string_value = "打开")]
打开,
#[sea_orm(string_value = "開ける")]
開ける,
#[sea_orm(string_value = "Нээлттэй")]
Нээлттэй,
#[sea_orm(string_value = "Открыть")]
Открыть,
#[sea_orm(string_value = "يفتح")]
يفتح,
#[sea_orm(string_value = "Close")]
Close,
} |
@tyt2y3 I have opened a PR with a fix and a test case. |
Description
Create an enumeration, an error
proc-macro derive panicked message: ""
occurs when inputting most non-English languages as its value.Steps to Reproduce
sea-orm-cli generate entity -u sqlite://any.sqlite
to create any entity.Expected Behavior
The enumeration should be able to handle all supported characters without any errors.
Actual Behavior
An error occurs when most non-English languages are used as the enumeration value:
proc-macro derive panicked message: ""
.Reproduces How Often
The issue is consistently reproducible.
Workarounds
No workaround has been identified yet.
Reproducible Example
Please refer to this example link: Reproducible Example
Versions
SeaORM version: 0.12.0 and above.
The text was updated successfully, but these errors were encountered: