drf-to-mkdoc 0.3.0__tar.gz → 0.3.2__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.3.2/PKG-INFO +232 -0
- drf_to_mkdoc-0.3.2/README.md +183 -0
- drf_to_mkdoc-0.3.2/docs/serving_docs_with_django.md +118 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/conf/defaults.py +1 -2
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/conf/settings.py +2 -1
- drf_to_mkdoc-0.3.2/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/settings-modal.js +361 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/form-manager.js +136 -17
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/request-executor.js +18 -2
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/filter-section.css +10 -5
- drf_to_mkdoc-0.3.2/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/settings-modal.css +555 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/list/base.html +1 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/list/filter_section.html +3 -1
- drf_to_mkdoc-0.3.2/drf_to_mkdoc/templates/endpoints/list/settings_modal.html +138 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/try-out/form.html +1 -1
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/endpoint_detail_generator.py +1 -1
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/endpoint_list_generator.py +2 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/schema.py +10 -1
- drf_to_mkdoc-0.3.2/drf_to_mkdoc.egg-info/PKG-INFO +232 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc.egg-info/SOURCES.txt +4 -0
- drf_to_mkdoc-0.3.0/PKG-INFO +0 -315
- drf_to_mkdoc-0.3.0/README.md +0 -266
- drf_to_mkdoc-0.3.0/drf_to_mkdoc.egg-info/PKG-INFO +0 -315
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/.github/workflows/publish.yaml +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/.pre-commit-config.yaml +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/CONTRIBUTING.md +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/LICENSE +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/MANIFEST.in +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/conf/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/conf/defaults.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/conf/settings.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/docs/customizing_endpoints.md +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/docs/mkdocs.yml +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/docs/serving_mkdocs_with_django.md +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/apps.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/conf/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/commands/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/commands/build_docs.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/commands/build_endpoint_docs.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/commands/build_model_docs.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/commands/extract_model_data.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/commands/generate_doc_json.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/management/commands/update_doc_schema.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/endpoints-filter.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/field-sections-loader.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/query-parameters-loader.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/field-extractor.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/main.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/modal.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/query-parameters-extractor.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/response-modal.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/suggestions.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/tabs.js +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/accessibility.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/animations.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/badges.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/base.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoint-content.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoints-grid.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/fixes.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/layout.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/loading.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/responsive.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/sections.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/stats.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/tags.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/theme-toggle.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/fab.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/response.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/variables.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/variables.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/field-sections.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/animations.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/base.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-cards.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-tables.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/responsive.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/variables.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/buttons.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/fab.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/form.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/key-value.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/main.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/modal.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/response.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/tabs.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/variables.css +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/detail/base.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/detail/path_parameters.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/detail/query_parameters.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/detail/request_body.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/detail/responses.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/list/endpoint_card.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/list/filters/app.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/list/filters/method.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/list/filters/path.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/endpoints/list/filters/search.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/er_diagrams/app.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/er_diagrams/index.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/er_diagrams/main.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/model_detail/base.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/model_detail/choices.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/model_detail/fields.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/model_detail/meta.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/model_detail/methods.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/model_detail/relationships.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/models_index.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/try-out/fab.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/try-out/main.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/try-out/modal.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templates/try-out/response-modal.html +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/templatetags/custom_filters.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/ai_tools/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/ai_tools/enums.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/ai_tools/exceptions.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/ai_tools/providers/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/ai_tools/providers/base_provider.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/ai_tools/providers/gemini_provider.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/ai_tools/types.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/commons/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/commons/code_extractor.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/commons/file_utils.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/commons/model_utils.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/commons/operation_utils.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/commons/path_utils.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/commons/schema_utils.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/er_diagram_generator.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/extractors/__init__.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/extractors/query_parameter_extractors.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/model_detail_generator.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc/utils/model_list_generator.py +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc.egg-info/dependency_links.txt +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc.egg-info/requires.txt +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/drf_to_mkdoc.egg-info/top_level.txt +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/pyproject.toml +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/setup.cfg +0 -0
- {drf_to_mkdoc-0.3.0 → drf_to_mkdoc-0.3.2}/setup.py +0 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: drf-to-mkdoc
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Generate Markdown API docs from Django/DRF OpenAPI schema for MkDocs
|
|
5
|
+
Author-email: Hossein Shayesteh <shayestehhs1@gmail.com>
|
|
6
|
+
Maintainer-email: Hossein Shayesteh <shayestehhs1@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/shayestehhs/drf-to-mkdoc
|
|
9
|
+
Project-URL: Repository, https://github.com/shayestehhs/drf-to-mkdoc
|
|
10
|
+
Project-URL: Documentation, https://github.com/shayestehhs/drf-to-mkdoc#readme
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/shayestehhs/drf-to-mkdoc/issues
|
|
12
|
+
Keywords: django,django-rest-framework,documentation,mkdocs,api
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Framework :: Django
|
|
24
|
+
Classifier: Framework :: Django :: 3.2
|
|
25
|
+
Classifier: Framework :: Django :: 4.0
|
|
26
|
+
Classifier: Framework :: Django :: 4.1
|
|
27
|
+
Classifier: Framework :: Django :: 4.2
|
|
28
|
+
Classifier: Framework :: Django :: 5.0
|
|
29
|
+
Classifier: Topic :: Documentation
|
|
30
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
31
|
+
Requires-Python: >=3.8
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Requires-Dist: Django<6.0,>=3.2
|
|
35
|
+
Requires-Dist: djangorestframework<4.0,>=3.12
|
|
36
|
+
Requires-Dist: PyYAML>=6.0
|
|
37
|
+
Requires-Dist: drf-spectacular>=0.26.0
|
|
38
|
+
Requires-Dist: mkdocs>=1.4.0
|
|
39
|
+
Requires-Dist: mkdocs-material>=9.0.0
|
|
40
|
+
Requires-Dist: coreapi>=2.3.0
|
|
41
|
+
Provides-Extra: dev
|
|
42
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: pytest-django>=4.5.0; extra == "dev"
|
|
44
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
45
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
46
|
+
Requires-Dist: flake8>=5.0.0; extra == "dev"
|
|
47
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# DRF to MkDocs
|
|
51
|
+
|
|
52
|
+
Unlock effortless API documentation for your Django REST Framework project. Automatically generate beautiful, interactive, and maintainable docs that accelerate developer onboarding and streamline your team's workflow.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Why DRF to MkDocs?
|
|
57
|
+
|
|
58
|
+
`DRF to MkDocs` bridges the gap between your API's OpenAPI schema and user-friendly, maintainable documentation. It introspects your Django models and DRF views to automatically generate a polished, feature-rich documentation site that stays in sync with your codebase, empowering your team to build better APIs, faster.
|
|
59
|
+
|
|
60
|
+
- **Effortless Documentation**: Automate the entire process of generating and updating your API docs. Say goodbye to manual work and outdated information.
|
|
61
|
+
- **Accelerate Onboarding**: Provide new joiners with interactive, easy-to-navigate documentation. The "Try-it-out" feature and clear model relationships help them become productive from day one.
|
|
62
|
+
- **Deeply Integrated with DRF**: Leverages `drf-spectacular` for accurate schema generation, ensuring your documentation is a true reflection of your API.
|
|
63
|
+
- **Enhance Developer Experience**: Features like the interactive API console and in-depth model pages streamline development, testing, and debugging for the entire team.
|
|
64
|
+
- **Beautiful & Professional**: Built on MkDocs with the Material theme for a clean, modern, and responsive UI that you'll be proud to share.
|
|
65
|
+
|
|
66
|
+
## Gallery
|
|
67
|
+
|
|
68
|
+
<details>
|
|
69
|
+
<summary>🚀 Interactive Endpoint List & Filtering</summary>
|
|
70
|
+
<img width="1434" height="943" alt="List-EndPoint" src="https://github.com/user-attachments/assets/f886fc7f-afa0-4faa-b9c2-d6f754ca3597" />
|
|
71
|
+
</details>
|
|
72
|
+
|
|
73
|
+
<details>
|
|
74
|
+
<summary>🔬 Detailed Endpoint View with "Try-it-out"</summary>
|
|
75
|
+
<img width="958" height="887" alt="Detail-EndPoint" src="https://github.com/user-attachments/assets/9d9e3d4b-cb92-4ece-831e-aef45ceec768" />
|
|
76
|
+
<img width="532" height="804" alt="Try-it-out" src="https://github.com/user-attachments/assets/0f483922-60c4-4f62-8fb4-bc7372e82a03" />
|
|
77
|
+
</details>
|
|
78
|
+
|
|
79
|
+
<details>
|
|
80
|
+
<summary>📚 Rich Model Documentation</summary>
|
|
81
|
+
<img width="906" height="885" alt="Model-fields" src="https://github.com/user-attachments/assets/a1ca369c-ad40-4b05-83ec-ceb1f80aab23" />
|
|
82
|
+
<img width="848" height="886" alt="Model" src="https://github.com/user-attachments/assets/683d6d26-a8e4-4c05-8b5f-11a61a62cb0c" />
|
|
83
|
+
</details>
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary>📈 Entity-Relationship Diagrams</summary>
|
|
87
|
+
<img width="953" height="606" alt="ER-Diagram" src="https://github.com/user-attachments/assets/3d0b1cb0-7ebf-4d4a-a181-1b7dbc9c6a01" />
|
|
88
|
+
</details>
|
|
89
|
+
|
|
90
|
+
## Key Features
|
|
91
|
+
|
|
92
|
+
| Feature | Description |
|
|
93
|
+
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| 🚀 **Interactive API Console** | Test endpoints directly from the documentation with a "Try-it-out" feature, complete with a request builder and response viewer. |
|
|
95
|
+
| 🔍 **Advanced Filtering & Search** | Instantly find endpoints with multi-criteria filtering by app, method, path, and a real-time search. |
|
|
96
|
+
| 📚 **In-Depth Model Pages** | Automatically generate detailed pages for each model, including fields, relationships, choices, and methods. |
|
|
97
|
+
| 📊 **Entity-Relationship Diagrams** | Visualize model relationships with auto-generated, interactive ER diagrams for each app and for the entire project. |
|
|
98
|
+
| 🎨 **Modern & Responsive UI** | A beautiful and intuitive interface powered by MkDocs Material, featuring light/dark themes and full mobile support. |
|
|
99
|
+
| 🔧 **Highly Customizable** | Override templates, configure settings, and use custom functions to tailor the documentation to your project's specific needs. |
|
|
100
|
+
| ⚙️ **Simple Integration** | Works seamlessly with existing DRF projects and `drf-spectacular` without requiring complex setup. |
|
|
101
|
+
| 🤖 **AI-Powered Enhancements** | (Working on it...) Leverage AI to generate smarter examples and more descriptive documentation for your API. |
|
|
102
|
+
|
|
103
|
+
## Getting Started
|
|
104
|
+
|
|
105
|
+
### 1. Installation
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install drf-to-mkdoc
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 2. Configure Your Django Project
|
|
112
|
+
|
|
113
|
+
In your `settings.py`:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
# settings.py
|
|
117
|
+
|
|
118
|
+
INSTALLED_APPS = [
|
|
119
|
+
# ... your other apps
|
|
120
|
+
'drf_to_mkdoc',
|
|
121
|
+
'drf_spectacular', # Required for schema generation
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
# Required for OpenAPI schema generation
|
|
125
|
+
REST_FRAMEWORK = {
|
|
126
|
+
'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
SPECTACULAR_SETTINGS = {
|
|
130
|
+
'TITLE': 'Your API',
|
|
131
|
+
'DESCRIPTION': 'Your API description',
|
|
132
|
+
'VERSION': '1.0.0',
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# DRF to MkDocs specific settings
|
|
136
|
+
DRF_TO_MKDOC = {
|
|
137
|
+
'DJANGO_APPS': [
|
|
138
|
+
'users',
|
|
139
|
+
'products',
|
|
140
|
+
# ... list all apps you want to document
|
|
141
|
+
],
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 3. Create MkDocs Configuration
|
|
146
|
+
|
|
147
|
+
Create an `mkdocs.yml` file in your project root. You can start with the [default configuration](docs/mkdocs.yml) and customize it.
|
|
148
|
+
|
|
149
|
+
### 4. Build Your Documentation
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
python manage.py build_docs
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
For more detailed instructions, see the full [Installation and Setup Guide](docs/installation.md).
|
|
156
|
+
|
|
157
|
+
## Usage and Customization
|
|
158
|
+
|
|
159
|
+
### Building Your Documentation
|
|
160
|
+
|
|
161
|
+
To build the entire documentation site, run the following command. This will generate a static site in your `site/` directory.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
python manage.py build_docs
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
For more granular control, `DRF to MkDocs` provides several commands, such as `build_endpoint_docs` and `build_model_docs`.
|
|
168
|
+
|
|
169
|
+
### Serving Docs with Django
|
|
170
|
+
|
|
171
|
+
You can serve your documentation directly from your Django application, protecting it with Django's authentication system. This is ideal for private or internal APIs.
|
|
172
|
+
|
|
173
|
+
For a complete guide, see [Serving Docs with Django](docs/serving_docs_with_django.md).
|
|
174
|
+
|
|
175
|
+
### Customizing the OpenAPI Schema
|
|
176
|
+
|
|
177
|
+
`DRF to MkDocs` allows you to override and extend the auto-generated OpenAPI schema by providing a custom JSON file. This gives you fine-grained control over the final documentation, enabling you to add examples, descriptions, or even custom endpoints.
|
|
178
|
+
|
|
179
|
+
For more details, refer to the [Customizing Endpoints](docs/customizing_endpoints.md) guide.
|
|
180
|
+
|
|
181
|
+
### Best Practices
|
|
182
|
+
|
|
183
|
+
For better project organization, we recommend creating a separate `docs_settings.py` for documentation-specific configurations and using the `--settings` flag:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
python manage.py build_docs --settings=my_project.docs_settings
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
This keeps your production settings clean and your documentation configuration isolated.
|
|
190
|
+
|
|
191
|
+
## Configuration
|
|
192
|
+
|
|
193
|
+
You can customize the behavior of `DRF to MkDocs` by configuring the `DRF_TO_MKDOC` dictionary in your settings file.
|
|
194
|
+
|
|
195
|
+
| Key | Description | Default |
|
|
196
|
+
| -------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------- |
|
|
197
|
+
| `DJANGO_APPS` (required) | A list of Django app names to process. | `[]` |
|
|
198
|
+
| `DOCS_DIR` | The base directory where documentation will be generated. | `'docs'` |
|
|
199
|
+
| `ER_DIAGRAMS_DIR` | The directory for ER diagrams, relative to `DOCS_DIR`. | `'er_diagrams'` |
|
|
200
|
+
| `FIELD_GENERATORS` | Custom field value generators for creating better examples. | `{}` |
|
|
201
|
+
| `ENABLE_AI_DOCS` | A flag to enable AI-powered documentation features. | `False` |
|
|
202
|
+
| `PATH_PARAM_SUBSTITUTE_FUNCTION` | A custom function for substituting path parameters in URLs. | `None` |
|
|
203
|
+
| `PATH_PARAM_SUBSTITUTE_MAPPING` | A mapping for substituting common path parameters (e.g., `{'pk': 1}`). | `{}` |
|
|
204
|
+
|
|
205
|
+
## How It Works
|
|
206
|
+
|
|
207
|
+
`DRF to MkDocs` operates in a few stages:
|
|
208
|
+
|
|
209
|
+
1. **Model Introspection**: It deeply analyzes your Django models, mapping out their fields, relationships (like ForeignKeys and ManyToManyFields), and metadata.
|
|
210
|
+
2. **Schema Generation**: It uses `drf-spectacular` to generate a detailed OpenAPI schema for your API endpoints.
|
|
211
|
+
3. **Template Rendering**: It renders Jinja2 templates for each endpoint, model, and ER diagram, creating Markdown files.
|
|
212
|
+
4. **MkDocs Build**: Finally, it invokes MkDocs to build a static HTML site from the generated Markdown files.
|
|
213
|
+
|
|
214
|
+
This process ensures that your documentation is always an accurate and comprehensive reflection of your codebase.
|
|
215
|
+
|
|
216
|
+
## Contributing
|
|
217
|
+
|
|
218
|
+
Contributions are welcome! Whether it's a bug report, a new feature, or an improvement to the documentation, we appreciate your help. To ensure code quality, we use **CoderabbitAI** for automated code reviews on all pull requests.
|
|
219
|
+
|
|
220
|
+
Please see our [Contributing Guidelines](CONTRIBUTING.md) to get started.
|
|
221
|
+
|
|
222
|
+
### Development Setup
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
git clone https://github.com/Shayestehhs/drf-to-mkdoc.git
|
|
226
|
+
cd drf-to-mkdoc
|
|
227
|
+
pip install -e ".[dev]"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# DRF to MkDocs
|
|
2
|
+
|
|
3
|
+
Unlock effortless API documentation for your Django REST Framework project. Automatically generate beautiful, interactive, and maintainable docs that accelerate developer onboarding and streamline your team's workflow.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why DRF to MkDocs?
|
|
8
|
+
|
|
9
|
+
`DRF to MkDocs` bridges the gap between your API's OpenAPI schema and user-friendly, maintainable documentation. It introspects your Django models and DRF views to automatically generate a polished, feature-rich documentation site that stays in sync with your codebase, empowering your team to build better APIs, faster.
|
|
10
|
+
|
|
11
|
+
- **Effortless Documentation**: Automate the entire process of generating and updating your API docs. Say goodbye to manual work and outdated information.
|
|
12
|
+
- **Accelerate Onboarding**: Provide new joiners with interactive, easy-to-navigate documentation. The "Try-it-out" feature and clear model relationships help them become productive from day one.
|
|
13
|
+
- **Deeply Integrated with DRF**: Leverages `drf-spectacular` for accurate schema generation, ensuring your documentation is a true reflection of your API.
|
|
14
|
+
- **Enhance Developer Experience**: Features like the interactive API console and in-depth model pages streamline development, testing, and debugging for the entire team.
|
|
15
|
+
- **Beautiful & Professional**: Built on MkDocs with the Material theme for a clean, modern, and responsive UI that you'll be proud to share.
|
|
16
|
+
|
|
17
|
+
## Gallery
|
|
18
|
+
|
|
19
|
+
<details>
|
|
20
|
+
<summary>🚀 Interactive Endpoint List & Filtering</summary>
|
|
21
|
+
<img width="1434" height="943" alt="List-EndPoint" src="https://github.com/user-attachments/assets/f886fc7f-afa0-4faa-b9c2-d6f754ca3597" />
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<details>
|
|
25
|
+
<summary>🔬 Detailed Endpoint View with "Try-it-out"</summary>
|
|
26
|
+
<img width="958" height="887" alt="Detail-EndPoint" src="https://github.com/user-attachments/assets/9d9e3d4b-cb92-4ece-831e-aef45ceec768" />
|
|
27
|
+
<img width="532" height="804" alt="Try-it-out" src="https://github.com/user-attachments/assets/0f483922-60c4-4f62-8fb4-bc7372e82a03" />
|
|
28
|
+
</details>
|
|
29
|
+
|
|
30
|
+
<details>
|
|
31
|
+
<summary>📚 Rich Model Documentation</summary>
|
|
32
|
+
<img width="906" height="885" alt="Model-fields" src="https://github.com/user-attachments/assets/a1ca369c-ad40-4b05-83ec-ceb1f80aab23" />
|
|
33
|
+
<img width="848" height="886" alt="Model" src="https://github.com/user-attachments/assets/683d6d26-a8e4-4c05-8b5f-11a61a62cb0c" />
|
|
34
|
+
</details>
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary>📈 Entity-Relationship Diagrams</summary>
|
|
38
|
+
<img width="953" height="606" alt="ER-Diagram" src="https://github.com/user-attachments/assets/3d0b1cb0-7ebf-4d4a-a181-1b7dbc9c6a01" />
|
|
39
|
+
</details>
|
|
40
|
+
|
|
41
|
+
## Key Features
|
|
42
|
+
|
|
43
|
+
| Feature | Description |
|
|
44
|
+
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| 🚀 **Interactive API Console** | Test endpoints directly from the documentation with a "Try-it-out" feature, complete with a request builder and response viewer. |
|
|
46
|
+
| 🔍 **Advanced Filtering & Search** | Instantly find endpoints with multi-criteria filtering by app, method, path, and a real-time search. |
|
|
47
|
+
| 📚 **In-Depth Model Pages** | Automatically generate detailed pages for each model, including fields, relationships, choices, and methods. |
|
|
48
|
+
| 📊 **Entity-Relationship Diagrams** | Visualize model relationships with auto-generated, interactive ER diagrams for each app and for the entire project. |
|
|
49
|
+
| 🎨 **Modern & Responsive UI** | A beautiful and intuitive interface powered by MkDocs Material, featuring light/dark themes and full mobile support. |
|
|
50
|
+
| 🔧 **Highly Customizable** | Override templates, configure settings, and use custom functions to tailor the documentation to your project's specific needs. |
|
|
51
|
+
| ⚙️ **Simple Integration** | Works seamlessly with existing DRF projects and `drf-spectacular` without requiring complex setup. |
|
|
52
|
+
| 🤖 **AI-Powered Enhancements** | (Working on it...) Leverage AI to generate smarter examples and more descriptive documentation for your API. |
|
|
53
|
+
|
|
54
|
+
## Getting Started
|
|
55
|
+
|
|
56
|
+
### 1. Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install drf-to-mkdoc
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2. Configure Your Django Project
|
|
63
|
+
|
|
64
|
+
In your `settings.py`:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
# settings.py
|
|
68
|
+
|
|
69
|
+
INSTALLED_APPS = [
|
|
70
|
+
# ... your other apps
|
|
71
|
+
'drf_to_mkdoc',
|
|
72
|
+
'drf_spectacular', # Required for schema generation
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
# Required for OpenAPI schema generation
|
|
76
|
+
REST_FRAMEWORK = {
|
|
77
|
+
'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
SPECTACULAR_SETTINGS = {
|
|
81
|
+
'TITLE': 'Your API',
|
|
82
|
+
'DESCRIPTION': 'Your API description',
|
|
83
|
+
'VERSION': '1.0.0',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# DRF to MkDocs specific settings
|
|
87
|
+
DRF_TO_MKDOC = {
|
|
88
|
+
'DJANGO_APPS': [
|
|
89
|
+
'users',
|
|
90
|
+
'products',
|
|
91
|
+
# ... list all apps you want to document
|
|
92
|
+
],
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 3. Create MkDocs Configuration
|
|
97
|
+
|
|
98
|
+
Create an `mkdocs.yml` file in your project root. You can start with the [default configuration](docs/mkdocs.yml) and customize it.
|
|
99
|
+
|
|
100
|
+
### 4. Build Your Documentation
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python manage.py build_docs
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For more detailed instructions, see the full [Installation and Setup Guide](docs/installation.md).
|
|
107
|
+
|
|
108
|
+
## Usage and Customization
|
|
109
|
+
|
|
110
|
+
### Building Your Documentation
|
|
111
|
+
|
|
112
|
+
To build the entire documentation site, run the following command. This will generate a static site in your `site/` directory.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
python manage.py build_docs
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For more granular control, `DRF to MkDocs` provides several commands, such as `build_endpoint_docs` and `build_model_docs`.
|
|
119
|
+
|
|
120
|
+
### Serving Docs with Django
|
|
121
|
+
|
|
122
|
+
You can serve your documentation directly from your Django application, protecting it with Django's authentication system. This is ideal for private or internal APIs.
|
|
123
|
+
|
|
124
|
+
For a complete guide, see [Serving Docs with Django](docs/serving_docs_with_django.md).
|
|
125
|
+
|
|
126
|
+
### Customizing the OpenAPI Schema
|
|
127
|
+
|
|
128
|
+
`DRF to MkDocs` allows you to override and extend the auto-generated OpenAPI schema by providing a custom JSON file. This gives you fine-grained control over the final documentation, enabling you to add examples, descriptions, or even custom endpoints.
|
|
129
|
+
|
|
130
|
+
For more details, refer to the [Customizing Endpoints](docs/customizing_endpoints.md) guide.
|
|
131
|
+
|
|
132
|
+
### Best Practices
|
|
133
|
+
|
|
134
|
+
For better project organization, we recommend creating a separate `docs_settings.py` for documentation-specific configurations and using the `--settings` flag:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
python manage.py build_docs --settings=my_project.docs_settings
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This keeps your production settings clean and your documentation configuration isolated.
|
|
141
|
+
|
|
142
|
+
## Configuration
|
|
143
|
+
|
|
144
|
+
You can customize the behavior of `DRF to MkDocs` by configuring the `DRF_TO_MKDOC` dictionary in your settings file.
|
|
145
|
+
|
|
146
|
+
| Key | Description | Default |
|
|
147
|
+
| -------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------- |
|
|
148
|
+
| `DJANGO_APPS` (required) | A list of Django app names to process. | `[]` |
|
|
149
|
+
| `DOCS_DIR` | The base directory where documentation will be generated. | `'docs'` |
|
|
150
|
+
| `ER_DIAGRAMS_DIR` | The directory for ER diagrams, relative to `DOCS_DIR`. | `'er_diagrams'` |
|
|
151
|
+
| `FIELD_GENERATORS` | Custom field value generators for creating better examples. | `{}` |
|
|
152
|
+
| `ENABLE_AI_DOCS` | A flag to enable AI-powered documentation features. | `False` |
|
|
153
|
+
| `PATH_PARAM_SUBSTITUTE_FUNCTION` | A custom function for substituting path parameters in URLs. | `None` |
|
|
154
|
+
| `PATH_PARAM_SUBSTITUTE_MAPPING` | A mapping for substituting common path parameters (e.g., `{'pk': 1}`). | `{}` |
|
|
155
|
+
|
|
156
|
+
## How It Works
|
|
157
|
+
|
|
158
|
+
`DRF to MkDocs` operates in a few stages:
|
|
159
|
+
|
|
160
|
+
1. **Model Introspection**: It deeply analyzes your Django models, mapping out their fields, relationships (like ForeignKeys and ManyToManyFields), and metadata.
|
|
161
|
+
2. **Schema Generation**: It uses `drf-spectacular` to generate a detailed OpenAPI schema for your API endpoints.
|
|
162
|
+
3. **Template Rendering**: It renders Jinja2 templates for each endpoint, model, and ER diagram, creating Markdown files.
|
|
163
|
+
4. **MkDocs Build**: Finally, it invokes MkDocs to build a static HTML site from the generated Markdown files.
|
|
164
|
+
|
|
165
|
+
This process ensures that your documentation is always an accurate and comprehensive reflection of your codebase.
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
Contributions are welcome! Whether it's a bug report, a new feature, or an improvement to the documentation, we appreciate your help. To ensure code quality, we use **CoderabbitAI** for automated code reviews on all pull requests.
|
|
170
|
+
|
|
171
|
+
Please see our [Contributing Guidelines](CONTRIBUTING.md) to get started.
|
|
172
|
+
|
|
173
|
+
### Development Setup
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
git clone https://github.com/Shayestehhs/drf-to-mkdoc.git
|
|
177
|
+
cd drf-to-mkdoc
|
|
178
|
+
pip install -e ".[dev]"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Serving MkDocs with Django
|
|
2
|
+
|
|
3
|
+
This guide explains how to serve your generated MkDocs documentation directly from your Django application, allowing you to protect it with Django's authentication system.
|
|
4
|
+
|
|
5
|
+
## 1. Add Views to Your Project
|
|
6
|
+
|
|
7
|
+
First, create a `views.py` file in your main project directory (the same directory as `settings.py` and `urls.py`) if one doesn't already exist. Then, add the following code to handle serving the static documentation files.
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
# your_project/views.py
|
|
11
|
+
|
|
12
|
+
import mimetypes
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from django.conf import settings
|
|
16
|
+
from django.contrib.admin.views.decorators import staff_member_required
|
|
17
|
+
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
|
18
|
+
from django.utils.decorators import method_decorator
|
|
19
|
+
from django.views import View
|
|
20
|
+
|
|
21
|
+
@staff_member_required
|
|
22
|
+
def documentation_root(request):
|
|
23
|
+
"""Redirects the root documentation URL to index.html."""
|
|
24
|
+
return HttpResponseRedirect("index.html")
|
|
25
|
+
|
|
26
|
+
@method_decorator(staff_member_required, name="dispatch")
|
|
27
|
+
class DocumentationView(View):
|
|
28
|
+
"""
|
|
29
|
+
Serves static files from the MkDocs `site` directory.
|
|
30
|
+
This view is protected by staff_member_required.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def get(self, request, path):
|
|
34
|
+
# The base directory where MkDocs builds the site
|
|
35
|
+
site_dir = Path(settings.BASE_DIR) / "site"
|
|
36
|
+
|
|
37
|
+
# If no path is specified, default to index.html
|
|
38
|
+
if not path:
|
|
39
|
+
path = "index.html"
|
|
40
|
+
# If the path is a directory, append index.html
|
|
41
|
+
elif not Path(path).suffix:
|
|
42
|
+
path = path.rstrip("/") + "/index.html"
|
|
43
|
+
|
|
44
|
+
# Security check: prevent directory traversal attacks
|
|
45
|
+
if ".." in path or path.startswith("/"):
|
|
46
|
+
raise Http404("Invalid path specified.")
|
|
47
|
+
|
|
48
|
+
# Construct the full file path
|
|
49
|
+
file_path = site_dir / path
|
|
50
|
+
|
|
51
|
+
# Ensure the requested file exists and is within the site directory
|
|
52
|
+
try:
|
|
53
|
+
# Resolve paths to prevent symbolic link traversal
|
|
54
|
+
file_path = file_path.resolve()
|
|
55
|
+
site_dir = site_dir.resolve()
|
|
56
|
+
|
|
57
|
+
if not str(file_path).startswith(str(site_dir)):
|
|
58
|
+
raise Http404("Access denied.")
|
|
59
|
+
|
|
60
|
+
if not file_path.exists() or not file_path.is_file():
|
|
61
|
+
raise Http404("Documentation file not found.")
|
|
62
|
+
|
|
63
|
+
except (OSError, ValueError):
|
|
64
|
+
raise Http404("Invalid file path.")
|
|
65
|
+
|
|
66
|
+
# Guess the content type of the file
|
|
67
|
+
content_type, _ = mimetypes.guess_type(str(file_path))
|
|
68
|
+
if content_type is None:
|
|
69
|
+
content_type = "application/octet-stream"
|
|
70
|
+
|
|
71
|
+
# Open and serve the file
|
|
72
|
+
try:
|
|
73
|
+
with file_path.open("rb") as f:
|
|
74
|
+
response = HttpResponse(f.read(), content_type=content_type)
|
|
75
|
+
except OSError:
|
|
76
|
+
raise Http404("Could not read documentation file.")
|
|
77
|
+
|
|
78
|
+
return response
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 2. Update Your Project's URLs
|
|
82
|
+
|
|
83
|
+
Next, open your project's root `urls.py` file to integrate the documentation views.
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
# your_project/urls.py
|
|
87
|
+
|
|
88
|
+
from django.urls import path, re_path, include
|
|
89
|
+
from . import views # Import the views.py you just created
|
|
90
|
+
|
|
91
|
+
# Define the URL patterns for the documentation
|
|
92
|
+
docs_urlpatterns = [
|
|
93
|
+
path("", views.documentation_root, name="root"),
|
|
94
|
+
re_path(r"^(?P<path>.*)$", views.DocumentationView.as_view(), name="documentation"),
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
urlpatterns = [
|
|
98
|
+
# ... your other admin and app URLs
|
|
99
|
+
path("docs/", include((docs_urlpatterns, "docs"), namespace="docs")),
|
|
100
|
+
]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## 3. Build and Serve
|
|
104
|
+
|
|
105
|
+
With the views and URLs configured, the process to build and serve your documentation is straightforward:
|
|
106
|
+
|
|
107
|
+
1. **Build the docs**:
|
|
108
|
+
```bash
|
|
109
|
+
python manage.py build_docs
|
|
110
|
+
```
|
|
111
|
+
This will generate the static site in the `site/` directory.
|
|
112
|
+
|
|
113
|
+
2. **Run the Django server**:
|
|
114
|
+
```bash
|
|
115
|
+
python manage.py runserver
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Now, you can navigate to `/docs/` in your browser. If you are logged in as a staff user, you will see your documentation. Otherwise, you'll be redirected to the Django admin login page.
|
|
@@ -14,6 +14,5 @@ DEFAULTS = {
|
|
|
14
14
|
"AI_CONFIG_DIR_NAME": "ai_code", # Directory name for AI-generated code files
|
|
15
15
|
"AI_OPERATION_MAP_FILE": "docs/configs/operation_map.json", # Path to operation map file
|
|
16
16
|
"SERIALIZERS_INHERITANCE_DEPTH": 1, # Maximum depth for class inheritance analysis
|
|
17
|
-
#
|
|
18
|
-
"DJANGO_APPS": None, # List of Django app names to process
|
|
17
|
+
"DJANGO_APPS": [], # If it is empty list, there is no any exclusion
|
|
19
18
|
}
|
|
@@ -7,13 +7,14 @@ from drf_to_mkdoc.conf.defaults import DEFAULTS
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class DRFToMkDocSettings:
|
|
10
|
-
required_settings: ClassVar[list[str]] = [
|
|
10
|
+
required_settings: ClassVar[list[str]] = []
|
|
11
11
|
project_settings: ClassVar[dict[str, Any]] = {"PROJECT_NAME": "drf-to-mkdoc"}
|
|
12
12
|
|
|
13
13
|
settings_types: ClassVar[dict[str, type]] = {
|
|
14
14
|
"ENABLE_AI_DOCS": bool,
|
|
15
15
|
"AI_CONFIG_DIR_NAME": str,
|
|
16
16
|
"SERIALIZERS_INHERITANCE_DEPTH": int,
|
|
17
|
+
"DJANGO_APPS": list,
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
settings_ranges: ClassVar[dict[str, tuple[int, int]]] = {
|