Skip to content

Commit c08dccc

Browse files
committed
feat: allow enums in header parameters
(the currently supported) enums are int and string only, there's no reason not to allow them in headers (which is actually used in the wild).
1 parent 7955faa commit c08dccc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

openapi_python_client/parser/properties/enum_property.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import attr
66

7+
from ... import schema as oai
78
from ... import utils
89
from .property import Property
910
from .schemas import Class
@@ -22,6 +23,13 @@ class EnumProperty(Property):
2223

2324
template: ClassVar[str] = "enum_property.py.jinja"
2425

26+
_allowed_locations: ClassVar[Set[oai.ParameterLocation]] = {
27+
oai.ParameterLocation.QUERY,
28+
oai.ParameterLocation.PATH,
29+
oai.ParameterLocation.COOKIE,
30+
oai.ParameterLocation.HEADER,
31+
}
32+
2533
def get_base_type_string(self) -> str:
2634
return self.class_info.name
2735

0 commit comments

Comments
 (0)