drf-to-mkdoc 0.2.4__tar.gz → 0.3.0__tar.gz
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-0.2.4 → drf_to_mkdoc-0.3.0}/PKG-INFO +23 -3
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/README.md +22 -2
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/docs/mkdocs.yml +1 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/conf/defaults.py +1 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/conf/settings.py +1 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/build_model_docs.py +10 -1
- drf_to_mkdoc-0.3.0/drf_to_mkdoc/templates/er_diagrams/app.html +26 -0
- drf_to_mkdoc-0.3.0/drf_to_mkdoc/templates/er_diagrams/index.html +14 -0
- drf_to_mkdoc-0.3.0/drf_to_mkdoc/templates/er_diagrams/main.html +22 -0
- drf_to_mkdoc-0.3.0/drf_to_mkdoc/utils/er_diagram_generator.py +230 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc.egg-info/PKG-INFO +23 -3
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc.egg-info/SOURCES.txt +4 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/.github/workflows/publish.yaml +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/.pre-commit-config.yaml +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/CONTRIBUTING.md +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/LICENSE +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/MANIFEST.in +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/conf/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/conf/defaults.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/conf/settings.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/docs/customizing_endpoints.md +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/docs/serving_mkdocs_with_django.md +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/apps.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/conf/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/build_docs.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/build_endpoint_docs.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/extract_model_data.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/generate_doc_json.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/update_doc_schema.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/endpoints-filter.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/field-sections-loader.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/query-parameters-loader.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/field-extractor.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/form-manager.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/main.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/modal.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/query-parameters-extractor.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/request-executor.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/response-modal.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/suggestions.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/tabs.js +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/accessibility.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/animations.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/badges.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/base.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoint-content.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoints-grid.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/filter-section.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/fixes.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/layout.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/loading.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/responsive.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/sections.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/stats.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/tags.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/theme-toggle.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/fab.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/response.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/variables.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/variables.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/field-sections.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/animations.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/base.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-cards.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-tables.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/responsive.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/variables.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/buttons.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/fab.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/form.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/key-value.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/main.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/modal.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/response.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/tabs.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/variables.css +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/detail/base.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/detail/path_parameters.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/detail/query_parameters.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/detail/request_body.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/detail/responses.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/base.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/endpoint_card.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filter_section.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/app.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/method.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/path.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/search.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/model_detail/base.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/model_detail/choices.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/model_detail/fields.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/model_detail/meta.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/model_detail/methods.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/model_detail/relationships.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/models_index.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/try-out/fab.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/try-out/form.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/try-out/main.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/try-out/modal.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/try-out/response-modal.html +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templatetags/custom_filters.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/enums.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/exceptions.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/providers/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/providers/base_provider.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/providers/gemini_provider.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/types.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/commons/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/commons/code_extractor.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/commons/file_utils.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/commons/model_utils.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/commons/operation_utils.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/commons/path_utils.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/commons/schema_utils.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/endpoint_detail_generator.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/endpoint_list_generator.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/extractors/__init__.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/extractors/query_parameter_extractors.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/model_detail_generator.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/model_list_generator.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/schema.py +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc.egg-info/dependency_links.txt +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc.egg-info/requires.txt +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc.egg-info/top_level.txt +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/pyproject.toml +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/setup.cfg +0 -0
- {drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: drf-to-mkdoc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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>
|
|
@@ -55,6 +55,7 @@ Generate beautiful, interactive Markdown API documentation from Django REST Fram
|
|
|
55
55
|
|
|
56
56
|
- **Zero-hassle docs**: Beautiful, always-in-sync API docs straight from your codebase
|
|
57
57
|
- **Model deep dive**: Auto-generated model pages with fields, relationships, and choices
|
|
58
|
+
- **ER Diagrams**: Entity-Relationship diagrams showing model relationships
|
|
58
59
|
- **Lightning-fast discovery**: Interactive endpoint index with powerful filters and search
|
|
59
60
|
- **Try-it-out**: Interactive API testing directly in the documentation with request/response examples
|
|
60
61
|
- **AI-powered**: Optional AI-generated documentation with custom field generators(Wait for it...)
|
|
@@ -96,8 +97,9 @@ DRF_TO_MKDOC = {
|
|
|
96
97
|
'inventory',
|
|
97
98
|
],
|
|
98
99
|
# Optional: Override default paths
|
|
99
|
-
# 'DOCS_DIR': 'docs',
|
|
100
|
+
# 'DOCS_DIR': 'docs', # Base directory for all generated docs
|
|
100
101
|
# 'CONFIG_DIR': 'docs/configs',
|
|
102
|
+
# 'ER_DIAGRAMS_DIR': 'er_diagrams', # Directory for ER diagrams (relative to DOCS_DIR)
|
|
101
103
|
# 'MODEL_DOCS_FILE': 'docs/model-docs.json',
|
|
102
104
|
# 'DOC_CONFIG_FILE': 'docs/configs/doc_config.json',
|
|
103
105
|
# 'CUSTOM_SCHEMA_FILE': 'docs/configs/custom_schema.json',
|
|
@@ -112,6 +114,8 @@ DRF_TO_MKDOC = {
|
|
|
112
114
|
|
|
113
115
|
2. **Create MkDocs configuration**:
|
|
114
116
|
Copy the [`docs/mkdocs.yml`](docs/mkdocs.yml) file to your project root and customize it as needed.
|
|
117
|
+
|
|
118
|
+
**Note**: If you change the `ER_DIAGRAMS_DIR` setting, update the navigation path in `mkdocs.yml` accordingly.
|
|
115
119
|
|
|
116
120
|
3. **Build documentation**:
|
|
117
121
|
|
|
@@ -124,8 +128,9 @@ python manage.py build_docs --settings=docs_settings
|
|
|
124
128
|
The `DRF_TO_MKDOC` setting supports several configuration options:
|
|
125
129
|
|
|
126
130
|
- **`DJANGO_APPS`** (required): List of Django app names to process
|
|
127
|
-
- **`DOCS_DIR`**:
|
|
131
|
+
- **`DOCS_DIR`**: Base directory where docs will be generated (default: `docs`)
|
|
128
132
|
- **`CONFIG_DIR`**: Directory for configuration files (default: `docs/configs`)
|
|
133
|
+
- **`ER_DIAGRAMS_DIR`**: Directory for ER diagrams (default: `er_diagrams`, relative to `DOCS_DIR`)
|
|
129
134
|
- **`FIELD_GENERATORS`**: Custom field value generators for better examples
|
|
130
135
|
- **`ENABLE_AI_DOCS`**: Enable AI-powered documentation features (default: `False`)
|
|
131
136
|
- **`PATH_PARAM_SUBSTITUTE_FUNCTION`**: Custom function for path parameter substitution
|
|
@@ -153,6 +158,12 @@ See a detailed overview of generated files in `docs/structure.md` and a feature
|
|
|
153
158
|
- **Floating action button**: Easy access to testing interface
|
|
154
159
|
- **Multiple examples**: Support for both empty and populated response examples
|
|
155
160
|
|
|
161
|
+
### 📊 Entity-Relationship Diagrams
|
|
162
|
+
- **Visual model relationships**: Interactive ER diagrams showing all model connections
|
|
163
|
+
- **App-specific views**: Detailed diagrams for each Django app with field information
|
|
164
|
+
- **Mermaid-powered**: Clean, professional diagrams with zoom and navigation controls
|
|
165
|
+
- **Auto-generated**: Automatically created from your Django model relationships
|
|
166
|
+
|
|
156
167
|
### 🤖 AI-Powered Documentation
|
|
157
168
|
- **Custom field generators**: Define custom value generators for specific fields
|
|
158
169
|
- **AI documentation**: Optional AI-generated documentation with context analysis
|
|
@@ -233,6 +244,10 @@ drf-to-mkdoc/
|
|
|
233
244
|
│ ├── model_list_generator.py
|
|
234
245
|
│ └── schema.py
|
|
235
246
|
├── docs/ # Generated documentation
|
|
247
|
+
│ ├── endpoints/ # API endpoint documentation
|
|
248
|
+
│ ├── models/ # Model documentation
|
|
249
|
+
│ ├── er_diagrams/ # Entity-Relationship diagrams
|
|
250
|
+
│ └── configs/ # Configuration files
|
|
236
251
|
├── pyproject.toml # Project configuration
|
|
237
252
|
└── README.md
|
|
238
253
|
```
|
|
@@ -251,6 +266,7 @@ To avoid committing generated files to your repository, add the following to you
|
|
|
251
266
|
# Documentation
|
|
252
267
|
/docs/endpoints/
|
|
253
268
|
/docs/models/
|
|
269
|
+
/docs/er_diagrams/
|
|
254
270
|
/docs/configs/doc-schema.yaml
|
|
255
271
|
|
|
256
272
|
# Build artifacts
|
|
@@ -287,6 +303,10 @@ your-project/
|
|
|
287
303
|
├── docs_settings.py # Documentation-specific settings
|
|
288
304
|
├── mkdocs.yml # MkDocs configuration
|
|
289
305
|
├── docs/ # Generated documentation (gitignored)
|
|
306
|
+
│ ├── endpoints/ # API endpoint docs
|
|
307
|
+
│ ├── models/ # Model documentation
|
|
308
|
+
│ ├── er_diagrams/ # ER diagrams
|
|
309
|
+
│ └── configs/ # Configuration files
|
|
290
310
|
└── site/ # Built site (gitignored)
|
|
291
311
|
```
|
|
292
312
|
|
|
@@ -6,6 +6,7 @@ Generate beautiful, interactive Markdown API documentation from Django REST Fram
|
|
|
6
6
|
|
|
7
7
|
- **Zero-hassle docs**: Beautiful, always-in-sync API docs straight from your codebase
|
|
8
8
|
- **Model deep dive**: Auto-generated model pages with fields, relationships, and choices
|
|
9
|
+
- **ER Diagrams**: Entity-Relationship diagrams showing model relationships
|
|
9
10
|
- **Lightning-fast discovery**: Interactive endpoint index with powerful filters and search
|
|
10
11
|
- **Try-it-out**: Interactive API testing directly in the documentation with request/response examples
|
|
11
12
|
- **AI-powered**: Optional AI-generated documentation with custom field generators(Wait for it...)
|
|
@@ -47,8 +48,9 @@ DRF_TO_MKDOC = {
|
|
|
47
48
|
'inventory',
|
|
48
49
|
],
|
|
49
50
|
# Optional: Override default paths
|
|
50
|
-
# 'DOCS_DIR': 'docs',
|
|
51
|
+
# 'DOCS_DIR': 'docs', # Base directory for all generated docs
|
|
51
52
|
# 'CONFIG_DIR': 'docs/configs',
|
|
53
|
+
# 'ER_DIAGRAMS_DIR': 'er_diagrams', # Directory for ER diagrams (relative to DOCS_DIR)
|
|
52
54
|
# 'MODEL_DOCS_FILE': 'docs/model-docs.json',
|
|
53
55
|
# 'DOC_CONFIG_FILE': 'docs/configs/doc_config.json',
|
|
54
56
|
# 'CUSTOM_SCHEMA_FILE': 'docs/configs/custom_schema.json',
|
|
@@ -63,6 +65,8 @@ DRF_TO_MKDOC = {
|
|
|
63
65
|
|
|
64
66
|
2. **Create MkDocs configuration**:
|
|
65
67
|
Copy the [`docs/mkdocs.yml`](docs/mkdocs.yml) file to your project root and customize it as needed.
|
|
68
|
+
|
|
69
|
+
**Note**: If you change the `ER_DIAGRAMS_DIR` setting, update the navigation path in `mkdocs.yml` accordingly.
|
|
66
70
|
|
|
67
71
|
3. **Build documentation**:
|
|
68
72
|
|
|
@@ -75,8 +79,9 @@ python manage.py build_docs --settings=docs_settings
|
|
|
75
79
|
The `DRF_TO_MKDOC` setting supports several configuration options:
|
|
76
80
|
|
|
77
81
|
- **`DJANGO_APPS`** (required): List of Django app names to process
|
|
78
|
-
- **`DOCS_DIR`**:
|
|
82
|
+
- **`DOCS_DIR`**: Base directory where docs will be generated (default: `docs`)
|
|
79
83
|
- **`CONFIG_DIR`**: Directory for configuration files (default: `docs/configs`)
|
|
84
|
+
- **`ER_DIAGRAMS_DIR`**: Directory for ER diagrams (default: `er_diagrams`, relative to `DOCS_DIR`)
|
|
80
85
|
- **`FIELD_GENERATORS`**: Custom field value generators for better examples
|
|
81
86
|
- **`ENABLE_AI_DOCS`**: Enable AI-powered documentation features (default: `False`)
|
|
82
87
|
- **`PATH_PARAM_SUBSTITUTE_FUNCTION`**: Custom function for path parameter substitution
|
|
@@ -104,6 +109,12 @@ See a detailed overview of generated files in `docs/structure.md` and a feature
|
|
|
104
109
|
- **Floating action button**: Easy access to testing interface
|
|
105
110
|
- **Multiple examples**: Support for both empty and populated response examples
|
|
106
111
|
|
|
112
|
+
### 📊 Entity-Relationship Diagrams
|
|
113
|
+
- **Visual model relationships**: Interactive ER diagrams showing all model connections
|
|
114
|
+
- **App-specific views**: Detailed diagrams for each Django app with field information
|
|
115
|
+
- **Mermaid-powered**: Clean, professional diagrams with zoom and navigation controls
|
|
116
|
+
- **Auto-generated**: Automatically created from your Django model relationships
|
|
117
|
+
|
|
107
118
|
### 🤖 AI-Powered Documentation
|
|
108
119
|
- **Custom field generators**: Define custom value generators for specific fields
|
|
109
120
|
- **AI documentation**: Optional AI-generated documentation with context analysis
|
|
@@ -184,6 +195,10 @@ drf-to-mkdoc/
|
|
|
184
195
|
│ ├── model_list_generator.py
|
|
185
196
|
│ └── schema.py
|
|
186
197
|
├── docs/ # Generated documentation
|
|
198
|
+
│ ├── endpoints/ # API endpoint documentation
|
|
199
|
+
│ ├── models/ # Model documentation
|
|
200
|
+
│ ├── er_diagrams/ # Entity-Relationship diagrams
|
|
201
|
+
│ └── configs/ # Configuration files
|
|
187
202
|
├── pyproject.toml # Project configuration
|
|
188
203
|
└── README.md
|
|
189
204
|
```
|
|
@@ -202,6 +217,7 @@ To avoid committing generated files to your repository, add the following to you
|
|
|
202
217
|
# Documentation
|
|
203
218
|
/docs/endpoints/
|
|
204
219
|
/docs/models/
|
|
220
|
+
/docs/er_diagrams/
|
|
205
221
|
/docs/configs/doc-schema.yaml
|
|
206
222
|
|
|
207
223
|
# Build artifacts
|
|
@@ -238,6 +254,10 @@ your-project/
|
|
|
238
254
|
├── docs_settings.py # Documentation-specific settings
|
|
239
255
|
├── mkdocs.yml # MkDocs configuration
|
|
240
256
|
├── docs/ # Generated documentation (gitignored)
|
|
257
|
+
│ ├── endpoints/ # API endpoint docs
|
|
258
|
+
│ ├── models/ # Model documentation
|
|
259
|
+
│ ├── er_diagrams/ # ER diagrams
|
|
260
|
+
│ └── configs/ # Configuration files
|
|
241
261
|
└── site/ # Built site (gitignored)
|
|
242
262
|
```
|
|
243
263
|
|
|
@@ -2,6 +2,7 @@ DEFAULTS = {
|
|
|
2
2
|
# Path configurations with defaults
|
|
3
3
|
"DOCS_DIR": "docs", # Directory where docs will be generated
|
|
4
4
|
"CONFIG_DIR": "docs/configs", # Directory for configuration files
|
|
5
|
+
"ER_DIAGRAMS_DIR": "er_diagrams", # Directory for ER diagrams (relative to DOCS_DIR)
|
|
5
6
|
"MODEL_DOCS_FILE": "docs/model-docs.json", # Path to model documentation JSON file
|
|
6
7
|
"DOC_CONFIG_FILE": "docs/configs/doc_config.json", # Path to documentation configuration file
|
|
7
8
|
"CUSTOM_SCHEMA_FILE": "docs/configs/custom_schema.json", # Path to custom schema file
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/build_model_docs.py
RENAMED
|
@@ -4,6 +4,7 @@ from django.core.management.base import BaseCommand
|
|
|
4
4
|
|
|
5
5
|
from drf_to_mkdoc.conf.settings import drf_to_mkdoc_settings
|
|
6
6
|
from drf_to_mkdoc.utils.commons.file_utils import load_json_data
|
|
7
|
+
from drf_to_mkdoc.utils.er_diagram_generator import generate_er_diagrams
|
|
7
8
|
from drf_to_mkdoc.utils.model_detail_generator import generate_model_docs
|
|
8
9
|
from drf_to_mkdoc.utils.model_list_generator import create_models_index
|
|
9
10
|
|
|
@@ -42,9 +43,17 @@ class Command(BaseCommand):
|
|
|
42
43
|
self.stdout.write("📋 Generating model documentation...")
|
|
43
44
|
|
|
44
45
|
try:
|
|
46
|
+
# Generate model detail pages
|
|
45
47
|
generate_model_docs(models_data)
|
|
48
|
+
self.stdout.write(self.style.SUCCESS("✅ Model detail pages generated"))
|
|
49
|
+
|
|
50
|
+
# Generate ER diagrams
|
|
51
|
+
generate_er_diagrams(models_data, docs_dir)
|
|
52
|
+
self.stdout.write(self.style.SUCCESS("✅ ER diagrams generated"))
|
|
53
|
+
|
|
54
|
+
# Create models index page
|
|
46
55
|
create_models_index(models_data, docs_dir)
|
|
47
|
-
self.stdout.write(self.style.SUCCESS("✅
|
|
56
|
+
self.stdout.write(self.style.SUCCESS("✅ Models index page generated"))
|
|
48
57
|
except Exception as e:
|
|
49
58
|
self.stdout.write(self.style.WARNING(f"⚠️ Failed to generate model docs: {e}"))
|
|
50
59
|
raise
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# {{ app_name|title|cut:"_"|safe }} Models
|
|
2
|
+
|
|
3
|
+
```mermaid
|
|
4
|
+
erDiagram
|
|
5
|
+
{% for entity in app_entities %}
|
|
6
|
+
{{ entity.model_name }} {
|
|
7
|
+
{% for field in entity.fields %}
|
|
8
|
+
{{ field.name }} {{ field.type }}{% if field.is_pk %} "PK"{% elif field.nullable %} "NULLABLE"{% endif %}
|
|
9
|
+
{% endfor %}
|
|
10
|
+
}
|
|
11
|
+
{% endfor %}
|
|
12
|
+
{% for entity in related_entities %}
|
|
13
|
+
{{ entity.model_name }} {
|
|
14
|
+
id AutoField "PK"
|
|
15
|
+
}
|
|
16
|
+
{% endfor %}
|
|
17
|
+
{% for relationship in relationships %}
|
|
18
|
+
{{ relationship.source_model }} {{ relationship.type }} {{ relationship.target_model }} : "{{ relationship.description }}"
|
|
19
|
+
{% endfor %}
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Models
|
|
24
|
+
|
|
25
|
+
{% for entity in app_entities %}- [{{ entity.model_name }}](../../models/{{ entity.app_name }}/{{ entity.table_name }}/)
|
|
26
|
+
{% endfor %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Entity-Relationship Diagrams
|
|
2
|
+
|
|
3
|
+
This section contains Entity-Relationship (ER) diagrams for all Django models in the system.
|
|
4
|
+
|
|
5
|
+
## [Complete System Diagram](main.md)
|
|
6
|
+
|
|
7
|
+
View the complete ER diagram showing all models and their relationships.
|
|
8
|
+
|
|
9
|
+
## Application Diagrams
|
|
10
|
+
|
|
11
|
+
| Application | Models
|
|
12
|
+
|------------|--------|
|
|
13
|
+
{% for app in apps %}| [{{ app.name|title|cut:"_"|safe }}]({{ app.name }}.md) | {{ app.model_count }} |
|
|
14
|
+
{% endfor %}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Complete Entity-Relationship Diagram
|
|
2
|
+
|
|
3
|
+
```mermaid
|
|
4
|
+
erDiagram
|
|
5
|
+
{% for entity in entities %}
|
|
6
|
+
{{ entity.model_name }} {
|
|
7
|
+
{% for field in entity.fields %}
|
|
8
|
+
{{ field.name }} {{ field.type }}{% if field.is_pk %} "PK"{% elif field.nullable %} "NULLABLE"{% endif %}
|
|
9
|
+
{% endfor %}
|
|
10
|
+
}
|
|
11
|
+
{% endfor %}
|
|
12
|
+
{% for relationship in relationships %}
|
|
13
|
+
{{ relationship.source_model }} {{ relationship.type }} {{ relationship.target_model }} : "{{ relationship.description }}"
|
|
14
|
+
{% endfor %}
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
<div class="er-diagram-controls">
|
|
19
|
+
<button class="zoom-in">Zoom In</button>
|
|
20
|
+
<button class="zoom-out">Zoom Out</button>
|
|
21
|
+
<button class="reset-zoom">Reset</button>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from django.template.loader import render_to_string
|
|
5
|
+
|
|
6
|
+
from drf_to_mkdoc.conf.settings import drf_to_mkdoc_settings
|
|
7
|
+
|
|
8
|
+
from .commons.file_utils import write_file
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_relationship_type_and_description(rel_type_class: str) -> tuple[str, str] | None:
|
|
12
|
+
"""Map Django relationship type to Mermaid ER diagram syntax and description."""
|
|
13
|
+
mapping = {
|
|
14
|
+
"ForeignKey": ("}o--||", "many to 1"),
|
|
15
|
+
"OneToOneField": ("||--||", "1 to 1"),
|
|
16
|
+
"OneToOneRel": ("||--||", "1 to 1"),
|
|
17
|
+
"ManyToManyField": ("}o--o{", "many to many"),
|
|
18
|
+
"ManyToManyRel": ("}o--o{", "many to many"),
|
|
19
|
+
"ManyToOneRel": ("||--o{", "1 to many"),
|
|
20
|
+
}
|
|
21
|
+
return mapping.get(rel_type_class)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _create_entity_from_model(
|
|
25
|
+
app_name: str, model_name: str, model_info: dict[str, Any], include_fields: bool = False
|
|
26
|
+
) -> dict[str, Any]:
|
|
27
|
+
"""Create entity dictionary from model data, optionally including field details."""
|
|
28
|
+
table_name = model_info.get("table_name", model_name)
|
|
29
|
+
entity_id = f"{app_name}__{table_name}"
|
|
30
|
+
|
|
31
|
+
entity = {
|
|
32
|
+
"id": entity_id,
|
|
33
|
+
"app_name": app_name,
|
|
34
|
+
"model_name": model_name,
|
|
35
|
+
"table_name": table_name,
|
|
36
|
+
"fields": [],
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if include_fields:
|
|
40
|
+
fields = []
|
|
41
|
+
has_pk = False
|
|
42
|
+
|
|
43
|
+
for field_name, field_info in model_info.get("column_fields", {}).items():
|
|
44
|
+
field_type = field_info.get("type", "")
|
|
45
|
+
is_pk = field_info.get("primary_key", False)
|
|
46
|
+
nullable = field_info.get("null", False) or field_info.get("blank", False)
|
|
47
|
+
|
|
48
|
+
fields.append({
|
|
49
|
+
"name": field_name,
|
|
50
|
+
"type": field_type,
|
|
51
|
+
"is_pk": is_pk,
|
|
52
|
+
"nullable": nullable
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
if is_pk:
|
|
56
|
+
has_pk = True
|
|
57
|
+
|
|
58
|
+
if not has_pk:
|
|
59
|
+
fields.insert(0, {
|
|
60
|
+
"name": "id",
|
|
61
|
+
"type": "AutoField",
|
|
62
|
+
"is_pk": True,
|
|
63
|
+
"nullable": False
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
entity["fields"] = fields
|
|
67
|
+
|
|
68
|
+
return entity
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _process_model_relationships(
|
|
72
|
+
source_entity_id: str,
|
|
73
|
+
source_model_name: str,
|
|
74
|
+
model_info: dict[str, Any],
|
|
75
|
+
all_models_data: dict[str, Any]
|
|
76
|
+
) -> list[dict[str, Any]]:
|
|
77
|
+
"""Extract and process model relationships, returning Mermaid-compatible relationship data."""
|
|
78
|
+
relationships = []
|
|
79
|
+
|
|
80
|
+
for rel_name, rel_info in model_info.get("relationships", {}).items():
|
|
81
|
+
if not isinstance(rel_info, dict):
|
|
82
|
+
continue
|
|
83
|
+
|
|
84
|
+
related_model_label = rel_info.get("related_model", "")
|
|
85
|
+
if not related_model_label or "." not in related_model_label:
|
|
86
|
+
continue
|
|
87
|
+
|
|
88
|
+
target_app, target_model = related_model_label.split(".", 1)
|
|
89
|
+
|
|
90
|
+
target_table_name = rel_info.get("table_name", target_model.lower())
|
|
91
|
+
if target_app in all_models_data and target_model in all_models_data[target_app]:
|
|
92
|
+
target_table_name = all_models_data[target_app][target_model].get(
|
|
93
|
+
"table_name", target_model.lower()
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
target_entity_id = f"{target_app}__{target_table_name}"
|
|
97
|
+
|
|
98
|
+
rel_type_class = rel_info.get("type", "")
|
|
99
|
+
type_info = _get_relationship_type_and_description(rel_type_class)
|
|
100
|
+
if not type_info:
|
|
101
|
+
continue
|
|
102
|
+
|
|
103
|
+
rel_type, description = type_info
|
|
104
|
+
|
|
105
|
+
relationships.append({
|
|
106
|
+
"source": source_entity_id,
|
|
107
|
+
"target": target_entity_id,
|
|
108
|
+
"source_model": source_model_name,
|
|
109
|
+
"target_model": target_model,
|
|
110
|
+
"type": rel_type,
|
|
111
|
+
"label": rel_name,
|
|
112
|
+
"description": description,
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
return relationships
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def generate_er_diagrams(models_data: dict[str, Any], docs_dir: Path) -> None:
|
|
119
|
+
"""Generate main ER diagram, app-specific diagrams, and index page from model data."""
|
|
120
|
+
generate_main_er_diagram(models_data, docs_dir)
|
|
121
|
+
|
|
122
|
+
for app_name, models in models_data.items():
|
|
123
|
+
if not isinstance(models, dict):
|
|
124
|
+
continue
|
|
125
|
+
generate_app_er_diagram(app_name, models, models_data, docs_dir)
|
|
126
|
+
|
|
127
|
+
generate_er_diagrams_index(models_data, docs_dir)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def generate_main_er_diagram(models_data: dict[str, Any], _docs_dir: Path) -> None:
|
|
131
|
+
"""Create main ER diagram showing all models and their relationships."""
|
|
132
|
+
entities = []
|
|
133
|
+
relationships = []
|
|
134
|
+
|
|
135
|
+
for app_name, models in models_data.items():
|
|
136
|
+
if not isinstance(models, dict):
|
|
137
|
+
continue
|
|
138
|
+
|
|
139
|
+
for model_name, model_info in models.items():
|
|
140
|
+
if not isinstance(model_info, dict):
|
|
141
|
+
continue
|
|
142
|
+
|
|
143
|
+
entity = _create_entity_from_model(app_name, model_name, model_info, include_fields=False)
|
|
144
|
+
entities.append(entity)
|
|
145
|
+
|
|
146
|
+
model_relationships = _process_model_relationships(
|
|
147
|
+
entity["id"], model_name, model_info, models_data
|
|
148
|
+
)
|
|
149
|
+
relationships.extend(model_relationships)
|
|
150
|
+
|
|
151
|
+
content = render_to_string(
|
|
152
|
+
"er_diagrams/main.html", {"entities": entities, "relationships": relationships}
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
write_file(f"{drf_to_mkdoc_settings.ER_DIAGRAMS_DIR}/main.md", content)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def generate_app_er_diagram(
|
|
159
|
+
app_name: str, app_models: dict[str, Any], all_models_data: dict[str, Any], _docs_dir: Path
|
|
160
|
+
) -> None:
|
|
161
|
+
"""Create app-specific ER diagram with detailed fields and related models."""
|
|
162
|
+
app_entities = []
|
|
163
|
+
related_entities = []
|
|
164
|
+
relationships = []
|
|
165
|
+
related_entity_ids = set()
|
|
166
|
+
|
|
167
|
+
for model_name, model_info in app_models.items():
|
|
168
|
+
if not isinstance(model_info, dict):
|
|
169
|
+
continue
|
|
170
|
+
|
|
171
|
+
entity = _create_entity_from_model(app_name, model_name, model_info, include_fields=True)
|
|
172
|
+
app_entities.append(entity)
|
|
173
|
+
|
|
174
|
+
model_relationships = _process_model_relationships(
|
|
175
|
+
entity["id"], model_name, model_info, all_models_data
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
for relationship in model_relationships:
|
|
179
|
+
target_entity_id = relationship["target"]
|
|
180
|
+
target_model = relationship["target_model"]
|
|
181
|
+
target_app = target_entity_id.split("__")[0]
|
|
182
|
+
|
|
183
|
+
if target_app != app_name and target_entity_id not in related_entity_ids:
|
|
184
|
+
if target_app in all_models_data and target_model in all_models_data[target_app]:
|
|
185
|
+
target_model_info = all_models_data[target_app][target_model]
|
|
186
|
+
related_entity = _create_entity_from_model(
|
|
187
|
+
target_app, target_model, target_model_info, include_fields=False
|
|
188
|
+
)
|
|
189
|
+
related_entities.append(related_entity)
|
|
190
|
+
related_entity_ids.add(target_entity_id)
|
|
191
|
+
|
|
192
|
+
relationships.append(relationship)
|
|
193
|
+
|
|
194
|
+
content = render_to_string(
|
|
195
|
+
"er_diagrams/app.html",
|
|
196
|
+
{
|
|
197
|
+
"app_name": app_name,
|
|
198
|
+
"app_entities": app_entities,
|
|
199
|
+
"related_entities": related_entities,
|
|
200
|
+
"relationships": relationships,
|
|
201
|
+
},
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
write_file(f"{drf_to_mkdoc_settings.ER_DIAGRAMS_DIR}/{app_name}.md", content)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def generate_er_diagrams_index(models_data: dict[str, Any], _docs_dir: Path) -> None:
|
|
208
|
+
"""Create index page listing all available ER diagrams with app summaries."""
|
|
209
|
+
apps = []
|
|
210
|
+
|
|
211
|
+
for app_name in sorted(models_data.keys()):
|
|
212
|
+
if not isinstance(models_data[app_name], dict):
|
|
213
|
+
continue
|
|
214
|
+
|
|
215
|
+
model_count = len([
|
|
216
|
+
m for m in models_data[app_name]
|
|
217
|
+
if isinstance(models_data[app_name][m], dict)
|
|
218
|
+
])
|
|
219
|
+
|
|
220
|
+
model_names = []
|
|
221
|
+
for model_name, model_info in models_data[app_name].items():
|
|
222
|
+
if isinstance(model_info, dict):
|
|
223
|
+
model_names.append(model_name)
|
|
224
|
+
if len(model_names) >= 3:
|
|
225
|
+
break
|
|
226
|
+
|
|
227
|
+
apps.append({"name": app_name, "model_count": model_count})
|
|
228
|
+
|
|
229
|
+
content = render_to_string("er_diagrams/index.html", {"apps": apps})
|
|
230
|
+
write_file(f"{drf_to_mkdoc_settings.ER_DIAGRAMS_DIR}/index.md", content)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: drf-to-mkdoc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
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>
|
|
@@ -55,6 +55,7 @@ Generate beautiful, interactive Markdown API documentation from Django REST Fram
|
|
|
55
55
|
|
|
56
56
|
- **Zero-hassle docs**: Beautiful, always-in-sync API docs straight from your codebase
|
|
57
57
|
- **Model deep dive**: Auto-generated model pages with fields, relationships, and choices
|
|
58
|
+
- **ER Diagrams**: Entity-Relationship diagrams showing model relationships
|
|
58
59
|
- **Lightning-fast discovery**: Interactive endpoint index with powerful filters and search
|
|
59
60
|
- **Try-it-out**: Interactive API testing directly in the documentation with request/response examples
|
|
60
61
|
- **AI-powered**: Optional AI-generated documentation with custom field generators(Wait for it...)
|
|
@@ -96,8 +97,9 @@ DRF_TO_MKDOC = {
|
|
|
96
97
|
'inventory',
|
|
97
98
|
],
|
|
98
99
|
# Optional: Override default paths
|
|
99
|
-
# 'DOCS_DIR': 'docs',
|
|
100
|
+
# 'DOCS_DIR': 'docs', # Base directory for all generated docs
|
|
100
101
|
# 'CONFIG_DIR': 'docs/configs',
|
|
102
|
+
# 'ER_DIAGRAMS_DIR': 'er_diagrams', # Directory for ER diagrams (relative to DOCS_DIR)
|
|
101
103
|
# 'MODEL_DOCS_FILE': 'docs/model-docs.json',
|
|
102
104
|
# 'DOC_CONFIG_FILE': 'docs/configs/doc_config.json',
|
|
103
105
|
# 'CUSTOM_SCHEMA_FILE': 'docs/configs/custom_schema.json',
|
|
@@ -112,6 +114,8 @@ DRF_TO_MKDOC = {
|
|
|
112
114
|
|
|
113
115
|
2. **Create MkDocs configuration**:
|
|
114
116
|
Copy the [`docs/mkdocs.yml`](docs/mkdocs.yml) file to your project root and customize it as needed.
|
|
117
|
+
|
|
118
|
+
**Note**: If you change the `ER_DIAGRAMS_DIR` setting, update the navigation path in `mkdocs.yml` accordingly.
|
|
115
119
|
|
|
116
120
|
3. **Build documentation**:
|
|
117
121
|
|
|
@@ -124,8 +128,9 @@ python manage.py build_docs --settings=docs_settings
|
|
|
124
128
|
The `DRF_TO_MKDOC` setting supports several configuration options:
|
|
125
129
|
|
|
126
130
|
- **`DJANGO_APPS`** (required): List of Django app names to process
|
|
127
|
-
- **`DOCS_DIR`**:
|
|
131
|
+
- **`DOCS_DIR`**: Base directory where docs will be generated (default: `docs`)
|
|
128
132
|
- **`CONFIG_DIR`**: Directory for configuration files (default: `docs/configs`)
|
|
133
|
+
- **`ER_DIAGRAMS_DIR`**: Directory for ER diagrams (default: `er_diagrams`, relative to `DOCS_DIR`)
|
|
129
134
|
- **`FIELD_GENERATORS`**: Custom field value generators for better examples
|
|
130
135
|
- **`ENABLE_AI_DOCS`**: Enable AI-powered documentation features (default: `False`)
|
|
131
136
|
- **`PATH_PARAM_SUBSTITUTE_FUNCTION`**: Custom function for path parameter substitution
|
|
@@ -153,6 +158,12 @@ See a detailed overview of generated files in `docs/structure.md` and a feature
|
|
|
153
158
|
- **Floating action button**: Easy access to testing interface
|
|
154
159
|
- **Multiple examples**: Support for both empty and populated response examples
|
|
155
160
|
|
|
161
|
+
### 📊 Entity-Relationship Diagrams
|
|
162
|
+
- **Visual model relationships**: Interactive ER diagrams showing all model connections
|
|
163
|
+
- **App-specific views**: Detailed diagrams for each Django app with field information
|
|
164
|
+
- **Mermaid-powered**: Clean, professional diagrams with zoom and navigation controls
|
|
165
|
+
- **Auto-generated**: Automatically created from your Django model relationships
|
|
166
|
+
|
|
156
167
|
### 🤖 AI-Powered Documentation
|
|
157
168
|
- **Custom field generators**: Define custom value generators for specific fields
|
|
158
169
|
- **AI documentation**: Optional AI-generated documentation with context analysis
|
|
@@ -233,6 +244,10 @@ drf-to-mkdoc/
|
|
|
233
244
|
│ ├── model_list_generator.py
|
|
234
245
|
│ └── schema.py
|
|
235
246
|
├── docs/ # Generated documentation
|
|
247
|
+
│ ├── endpoints/ # API endpoint documentation
|
|
248
|
+
│ ├── models/ # Model documentation
|
|
249
|
+
│ ├── er_diagrams/ # Entity-Relationship diagrams
|
|
250
|
+
│ └── configs/ # Configuration files
|
|
236
251
|
├── pyproject.toml # Project configuration
|
|
237
252
|
└── README.md
|
|
238
253
|
```
|
|
@@ -251,6 +266,7 @@ To avoid committing generated files to your repository, add the following to you
|
|
|
251
266
|
# Documentation
|
|
252
267
|
/docs/endpoints/
|
|
253
268
|
/docs/models/
|
|
269
|
+
/docs/er_diagrams/
|
|
254
270
|
/docs/configs/doc-schema.yaml
|
|
255
271
|
|
|
256
272
|
# Build artifacts
|
|
@@ -287,6 +303,10 @@ your-project/
|
|
|
287
303
|
├── docs_settings.py # Documentation-specific settings
|
|
288
304
|
├── mkdocs.yml # MkDocs configuration
|
|
289
305
|
├── docs/ # Generated documentation (gitignored)
|
|
306
|
+
│ ├── endpoints/ # API endpoint docs
|
|
307
|
+
│ ├── models/ # Model documentation
|
|
308
|
+
│ ├── er_diagrams/ # ER diagrams
|
|
309
|
+
│ └── configs/ # Configuration files
|
|
290
310
|
└── site/ # Built site (gitignored)
|
|
291
311
|
```
|
|
292
312
|
|
|
@@ -90,6 +90,9 @@ drf_to_mkdoc/templates/endpoints/list/filters/app.html
|
|
|
90
90
|
drf_to_mkdoc/templates/endpoints/list/filters/method.html
|
|
91
91
|
drf_to_mkdoc/templates/endpoints/list/filters/path.html
|
|
92
92
|
drf_to_mkdoc/templates/endpoints/list/filters/search.html
|
|
93
|
+
drf_to_mkdoc/templates/er_diagrams/app.html
|
|
94
|
+
drf_to_mkdoc/templates/er_diagrams/index.html
|
|
95
|
+
drf_to_mkdoc/templates/er_diagrams/main.html
|
|
93
96
|
drf_to_mkdoc/templates/model_detail/base.html
|
|
94
97
|
drf_to_mkdoc/templates/model_detail/choices.html
|
|
95
98
|
drf_to_mkdoc/templates/model_detail/fields.html
|
|
@@ -105,6 +108,7 @@ drf_to_mkdoc/templatetags/custom_filters.py
|
|
|
105
108
|
drf_to_mkdoc/utils/__init__.py
|
|
106
109
|
drf_to_mkdoc/utils/endpoint_detail_generator.py
|
|
107
110
|
drf_to_mkdoc/utils/endpoint_list_generator.py
|
|
111
|
+
drf_to_mkdoc/utils/er_diagram_generator.py
|
|
108
112
|
drf_to_mkdoc/utils/model_detail_generator.py
|
|
109
113
|
drf_to_mkdoc/utils/model_list_generator.py
|
|
110
114
|
drf_to_mkdoc/utils/schema.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/build_endpoint_docs.py
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/extract_model_data.py
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/generate_doc_json.py
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/management/commands/update_doc_schema.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/detail/request_body.html
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/detail/responses.html
RENAMED
|
File without changes
|
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/endpoint_card.html
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filter_section.html
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/app.html
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/method.html
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/path.html
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/endpoints/list/filters/search.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/model_detail/relationships.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/templates/try-out/response-modal.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/providers/base_provider.py
RENAMED
|
File without changes
|
{drf_to_mkdoc-0.2.4 → drf_to_mkdoc-0.3.0}/drf_to_mkdoc/utils/ai_tools/providers/gemini_provider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|