Skip to content

Commit b11eb85

Browse files
authored
Merge branch 'master' into 419/callbacks
2 parents 8865201 + 002ab32 commit b11eb85

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fastapi_code_generator/__main__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def generate_code(
110110
output_dir: Path,
111111
template_dir: Optional[Path],
112112
model_path: Optional[Path] = None,
113-
enum_field_as_literal: Optional[str] = None,
114-
custom_visitors: Optional[List[Path]] = [],
113+
enum_field_as_literal: Optional[LiteralType] = None,
114+
custom_visitors: Optional[List[Path]] = None,
115115
disable_timestamp: bool = False,
116116
generate_routers: Optional[bool] = None,
117117
specify_tags: Optional[str] = None,
@@ -128,7 +128,8 @@ def generate_code(
128128
template_dir = (
129129
BUILTIN_MODULAR_TEMPLATE_DIR if generate_routers else BUILTIN_TEMPLATE_DIR
130130
)
131-
131+
if not custom_visitors:
132+
custom_visitors = []
132133
data_model_types = get_data_model_types(output_model_type, python_version)
133134

134135
parser = OpenAPIParser(
@@ -187,7 +188,7 @@ def generate_code(
187188
for tag in operation.tags:
188189
all_tags.append(tag)
189190
# Convert from Tag Names to router_names
190-
sorted_tags = sorted(set(all_tags))
191+
sorted_tags = sorted(set(all_tags), key=lambda x: x.lower())
191192
routers = sorted(
192193
[re.sub(TITLE_PATTERN, '_', tag.strip()).lower() for tag in sorted_tags]
193194
)

0 commit comments

Comments
 (0)