Skip to content

Commit 41e0234

Browse files
committed
add datamodel-codegen dep and generated models
1 parent d9f478c commit 41e0234

File tree

3 files changed

+2497
-22
lines changed

3 files changed

+2497
-22
lines changed

pyproject.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ dev = [
5858
"setuptools", # setuptools are used by pytest but not explicitly required
5959
"types-colorama<0.5.0",
6060
"werkzeug<4.0.0", # Werkzeug is used by pytest-httpserver
61+
"datamodel-code-generator[http,ruff]<1.0.0",
6162
]
6263

6364
[tool.hatch.build.targets.wheel]
@@ -138,6 +139,10 @@ indent-style = "space"
138139
"N999", # Invalid module name
139140
"T201", # print found
140141
]
142+
"src/apify_client/_models.py" = [
143+
"D", # Everything from the pydocstyle
144+
"E501", # Line too long
145+
]
141146

142147
[tool.ruff.lint.flake8-quotes]
143148
docstring-quotes = "double"
@@ -187,3 +192,21 @@ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:", "assert_never()"]
187192

188193
[tool.ipdb]
189194
context = 7
195+
196+
# https://koxudaxi.github.io/datamodel-code-generator/
197+
[tool.datamodel-codegen]
198+
url = "https://docs.apify.com/api/openapi.json"
199+
input_file_type = "openapi"
200+
output = "src/apify_client/_models.py"
201+
target_python_version = "3.10"
202+
output_model_type = "pydantic_v2.BaseModel"
203+
use_schema_description = true
204+
use_field_description = true
205+
use_union_operator = true
206+
capitalise_enum_members = true
207+
collapse_root_models = true
208+
set_default_enum_member = true
209+
use_annotated = true
210+
wrap_string_literal = true
211+
snake_case_field = true
212+
formatters = ["ruff-check", "ruff-format"]

0 commit comments

Comments
 (0)