adwhit/diesel-derive-enum

Mappings are still generated if ExistingTypePath is used

Closed this issue · 1 comments

I'm trying to migrate project to diesel 2. I managed to successfully migrate one project to diesel 2 (project which uses diesel-derive-enum with ExistingTypePath).

ExistingTypePath just doesn't seem to do anything on this specific project.

If I specify invalid ExistingTypePath value like this in this project I get no compile error:

#[derive(Debug, Copy, Clone, PartialEq, Eq, diesel_derive_enum::DbEnum)]
#[ExistingTypePath("some::invalid::path")]
<...>

But of-course then I'm getting errors when trying to use this enum in diesel statements (missing trait implementations).

Expanding macros shows that mappings are still generated (see generate_new_diesel_mapping). Mappings shouldn't be called when ExistingTypePath is used right?

Expanded macro:

#[diesel(mysql_type(name = "Enum"))]
#[diesel(sqlite_type(name = "Text"))]
#[diesel(postgres_type(name = "my_enum_type"))]
pub struct MyEnumTypeMapping;

Project dependencies:

diesel = { version = "2.0.2", features = ["r2d2", "postgres", "chrono", "uuid"] }
diesel-derive-enum = { git = "https://github.com/adwhit/diesel-derive-enum.git", rev = "28a013d", features = ["postgres"] }
$ diesel -v:
diesel 2.0.1

I don't even know what other info to share in the issue, but maybe someone would know what the problem could be?

Oops, I used incorrect syntax:

This is invalid:

#[ExistingTypePath("some::path")]

This is valid:

#[ExistingTypePath = "some::path"]