modify: 性能优化
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import orjson
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ def generate_pydantic_code(
|
|||||||
if f.get("required", True):
|
if f.get("required", True):
|
||||||
if "default" in f:
|
if "default" in f:
|
||||||
default_repr = (
|
default_repr = (
|
||||||
json.dumps(f["default"])
|
orjson.dumps(f["default"]).decode()
|
||||||
if not isinstance(f["default"], str)
|
if not isinstance(f["default"], str)
|
||||||
else f"'{f['default']}'"
|
else f"'{f['default']}'"
|
||||||
)
|
)
|
||||||
@@ -173,7 +173,7 @@ def generate_pydantic_code(
|
|||||||
else:
|
else:
|
||||||
if "default" in f:
|
if "default" in f:
|
||||||
default_repr = (
|
default_repr = (
|
||||||
json.dumps(f["default"])
|
orjson.dumps(f["default"]).decode()
|
||||||
if not isinstance(f["default"], str)
|
if not isinstance(f["default"], str)
|
||||||
else f"'{f['default']}'"
|
else f"'{f['default']}'"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user