drf-to-mkdoc 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of drf-to-mkdoc might be problematic. Click here for more details.
- drf_to_mkdoc/conf/settings.py +0 -2
- drf_to_mkdoc/templates/endpoints/detail/base.html +33 -0
- drf_to_mkdoc/templates/endpoints/detail/path_parameters.html +8 -0
- drf_to_mkdoc/templates/endpoints/detail/query_parameters.html +43 -0
- drf_to_mkdoc/templates/endpoints/detail/request_body.html +10 -0
- drf_to_mkdoc/templates/endpoints/detail/responses.html +18 -0
- drf_to_mkdoc/templates/endpoints/list/base.html +23 -0
- drf_to_mkdoc/templates/endpoints/list/endpoint_card.html +18 -0
- drf_to_mkdoc/templates/endpoints/list/filter_section.html +16 -0
- drf_to_mkdoc/templates/endpoints/list/filters/app.html +8 -0
- drf_to_mkdoc/templates/endpoints/list/filters/method.html +12 -0
- drf_to_mkdoc/templates/endpoints/list/filters/path.html +5 -0
- drf_to_mkdoc/templates/endpoints/list/filters/search.html +9 -0
- drf_to_mkdoc/templates/model_detail/base.html +34 -0
- drf_to_mkdoc/templates/model_detail/choices.html +12 -0
- drf_to_mkdoc/templates/model_detail/fields.html +11 -0
- drf_to_mkdoc/templates/model_detail/meta.html +6 -0
- drf_to_mkdoc/templates/model_detail/methods.html +9 -0
- drf_to_mkdoc/templates/model_detail/relationships.html +8 -0
- drf_to_mkdoc/templates/models_index.html +24 -0
- drf_to_mkdoc/templatetags/custom_filters.py +116 -0
- drf_to_mkdoc/utils/endpoint_detail_generator.py +79 -168
- drf_to_mkdoc/utils/endpoint_list_generator.py +58 -193
- drf_to_mkdoc/utils/model_detail_generator.py +22 -202
- drf_to_mkdoc/utils/model_list_generator.py +26 -44
- drf_to_mkdoc/utils/schema.py +1 -1
- {drf_to_mkdoc-0.2.1.dist-info → drf_to_mkdoc-0.2.2.dist-info}/METADATA +1 -1
- {drf_to_mkdoc-0.2.1.dist-info → drf_to_mkdoc-0.2.2.dist-info}/RECORD +31 -13
- drf_to_mkdoc/utils/md_generators/__init__.py +0 -0
- drf_to_mkdoc/utils/md_generators/query_parameters_generators.py +0 -72
- {drf_to_mkdoc-0.2.1.dist-info → drf_to_mkdoc-0.2.2.dist-info}/WHEEL +0 -0
- {drf_to_mkdoc-0.2.1.dist-info → drf_to_mkdoc-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {drf_to_mkdoc-0.2.1.dist-info → drf_to_mkdoc-0.2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
+
from django.template.loader import render_to_string
|
|
3
4
|
from django.templatetags.static import static
|
|
4
5
|
|
|
5
6
|
from drf_to_mkdoc.conf.settings import drf_to_mkdoc_settings
|
|
@@ -27,216 +28,35 @@ def generate_model_docs(models_data: dict[str, Any]) -> None:
|
|
|
27
28
|
write_file(file_path, content)
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
def render_column_fields_table(fields: dict[str, Any]) -> str:
|
|
31
|
-
"""Render the fields table for a model."""
|
|
32
|
-
content = "## Fields\n\n"
|
|
33
|
-
content += "| Field | Type | Description | Extra |\n"
|
|
34
|
-
content += "|-------|------|-------------|-------|\n"
|
|
35
|
-
|
|
36
|
-
for field_name, field_info in fields.items():
|
|
37
|
-
field_type = field_info.get("type", "Unknown")
|
|
38
|
-
verbose_name = field_info.get("verbose_name", field_name)
|
|
39
|
-
help_text = field_info.get("help_text", "")
|
|
40
|
-
|
|
41
|
-
display_name = field_name
|
|
42
|
-
if field_type in ["ForeignKey", "OneToOneField"]:
|
|
43
|
-
display_name = f"{field_name}_id"
|
|
44
|
-
|
|
45
|
-
extra_info = []
|
|
46
|
-
if field_info.get("null"):
|
|
47
|
-
extra_info.append("null=True")
|
|
48
|
-
if field_info.get("blank"):
|
|
49
|
-
extra_info.append("blank=True")
|
|
50
|
-
if field_info.get("unique"):
|
|
51
|
-
extra_info.append("unique=True")
|
|
52
|
-
if field_info.get("primary_key"):
|
|
53
|
-
extra_info.append("primary_key=True")
|
|
54
|
-
if field_info.get("default"):
|
|
55
|
-
extra_info.append(f"default={field_info['default']}")
|
|
56
|
-
|
|
57
|
-
field_specific = field_info.get("field_specific", {})
|
|
58
|
-
for key, value in field_specific.items():
|
|
59
|
-
if key not in ["related_name", "related_query_name", "to"]:
|
|
60
|
-
extra_info.append(f"{key}={value}")
|
|
61
|
-
|
|
62
|
-
extra_str = ", ".join(extra_info) if extra_info else ""
|
|
63
|
-
description_str = help_text or verbose_name
|
|
64
|
-
|
|
65
|
-
content += f"| `{display_name}` | {field_type} | {description_str} | {extra_str} |\n"
|
|
66
|
-
|
|
67
|
-
return content
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def render_choices_tables(fields: dict[str, Any]) -> str:
|
|
71
|
-
"""Render choice tables for fields with choices."""
|
|
72
|
-
choice_tables = []
|
|
73
|
-
|
|
74
|
-
for field_name, field_info in fields.items():
|
|
75
|
-
choices = field_info.get("choices")
|
|
76
|
-
if choices:
|
|
77
|
-
table = f"### {field_name} Choices\n\n"
|
|
78
|
-
table += "| Label | Value |\n"
|
|
79
|
-
table += "|-------|--------|\n"
|
|
80
|
-
for choice in choices:
|
|
81
|
-
table += f"| {choice['display']} | `{choice['value']}` |\n"
|
|
82
|
-
table += "\n"
|
|
83
|
-
choice_tables.append(table)
|
|
84
|
-
|
|
85
|
-
if choice_tables:
|
|
86
|
-
return "## Choices\n\n" + "\n".join(choice_tables)
|
|
87
|
-
return ""
|
|
88
|
-
|
|
89
|
-
|
|
90
31
|
def create_model_page(model_info: dict[str, Any]) -> str:
|
|
91
32
|
"""Create a model documentation page from model info"""
|
|
92
33
|
name = model_info.get("name", "Unknown")
|
|
93
34
|
app_label = model_info.get("app_label", "unknown")
|
|
94
35
|
table_name = model_info.get("table_name", "")
|
|
95
36
|
description = get_model_description(name)
|
|
37
|
+
column_fields = model_info.get("column_fields", {})
|
|
96
38
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
content += _add_relationships_section(model_info)
|
|
100
|
-
content += _add_methods_section(model_info)
|
|
101
|
-
content += _add_meta_options_section(model_info)
|
|
102
|
-
|
|
103
|
-
return content
|
|
104
|
-
|
|
39
|
+
# Check if any fields have choices
|
|
40
|
+
has_choices = any(field_info.get("choices") for field_info in column_fields.values())
|
|
105
41
|
|
|
106
|
-
def _create_model_header(name: str, app_label: str, table_name: str, description: str) -> str:
|
|
107
|
-
"""Create the header section of the model documentation."""
|
|
108
42
|
stylesheets = [
|
|
109
|
-
"stylesheets/models/variables.css",
|
|
110
|
-
"stylesheets/models/base.css",
|
|
111
|
-
"stylesheets/models/model-tables.css",
|
|
112
|
-
"stylesheets/models/responsive.css",
|
|
43
|
+
static(f"{drf_to_mkdoc_settings.PROJECT_NAME}/stylesheets/models/variables.css"),
|
|
44
|
+
static(f"{drf_to_mkdoc_settings.PROJECT_NAME}/stylesheets/models/base.css"),
|
|
45
|
+
static(f"{drf_to_mkdoc_settings.PROJECT_NAME}/stylesheets/models/model-tables.css"),
|
|
46
|
+
static(f"{drf_to_mkdoc_settings.PROJECT_NAME}/stylesheets/models/responsive.css"),
|
|
113
47
|
]
|
|
114
|
-
prefix_path = f"{drf_to_mkdoc_settings.PROJECT_NAME}/"
|
|
115
|
-
css_links = "\n".join(
|
|
116
|
-
f'<link rel="stylesheet" href="{static(prefix_path + path)}">' for path in stylesheets
|
|
117
|
-
)
|
|
118
|
-
return f"""# {name}
|
|
119
|
-
|
|
120
|
-
<!-- inject CSS directly -->
|
|
121
|
-
{css_links}
|
|
122
|
-
|
|
123
|
-
**App:** {app_label}
|
|
124
|
-
**Table:** `{table_name}`
|
|
125
|
-
|
|
126
|
-
## Description
|
|
127
|
-
|
|
128
|
-
{description}
|
|
129
|
-
|
|
130
|
-
"""
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
def _add_fields_section(model_info: dict[str, Any]) -> str:
|
|
134
|
-
"""Add the fields section to the model documentation."""
|
|
135
|
-
column_fields = model_info.get("column_fields", {})
|
|
136
|
-
if not column_fields:
|
|
137
|
-
return ""
|
|
138
|
-
|
|
139
|
-
content = ""
|
|
140
|
-
|
|
141
|
-
column_fields_content = render_column_fields_table(column_fields)
|
|
142
|
-
if column_fields_content:
|
|
143
|
-
content += column_fields_content
|
|
144
|
-
content += "\n"
|
|
145
|
-
|
|
146
|
-
choices_content = render_choices_tables(column_fields)
|
|
147
|
-
if choices_content:
|
|
148
|
-
content += choices_content
|
|
149
|
-
content += "\n"
|
|
150
|
-
|
|
151
|
-
return content
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def _add_relationships_section(model_info: dict[str, Any]) -> str:
|
|
155
|
-
"""Add the relationships section to the model documentation."""
|
|
156
|
-
relationship_fields = model_info.get("relationships", {})
|
|
157
|
-
if not relationship_fields:
|
|
158
|
-
return ""
|
|
159
|
-
|
|
160
|
-
content = "## Relationships\n\n"
|
|
161
|
-
content += "| Field | Type | Related Model |\n"
|
|
162
|
-
content += "|-------|------|---------------|\n"
|
|
163
|
-
|
|
164
|
-
content += _render_relationship_fields(relationship_fields)
|
|
165
|
-
content += _render_relationships_from_section(relationship_fields)
|
|
166
|
-
content += "\n"
|
|
167
|
-
|
|
168
|
-
return content
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
def _render_relationship_fields(relationship_fields: dict[str, Any]) -> str:
|
|
172
|
-
"""Render relationship fields from the fields section."""
|
|
173
|
-
content = ""
|
|
174
|
-
for field_name, field_info in relationship_fields.items():
|
|
175
|
-
field_type = field_info.get("type", "Unknown")
|
|
176
|
-
field_specific = field_info.get("field_specific", {})
|
|
177
|
-
to_model = field_specific.get("to", "")
|
|
178
|
-
|
|
179
|
-
if to_model:
|
|
180
|
-
model_link = _create_model_link(to_model)
|
|
181
|
-
content += f"| `{field_name}` | {field_type} | {model_link}|\n"
|
|
182
|
-
|
|
183
|
-
return content
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
def _render_relationships_from_section(relationships: dict[str, Any]) -> str:
|
|
187
|
-
"""Render relationships from the relationships section."""
|
|
188
|
-
content = ""
|
|
189
|
-
for rel_name, rel_info in relationships.items():
|
|
190
|
-
rel_type = rel_info.get("type", "Unknown")
|
|
191
|
-
|
|
192
|
-
app_label = rel_info["app_label"]
|
|
193
|
-
table_name = rel_info["table_name"]
|
|
194
|
-
verbose_name = rel_info["verbose_name"]
|
|
195
|
-
|
|
196
|
-
model_link = f"[{verbose_name.capitalize()}](../../{app_label}/{table_name}/)"
|
|
197
|
-
|
|
198
|
-
content += f"| `{rel_name}` | {rel_type} | {model_link} | \n"
|
|
199
|
-
|
|
200
|
-
return content
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
def _create_model_link(to_model: str) -> str:
|
|
204
|
-
"""Create a link to a related model."""
|
|
205
|
-
if "." in to_model:
|
|
206
|
-
related_app, related_model = to_model.split(".", 1)
|
|
207
|
-
return f"[{related_model}](../{related_app}/{related_model.lower()}/)"
|
|
208
|
-
return f"[{to_model}]({to_model.lower()}/)"
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def _add_methods_section(model_info: dict[str, Any]) -> str:
|
|
212
|
-
"""Add the methods section to the model documentation."""
|
|
213
|
-
methods = model_info.get("methods", [])
|
|
214
|
-
if not methods:
|
|
215
|
-
return ""
|
|
216
|
-
|
|
217
|
-
content = "## Methods\n\n"
|
|
218
|
-
for method in methods:
|
|
219
|
-
method_name = method.get("name", "")
|
|
220
|
-
docstring = method.get("docstring", "")
|
|
221
|
-
|
|
222
|
-
content += f"### `{method_name}()`\n\n"
|
|
223
|
-
if docstring:
|
|
224
|
-
content += f"{docstring}\n\n"
|
|
225
|
-
else:
|
|
226
|
-
content += "No documentation available.\n\n"
|
|
227
|
-
|
|
228
|
-
return content
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
def _add_meta_options_section(model_info: dict[str, Any]) -> str:
|
|
232
|
-
"""Add the meta options section to the model documentation."""
|
|
233
|
-
meta_options = model_info.get("meta_options", {})
|
|
234
|
-
if not meta_options:
|
|
235
|
-
return ""
|
|
236
|
-
|
|
237
|
-
content = "## Meta Options\n\n"
|
|
238
|
-
for option, value in meta_options.items():
|
|
239
|
-
content += f"- **{option}:** {value}\n"
|
|
240
|
-
content += "\n"
|
|
241
48
|
|
|
242
|
-
|
|
49
|
+
context = {
|
|
50
|
+
"name": name,
|
|
51
|
+
"app_label": app_label,
|
|
52
|
+
"table_name": table_name,
|
|
53
|
+
"description": description,
|
|
54
|
+
"stylesheets": stylesheets,
|
|
55
|
+
"fields": column_fields, # Changed from column_fields to fields for template consistency
|
|
56
|
+
"has_choices": has_choices, # Added choices flag
|
|
57
|
+
"relationships": model_info.get("relationships", {}),
|
|
58
|
+
"methods": model_info.get("methods", []),
|
|
59
|
+
"meta_options": model_info.get("meta_options", {}),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return render_to_string("model_detail/base.html", context)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
from html import escape
|
|
2
1
|
from pathlib import Path
|
|
3
2
|
from typing import Any
|
|
4
|
-
from urllib.parse import quote
|
|
5
3
|
|
|
4
|
+
from django.template.loader import render_to_string
|
|
6
5
|
from django.templatetags.static import static
|
|
7
6
|
|
|
8
7
|
from drf_to_mkdoc.conf.settings import drf_to_mkdoc_settings
|
|
@@ -12,44 +11,22 @@ from drf_to_mkdoc.utils.commons.model_utils import get_app_descriptions
|
|
|
12
11
|
def create_models_index(models_data: dict[str, Any], docs_dir: Path) -> None:
|
|
13
12
|
"""Create the main models index page that lists all models organized by app."""
|
|
14
13
|
stylesheets = [
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
static(f"{drf_to_mkdoc_settings.PROJECT_NAME}/{path}")
|
|
15
|
+
for path in [
|
|
16
|
+
"stylesheets/models/variables.css",
|
|
17
|
+
"stylesheets/models/base.css",
|
|
18
|
+
"stylesheets/models/model-cards.css",
|
|
19
|
+
"stylesheets/models/responsive.css",
|
|
20
|
+
"stylesheets/models/animations.css",
|
|
21
|
+
]
|
|
20
22
|
]
|
|
21
|
-
prefix_path = f"{drf_to_mkdoc_settings.PROJECT_NAME}/"
|
|
22
|
-
css_links = "\n".join(
|
|
23
|
-
f'<link rel="stylesheet" href="{static(prefix_path + path)}">' for path in stylesheets
|
|
24
|
-
)
|
|
25
|
-
content = f"""# Django Models
|
|
26
|
-
|
|
27
|
-
This section contains documentation for all Django models in the system, organized by Django application.
|
|
28
|
-
|
|
29
|
-
<!-- inject CSS directly -->
|
|
30
|
-
{css_links}
|
|
31
|
-
|
|
32
|
-
<div class="models-container">
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
app_descriptions = get_app_descriptions()
|
|
36
23
|
|
|
24
|
+
sorted_models = []
|
|
37
25
|
for app_name, models in sorted(models_data.items()):
|
|
38
|
-
app_desc = escape(
|
|
39
|
-
app_descriptions.get(
|
|
40
|
-
app_name, f"{app_name.replace('_', ' ').title()} application models"
|
|
41
|
-
)
|
|
42
|
-
)
|
|
43
|
-
app_title = escape(app_name.replace("_", " ").title())
|
|
44
|
-
content += f'<div class="app-header">{app_title} App</div>\n'
|
|
45
|
-
content += f'<div class="app-description">{app_desc}</div>\n\n'
|
|
46
|
-
|
|
47
|
-
content += '<div class="model-cards">\n'
|
|
48
|
-
|
|
49
26
|
model_names = sorted(
|
|
50
27
|
[
|
|
51
28
|
(
|
|
52
|
-
str(mi.get("verbose_name") or mk),
|
|
29
|
+
str(mi.get("verbose_name") or mk).capitalize(),
|
|
53
30
|
str(mi.get("table_name") or mk),
|
|
54
31
|
)
|
|
55
32
|
for mk, mi in models.items()
|
|
@@ -57,18 +34,23 @@ This section contains documentation for all Django models in the system, organiz
|
|
|
57
34
|
],
|
|
58
35
|
key=lambda x: x[0].casefold(),
|
|
59
36
|
)
|
|
60
|
-
|
|
61
|
-
content += f"""
|
|
62
|
-
<a href="{quote(app_name, safe="")}/{quote(table_name, safe="")}/"
|
|
63
|
-
class="model-card">{escape(verbose_name)}</a>\n
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
content += "</div>\n\n"
|
|
67
|
-
|
|
68
|
-
content += """</div>
|
|
37
|
+
sorted_models.append((app_name, model_names))
|
|
69
38
|
|
|
39
|
+
app_descriptions = get_app_descriptions()
|
|
40
|
+
for app_name, _ in sorted_models:
|
|
41
|
+
if app_name not in app_descriptions:
|
|
42
|
+
app_descriptions[app_name] = (
|
|
43
|
+
f"{app_name.replace('_', ' ').title()} application models"
|
|
44
|
+
)
|
|
70
45
|
|
|
71
|
-
|
|
46
|
+
content = render_to_string(
|
|
47
|
+
"models_index.html",
|
|
48
|
+
{
|
|
49
|
+
"stylesheets": stylesheets,
|
|
50
|
+
"sorted_models": sorted_models,
|
|
51
|
+
"app_descriptions": app_descriptions,
|
|
52
|
+
},
|
|
53
|
+
)
|
|
72
54
|
|
|
73
55
|
models_index_path = docs_dir / "models" / "index.md"
|
|
74
56
|
models_index_path.parent.mkdir(parents=True, exist_ok=True)
|
drf_to_mkdoc/utils/schema.py
CHANGED
|
@@ -58,7 +58,7 @@ class ViewMetadataExtractor:
|
|
|
58
58
|
|
|
59
59
|
try:
|
|
60
60
|
serializer_cls = self.view_instance.get_serializer_class()
|
|
61
|
-
except
|
|
61
|
+
except Exception as e:
|
|
62
62
|
logger.debug(f"Failed to get serializer from view instance: {e}")
|
|
63
63
|
return None
|
|
64
64
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: drf-to-mkdoc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Generate Markdown API docs from Django/DRF OpenAPI schema for MkDocs
|
|
5
5
|
Author-email: Hossein Shayesteh <shayestehhs1@gmail.com>
|
|
6
6
|
Maintainer-email: Hossein Shayesteh <shayestehhs1@gmail.com>
|
|
@@ -2,7 +2,7 @@ drf_to_mkdoc/__init__.py,sha256=IbTW5uKQvJRG9ncHRuk_AGKHPn4ruxs5LqDpUFgUhws,180
|
|
|
2
2
|
drf_to_mkdoc/apps.py,sha256=-NrC_dRr6GmLmNQhkNh819B7V1SS4DYDv5JOR0TtuJM,560
|
|
3
3
|
drf_to_mkdoc/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
drf_to_mkdoc/conf/defaults.py,sha256=iG5ssgaJgDoI92cyCDCHmuY1uvMCeU8T0D3gxrDPWYM,986
|
|
5
|
-
drf_to_mkdoc/conf/settings.py,sha256=
|
|
5
|
+
drf_to_mkdoc/conf/settings.py,sha256=3f268CZzyf9KYab6EvsjIVXP6KBik1k_B4JyJpXDwrU,5456
|
|
6
6
|
drf_to_mkdoc/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
drf_to_mkdoc/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
drf_to_mkdoc/management/commands/build_docs.py,sha256=k2N8i7sNWPJGVzUSdkDu47FleCSjIxClRq1dWBHwhjQ,4057
|
|
@@ -36,12 +36,32 @@ drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-cards.css,sha256=IppCO
|
|
|
36
36
|
drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-tables.css,sha256=8CSy8YdFOJ3lGZ3sTVz2jd8cIxIryubQFrwcygAw06w,1352
|
|
37
37
|
drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/responsive.css,sha256=ygqyUtpiWchTBBIQil1C6mN0AC5xinLoP7whSKfBmwg,944
|
|
38
38
|
drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/variables.css,sha256=2HvyjnJrygSzdzpE-FYpo6FGhrYhmZ7NwDFAkADXQNg,1094
|
|
39
|
+
drf_to_mkdoc/templates/models_index.html,sha256=A_Lu3wFMG2Nf8Bv4zttz3e0gZpxBcvDjSvX_rfOYdeI,837
|
|
40
|
+
drf_to_mkdoc/templates/endpoints/detail/base.html,sha256=7aAjSjt6mgOMuvDlC2MQKg70i5fcK9Pi_SzTNoRUNm8,822
|
|
41
|
+
drf_to_mkdoc/templates/endpoints/detail/path_parameters.html,sha256=M7OPUg88e3bw01rZpZUVahZzlq3JFaxZDsnDx2Xizx8,310
|
|
42
|
+
drf_to_mkdoc/templates/endpoints/detail/query_parameters.html,sha256=Dx_mM2qjwFcfMWTYoEoNyPS588V_wanrHS7qh-uUGUg,1075
|
|
43
|
+
drf_to_mkdoc/templates/endpoints/detail/request_body.html,sha256=-9wacJIQOS-lC2zE31rPaeGs_SkOVm1tAJvebLW6zME,149
|
|
44
|
+
drf_to_mkdoc/templates/endpoints/detail/responses.html,sha256=jDTkiCUAe8vbRT6fF2Igtr-26z7maeUYNYv4q-n9-9w,293
|
|
45
|
+
drf_to_mkdoc/templates/endpoints/list/base.html,sha256=l4A4VmDvDkMKim15feh0DoJkCf2V83EoI4wISUjf4Kc,602
|
|
46
|
+
drf_to_mkdoc/templates/endpoints/list/endpoint_card.html,sha256=PesI9Dlt2kAU1AKcMNGUzIA3lzGcncX-Na0HYiwbR28,1114
|
|
47
|
+
drf_to_mkdoc/templates/endpoints/list/filter_section.html,sha256=oSc7UQazpQptYE_rZz_PHnOQPpQDOff0r4a0sYbtQnk,559
|
|
48
|
+
drf_to_mkdoc/templates/endpoints/list/filters/app.html,sha256=vjY0GGg1UGKKb2JAIaw-kCWkoWiA7rQzvifa7pObPXU,225
|
|
49
|
+
drf_to_mkdoc/templates/endpoints/list/filters/method.html,sha256=B9WHuuScIF45QRGv1wZVocCKMPUvyuEDg_gMaE02NXc,410
|
|
50
|
+
drf_to_mkdoc/templates/endpoints/list/filters/path.html,sha256=ZKq50BJu9AYdjiY2TXxhM8c8ivz6M8J_aZIC_q2gVvE,180
|
|
51
|
+
drf_to_mkdoc/templates/endpoints/list/filters/search.html,sha256=NbndD69M-iwFf-BXMo7rsHh1lrZnf6hiZGkPtGF1hU4,280
|
|
52
|
+
drf_to_mkdoc/templates/model_detail/base.html,sha256=uJaGnFwfv68uJgWJA85Svs7MXPQ-dXi3-SJgR9GfiNM,731
|
|
53
|
+
drf_to_mkdoc/templates/model_detail/choices.html,sha256=-DAbUpr5jXL_e8r--KkdRXGZuF94_TuVmN17WQDltk0,304
|
|
54
|
+
drf_to_mkdoc/templates/model_detail/fields.html,sha256=dOYhfwFJThAuG65r8i6_A9budCTNsZ1pQRCGgAKdFAc,1163
|
|
55
|
+
drf_to_mkdoc/templates/model_detail/meta.html,sha256=idbnQhV1dT_zLQDD3jZ21vXqLjCxLXIk4rdCiWHm04s,109
|
|
56
|
+
drf_to_mkdoc/templates/model_detail/methods.html,sha256=QZzp8sGKxuyM6_6GXDNnpKUJw0n_cF5CljklduyALTo,143
|
|
57
|
+
drf_to_mkdoc/templates/model_detail/relationships.html,sha256=GK7mip_-_4qxxM7MGmV3HXqiV6X9QkeBtz7oy4xZs4Q,796
|
|
58
|
+
drf_to_mkdoc/templatetags/custom_filters.py,sha256=2QoestQNjNvA6WJpgnXQ0avJQPzKs3d9Mea0QQLwcD0,2974
|
|
39
59
|
drf_to_mkdoc/utils/__init__.py,sha256=6dFTb07S6yIf-INMy0Mlgf5purNir687ZU9WZtITh4k,68
|
|
40
|
-
drf_to_mkdoc/utils/endpoint_detail_generator.py,sha256=
|
|
41
|
-
drf_to_mkdoc/utils/endpoint_list_generator.py,sha256=
|
|
42
|
-
drf_to_mkdoc/utils/model_detail_generator.py,sha256=
|
|
43
|
-
drf_to_mkdoc/utils/model_list_generator.py,sha256=
|
|
44
|
-
drf_to_mkdoc/utils/schema.py,sha256=
|
|
60
|
+
drf_to_mkdoc/utils/endpoint_detail_generator.py,sha256=aVLYRUHW6dW8sVwSdM-iyyiJ3dXPjXimbUx1i37vVHs,24160
|
|
61
|
+
drf_to_mkdoc/utils/endpoint_list_generator.py,sha256=yVX7qVUTuKF3TPFgm6FI-vVsVZQ7XHMXmZZalgSN8pk,3579
|
|
62
|
+
drf_to_mkdoc/utils/model_detail_generator.py,sha256=_ac2PYSzSwRUgUn-J-nmg7mfQGn8SU_4vkMpMRIxgEU,2619
|
|
63
|
+
drf_to_mkdoc/utils/model_list_generator.py,sha256=Ki-CwIYKmUbPm3_jUPLPosPfppyVLrZMkqbuPPO3Ycw,1988
|
|
64
|
+
drf_to_mkdoc/utils/schema.py,sha256=sDhVITdIFp1TJYnqCd4wF69i-lwXGlTsNJ2-ngXkccc,10070
|
|
45
65
|
drf_to_mkdoc/utils/ai_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
66
|
drf_to_mkdoc/utils/ai_tools/enums.py,sha256=K39bJjHgXwNst2NL6z-5bztW3ZU5iCxg2b0KEodD6eM,238
|
|
47
67
|
drf_to_mkdoc/utils/ai_tools/exceptions.py,sha256=yFauOtuSRGRnQt41u2qCMvWEbN0eblgKwXuH-GX3Wbk,634
|
|
@@ -58,10 +78,8 @@ drf_to_mkdoc/utils/commons/path_utils.py,sha256=Pi9g1xXDPsRzmn4kTeNSVtXG9v6n1h2Z
|
|
|
58
78
|
drf_to_mkdoc/utils/commons/schema_utils.py,sha256=0sw3zp0onsF3NVv4ImpHbXfypTA2yIIFMIId_D9NZfg,7837
|
|
59
79
|
drf_to_mkdoc/utils/extractors/__init__.py,sha256=BvC8gKOPVI9gU1Piw0jRhKQ2ER5s1moAxgq7ZYkJWNI,86
|
|
60
80
|
drf_to_mkdoc/utils/extractors/query_parameter_extractors.py,sha256=5QY5_PGQ5XpXRL9ZLr0570ywPcygQ8ZxnlfnSCHhnF0,8540
|
|
61
|
-
drf_to_mkdoc/
|
|
62
|
-
drf_to_mkdoc/
|
|
63
|
-
drf_to_mkdoc-0.2.
|
|
64
|
-
drf_to_mkdoc-0.2.
|
|
65
|
-
drf_to_mkdoc-0.2.
|
|
66
|
-
drf_to_mkdoc-0.2.1.dist-info/top_level.txt,sha256=ZzJecR6j_tvLZiubUBEgawHflozC4DQy9ooNf1yDJ3Q,13
|
|
67
|
-
drf_to_mkdoc-0.2.1.dist-info/RECORD,,
|
|
81
|
+
drf_to_mkdoc-0.2.2.dist-info/licenses/LICENSE,sha256=3n9_ckIREsH8ogCxWW6dFsw_WfGcluG2mHcgl9i_UU0,1068
|
|
82
|
+
drf_to_mkdoc-0.2.2.dist-info/METADATA,sha256=GQZJJrWXIfIDC_oSm_Y4DqvfwWBamJs1AIK_LzbflX0,7563
|
|
83
|
+
drf_to_mkdoc-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
84
|
+
drf_to_mkdoc-0.2.2.dist-info/top_level.txt,sha256=ZzJecR6j_tvLZiubUBEgawHflozC4DQy9ooNf1yDJ3Q,13
|
|
85
|
+
drf_to_mkdoc-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def _md_query_parameters_format_error_section(query_params: dict[str, Any]) -> str:
|
|
5
|
-
if "error" in query_params:
|
|
6
|
-
return f"**Error:** {query_params['error']}\n\n"
|
|
7
|
-
return ""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def _md_query_parameters_format_search_section(query_params: dict[str, Any]) -> str:
|
|
11
|
-
search_fields = query_params.get("search_fields", [])
|
|
12
|
-
if search_fields:
|
|
13
|
-
content = "### Search Parameters\n\n"
|
|
14
|
-
for field in search_fields:
|
|
15
|
-
content += f"- `{field}`\n"
|
|
16
|
-
content += "\n"
|
|
17
|
-
return content
|
|
18
|
-
return ""
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def _md_query_parameters_format_filter_section(query_params: dict[str, Any]) -> str:
|
|
22
|
-
filter_fields = query_params.get("filter_fields", [])
|
|
23
|
-
if filter_fields:
|
|
24
|
-
content = "### Filter Parameters\n\n"
|
|
25
|
-
for field in filter_fields:
|
|
26
|
-
content += f"- `{field}`\n"
|
|
27
|
-
content += "\n"
|
|
28
|
-
return content
|
|
29
|
-
return ""
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def _md_query_parameters_format_ordering_section(query_params: dict[str, Any]) -> str:
|
|
33
|
-
ordering_fields = query_params.get("ordering_fields", [])
|
|
34
|
-
if ordering_fields:
|
|
35
|
-
content = "### Ordering Parameters\n\n"
|
|
36
|
-
for field in ordering_fields:
|
|
37
|
-
content += f"- `{field}`\n"
|
|
38
|
-
content += "\n"
|
|
39
|
-
return content
|
|
40
|
-
return ""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def _md_query_parameters_format_pagination_section(query_params: dict[str, Any]) -> str:
|
|
44
|
-
pagination_fields = query_params.get("pagination_fields", [])
|
|
45
|
-
if pagination_fields:
|
|
46
|
-
content = "### Pagination Parameters\n\n"
|
|
47
|
-
for field in pagination_fields:
|
|
48
|
-
content += f"- `{field}`\n"
|
|
49
|
-
content += "\n"
|
|
50
|
-
return content
|
|
51
|
-
return ""
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _md_query_parameters_format_filter_backends_section(query_params: dict[str, Any]) -> str:
|
|
55
|
-
filter_backends = query_params.get("filter_backends", [])
|
|
56
|
-
if filter_backends:
|
|
57
|
-
return f"**Filter Backends:** {', '.join(filter_backends)}\n\n"
|
|
58
|
-
return ""
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def generate_query_parameters_md(query_params: dict[str, Any]) -> str:
|
|
62
|
-
"""Format query parameters into markdown documentation"""
|
|
63
|
-
if "error" in query_params:
|
|
64
|
-
return _md_query_parameters_format_error_section(query_params)
|
|
65
|
-
|
|
66
|
-
content = ""
|
|
67
|
-
content += _md_query_parameters_format_search_section(query_params)
|
|
68
|
-
content += _md_query_parameters_format_filter_section(query_params)
|
|
69
|
-
content += _md_query_parameters_format_ordering_section(query_params)
|
|
70
|
-
content += _md_query_parameters_format_pagination_section(query_params)
|
|
71
|
-
content += _md_query_parameters_format_filter_backends_section(query_params)
|
|
72
|
-
return content
|
|
File without changes
|
|
File without changes
|
|
File without changes
|