-
-
Notifications
You must be signed in to change notification settings - Fork 427
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
There is an extra underscore if I have an enum including a variant named replace.
To Reproduce
Example schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Action",
"enum": [
"append",
"prepend",
"replace"
]
}Used commandline:
$ datamodel-codegen \
--input-file-type jsonschema \
--output-model-type pydantic_v2.BaseModel \
--capitalise-enum-members \
--input test.json \
--output test.py
Expected behavior
What I want to get:
class Action(Enum):
APPEND = 'append'
PREPEND = 'prepend'
REPLACE = 'replace'What I actually got, noted that extra _ in REPLACE_.
class Action(Enum):
APPEND = 'append'
PREPEND = 'prepend'
REPLACE_ = 'replace'Version:
- OS: Linux
- Python version: 3.12
- datamodel-code-generator version: 0.53.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers