Skip to content

Commit 53d28a8

Browse files
committed
Add docs & changeset
1 parent 125ae6a commit 53d28a8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
default: minor
3+
---
4+
5+
# Add `literal_enums` config setting
6+
7+
Instead of the default `Enum` classes for enums, you can now generate `Literal` sets wherever `enum` appears in the OpenAPI spec by setting `literal_enums: true` in your config file.
8+
9+
```yaml
10+
literal_enums: true
11+
```
12+
13+
Thanks to @emosenkis for PR #1114 closes #587, #725, #1076, and probably many more.
14+
Thanks also to @eli-bl, @expobrain, @theorm, @chrisguillory, and anyone else who helped getting to this design!

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ class_overrides:
9797
9898
The easiest way to find what needs to be overridden is probably to generate your client and go look at everything in the `models` folder.
9999

100+
### literal_enums
101+
102+
By default, `openapi-python-client` generates classes inheriting for `Enum` for enums. It can instead use `Literal`
103+
values for enums by setting this to `true`:
104+
105+
```yaml
106+
literal_enums: true
107+
```
108+
109+
This is especially useful if enum values, when transformed to their Python names, end up conflicting due to case sensitivity or special symbols.
110+
100111
### project_name_override and package_name_override
101112

102113
Used to change the name of generated client library project/package. If the project name is changed but an override for the package name

0 commit comments

Comments
 (0)