Description
When regenerating entities with sea-orm-cli generate entity --expanded-format and preserve_user_modifications enabled, enum imports can be duplicated if the existing file uses grouped imports and the newly generated output uses individual imports.
This results in semantically duplicate use statements being emitted.
Steps to Reproduce
- Generate entities with:
sea-orm-cli generate entity --expanded-format
- Modify the generated file to group enum imports, e.g.:
use super::sea_orm_active_enums::{Status, Category};
- Re-run entity generation with
preserve_user_modifications enabled.
- Observe the merged output.
Expected Behavior
Only one import per enum path should exist in the merged output, e.g.:
use super::sea_orm_active_enums::Status;
use super::sea_orm_active_enums::Category;
(or the grouped form, but not both).
Actual Behavior
The merge produces duplicate imports:
use super::sea_orm_active_enums::{Status, Category};
use super::sea_orm_active_enums::Status;
use super::sea_orm_active_enums::Category;
Reproduces How Often
Always, given the grouped → individual import transition.
Workarounds
delete all generated code before generation
Versions
- sea-orm-cli: 2.0.0-rc.30
- sea-orm-codegen: 2.0.0-rc.30
- OS: macOS (also reproducible on Linux)
Description
When regenerating entities with
sea-orm-cli generate entity --expanded-formatandpreserve_user_modificationsenabled, enum imports can be duplicated if the existing file uses grouped imports and the newly generated output uses individual imports.This results in semantically duplicate
usestatements being emitted.Steps to Reproduce
preserve_user_modificationsenabled.Expected Behavior
Only one import per enum path should exist in the merged output, e.g.:
(or the grouped form, but not both).
Actual Behavior
The merge produces duplicate imports:
Reproduces How Often
Always, given the grouped → individual import transition.
Workarounds
delete all generated code before generation
Versions