zmievsa / cadwyn

Production-ready community-driven modern Stripe-like API versioning in FastAPI
https://docs.cadwyn.dev/
MIT License
212 stars 28 forks source link

Enum didn't exist migration still adds new value to all versions #171

Closed emilskra closed 4 months ago

emilskra commented 4 months ago

Enum didn't exist migration still adds new value to all versions. Should be added only to new api versions that comes after this migration.

Steps to reproduce the behavior:

  1. Add migration
    
    class MainEnum(enums.Enum):
    value_1 = 1
    value_2 = 2

class AddNewEnumValue(VersionChangeWithSideEffects): description = "Add new enum value."

instructions_to_migrate_to_previous_version = (
    enum(MainEnum).didnt_have("value_2"),

3. run schema generation

**Expected behavior**
New enum value is not copied to all versions, but remains only in latest
emilskra commented 4 months ago

It was a mistake from my side