Skip to content

Enum generation with strings including spaces and dashes fails #428

Description

@linaouro

Describe the bug
When running edgedb-py to create a query that includes and enum where the enum values contain spaces and/or dashes, the enum keys in the generated py source contain spaces and dashes too, leading to faulty syntax.

Reproduction
Create a query including an enum which contains spaces/dashes in their stirng values:

scalar type PROP_ENUM extending enum<"random", "some-value", "another space">;

select (insert object {
    id := <str>$id,
    some_prop := <PROP_ENUM>$some_prop,
  }
) { id, some_prop};

Generated code:

class PropEnum(enum.Enum):
    RANDOM= "random"
    SOME-VALUE= "some-value"
    ANOTHER SPACE= "another space"

Expected behavior
It should replace the spaces and dashes in the enum keys by underscores.

Versions (please complete the following information):

  • OS: Ubuntu 0.04.5 LTS (Focal Fossa)
  • EdgeDB version: 2.15+75c3494
  • EdgeDB CLI version: 3.0.0+8b024db
  • edgedb-python version: 1.3.0
  • Python version: 3.10.10

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions