Skip to content

Reused enum type not schema extracted correctly #2857

Open

Description

When a type is used in 2 Go enums, the schema has that type missing from one of the enums. It's non-deterministic which enum loses.

//ftl:enum
type Animal interface{ animal() }
type Lion struct{}
type Dog struct{}

func (Lion) animal() {}
func (Dog) animal() {}

//ftl:enum
type Pet interface{ pet() }
type Cat struct{}

func (Cat) pet() {}
func (Dog) pet() {}

Will create either of these schemas:

  export enum Animal {
    Lion example.Lion
    Dog example.Dog
  }
  export enum Pet {
    Cat example.Cat
  }

☝️ Pet.Dog is missing

or:

  export enum Animal {
    Lion example.Lion
  }
  export enum Pet {
    Cat example.Cat
    Dog example.Dog
  }

☝️ Animal.Dog is missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    P1bugSomething isn't workinggoGo runtimenextWork that will be be picked up next

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions