drf-to-mkdoc 0.2.3__tar.gz → 0.2.4__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.3 → drf_to_mkdoc-0.2.4}/PKG-INFO +68 -9
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/README.md +67 -8
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/docs/customizing_endpoints.md +31 -1
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/field-sections-loader.js +29 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/query-parameters-loader.js +16 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/field-extractor.js +200 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/form-manager.js +465 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/main.js +50 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/modal.js +359 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/query-parameters-extractor.js +94 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/request-executor.js +327 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/response-modal.js +173 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/suggestions.js +123 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/tabs.js +77 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/badges.css +13 -5
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/theme-toggle.css +314 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/fab.css +204 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/response.css +323 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/try-out/variables.css +139 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/field-sections.css +136 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/form.css +663 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/modal.css +334 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/response.css +618 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/tabs.css +114 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/variables.css +94 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/detail/request_body.html +2 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/templates/try-out/fab.html +68 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/templates/try-out/form.html +260 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/templates/try-out/modal.html +82 -0
- drf_to_mkdoc-0.2.4/drf_to_mkdoc/templates/try-out/response-modal.html +149 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/endpoint_detail_generator.py +1 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc.egg-info/PKG-INFO +68 -9
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc.egg-info/SOURCES.txt +9 -0
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/form-manager.js +0 -172
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/main.js +0 -22
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/modal.js +0 -79
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/request-executor.js +0 -111
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/suggestions.js +0 -216
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/try-out/tabs.js +0 -34
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/theme-toggle.css +0 -42
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/form.css +0 -124
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/modal.css +0 -112
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/response.css +0 -158
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/tabs.css +0 -62
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/variables.css +0 -38
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/templates/try-out/fab.html +0 -4
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/templates/try-out/form.html +0 -113
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/templates/try-out/modal.html +0 -14
- drf_to_mkdoc-0.2.3/drf_to_mkdoc/templates/try-out/response-modal.html +0 -20
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/.github/workflows/publish.yaml +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/.pre-commit-config.yaml +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/CONTRIBUTING.md +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/LICENSE +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/MANIFEST.in +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/conf/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/conf/defaults.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/conf/settings.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/docs/mkdocs.yml +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/docs/serving_mkdocs_with_django.md +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/apps.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/conf/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/conf/defaults.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/conf/settings.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/commands/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/commands/build_docs.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/commands/build_endpoint_docs.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/commands/build_model_docs.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/commands/extract_model_data.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/commands/generate_doc_json.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/management/commands/update_doc_schema.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/javascripts/endpoints-filter.js +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/accessibility.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/animations.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/base.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoint-content.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/endpoints-grid.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/filter-section.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/fixes.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/layout.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/loading.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/responsive.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/sections.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/stats.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/tags.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/endpoints/variables.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/animations.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/base.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-cards.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/model-tables.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/responsive.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/models/variables.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/buttons.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/fab.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/key-value.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/static/drf-to-mkdoc/stylesheets/try-out/main.css +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/detail/base.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/detail/path_parameters.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/detail/query_parameters.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/detail/responses.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/list/base.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/list/endpoint_card.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/list/filter_section.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/list/filters/app.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/list/filters/method.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/list/filters/path.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/endpoints/list/filters/search.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/model_detail/base.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/model_detail/choices.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/model_detail/fields.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/model_detail/meta.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/model_detail/methods.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/model_detail/relationships.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/models_index.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templates/try-out/main.html +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/templatetags/custom_filters.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/ai_tools/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/ai_tools/enums.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/ai_tools/exceptions.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/ai_tools/providers/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/ai_tools/providers/base_provider.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/ai_tools/providers/gemini_provider.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/ai_tools/types.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/commons/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/commons/code_extractor.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/commons/file_utils.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/commons/model_utils.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/commons/operation_utils.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/commons/path_utils.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/commons/schema_utils.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/endpoint_list_generator.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/extractors/__init__.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/extractors/query_parameter_extractors.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/model_detail_generator.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/model_list_generator.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc/utils/schema.py +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc.egg-info/dependency_links.txt +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc.egg-info/requires.txt +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/drf_to_mkdoc.egg-info/top_level.txt +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/pyproject.toml +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/setup.cfg +0 -0
- {drf_to_mkdoc-0.2.3 → drf_to_mkdoc-0.2.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: drf-to-mkdoc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
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>
|
|
@@ -56,6 +56,8 @@ Generate beautiful, interactive Markdown API documentation from Django REST Fram
|
|
|
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
58
|
- **Lightning-fast discovery**: Interactive endpoint index with powerful filters and search
|
|
59
|
+
- **Try-it-out**: Interactive API testing directly in the documentation with request/response examples
|
|
60
|
+
- **AI-powered**: Optional AI-generated documentation with custom field generators(Wait for it...)
|
|
59
61
|
- **DRF-native**: Works with DRF Spectacular; no custom schema wiring needed
|
|
60
62
|
- **MkDocs Material**: Looks great out of the box with the Material theme
|
|
61
63
|
|
|
@@ -76,7 +78,7 @@ INSTALLED_APPS = [
|
|
|
76
78
|
|
|
77
79
|
# Required for OpenAPI schema generation
|
|
78
80
|
REST_FRAMEWORK = {
|
|
79
|
-
'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
|
|
81
|
+
'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
SPECTACULAR_SETTINGS = {
|
|
@@ -99,6 +101,12 @@ DRF_TO_MKDOC = {
|
|
|
99
101
|
# 'MODEL_DOCS_FILE': 'docs/model-docs.json',
|
|
100
102
|
# 'DOC_CONFIG_FILE': 'docs/configs/doc_config.json',
|
|
101
103
|
# 'CUSTOM_SCHEMA_FILE': 'docs/configs/custom_schema.json',
|
|
104
|
+
# 'FIELD_GENERATORS': {
|
|
105
|
+
# 'email': 'faker.email',
|
|
106
|
+
# 'name': 'faker.name',
|
|
107
|
+
# 'created_at': 'datetime.now',
|
|
108
|
+
# },
|
|
109
|
+
# 'ENABLE_AI_DOCS': False,
|
|
102
110
|
}
|
|
103
111
|
```
|
|
104
112
|
|
|
@@ -111,18 +119,54 @@ DRF_TO_MKDOC = {
|
|
|
111
119
|
python manage.py build_docs --settings=docs_settings
|
|
112
120
|
```
|
|
113
121
|
|
|
122
|
+
### Configuration Options
|
|
123
|
+
|
|
124
|
+
The `DRF_TO_MKDOC` setting supports several configuration options:
|
|
125
|
+
|
|
126
|
+
- **`DJANGO_APPS`** (required): List of Django app names to process
|
|
127
|
+
- **`DOCS_DIR`**: Directory where docs will be generated (default: `docs`)
|
|
128
|
+
- **`CONFIG_DIR`**: Directory for configuration files (default: `docs/configs`)
|
|
129
|
+
- **`FIELD_GENERATORS`**: Custom field value generators for better examples
|
|
130
|
+
- **`ENABLE_AI_DOCS`**: Enable AI-powered documentation features (default: `False`)
|
|
131
|
+
- **`PATH_PARAM_SUBSTITUTE_FUNCTION`**: Custom function for path parameter substitution
|
|
132
|
+
- **`PATH_PARAM_SUBSTITUTE_MAPPING`**: Mapping for path parameter substitution
|
|
133
|
+
|
|
114
134
|
## Available Commands
|
|
115
135
|
|
|
116
136
|
- `build_docs`: Build the complete documentation site with MkDocs
|
|
117
137
|
- `build_endpoint_docs`: Build endpoint documentation from OpenAPI schema
|
|
118
138
|
- `build_model_docs`: Build model documentation from model JSON data
|
|
119
139
|
- `extract_model_data`: Extract model data from Django model introspection and save as JSON
|
|
140
|
+
- `generate_doc_json`: Generate JSON context for new API endpoints to be documented
|
|
120
141
|
- `update_doc_schema`: Update the final schema by copying the documented schema
|
|
121
142
|
|
|
122
143
|
## What you get
|
|
123
144
|
|
|
124
145
|
See a detailed overview of generated files in `docs/structure.md` and a feature breakdown in `docs/features.md`.
|
|
125
146
|
|
|
147
|
+
## Key Features
|
|
148
|
+
|
|
149
|
+
### 🚀 Interactive API Testing (Try-Out)
|
|
150
|
+
- **Live API testing**: Test endpoints directly from the documentation
|
|
151
|
+
- **Request builder**: Interactive forms for parameters, headers, and request body
|
|
152
|
+
- **Response viewer**: Real-time response display with syntax highlighting
|
|
153
|
+
- **Floating action button**: Easy access to testing interface
|
|
154
|
+
- **Multiple examples**: Support for both empty and populated response examples
|
|
155
|
+
|
|
156
|
+
### 🤖 AI-Powered Documentation
|
|
157
|
+
- **Custom field generators**: Define custom value generators for specific fields
|
|
158
|
+
- **AI documentation**: Optional AI-generated documentation with context analysis
|
|
159
|
+
- **Smart examples**: Enhanced example generation for better API understanding
|
|
160
|
+
|
|
161
|
+
### 📊 Advanced Filtering & Search
|
|
162
|
+
- **Multi-criteria filtering**: Filter by app, HTTP method, path, and search terms
|
|
163
|
+
- **Real-time search**: Instant search across all endpoints
|
|
164
|
+
- **Smart suggestions**: Auto-complete for query parameters and field names
|
|
165
|
+
|
|
166
|
+
### 🎨 Beautiful UI
|
|
167
|
+
- **Material Design**: Modern, responsive interface with dark/light themes
|
|
168
|
+
- **Interactive elements**: Hover effects, animations, and smooth transitions
|
|
169
|
+
- **Mobile-friendly**: Fully responsive design for all devices
|
|
126
170
|
|
|
127
171
|
## How it works
|
|
128
172
|
|
|
@@ -167,13 +211,29 @@ drf-to-mkdoc/
|
|
|
167
211
|
│ │ ├── build_endpoint_docs.py # Build endpoint documentation
|
|
168
212
|
│ │ ├── build_model_docs.py # Build model documentation
|
|
169
213
|
│ │ ├── extract_model_data.py # Extract model data from Django
|
|
214
|
+
│ │ ├── generate_doc_json.py # Generate JSON context for AI docs
|
|
170
215
|
│ │ └── update_doc_schema.py # Schema updates
|
|
216
|
+
│ ├── static/
|
|
217
|
+
│ │ └── drf-to-mkdoc/
|
|
218
|
+
│ │ ├── javascripts/
|
|
219
|
+
│ │ │ ├── try-out/ # Interactive API testing
|
|
220
|
+
│ │ │ └── endpoints-filter.js # Endpoint filtering
|
|
221
|
+
│ │ └── stylesheets/ # CSS for styling
|
|
222
|
+
│ ├── templates/
|
|
223
|
+
│ │ ├── endpoints/ # Endpoint documentation templates
|
|
224
|
+
│ │ ├── model_detail/ # Model documentation templates
|
|
225
|
+
│ │ └── try-out/ # Interactive testing templates
|
|
171
226
|
│ └── utils/
|
|
172
|
-
│ ├──
|
|
173
|
-
│ ├──
|
|
174
|
-
│ ├──
|
|
175
|
-
│
|
|
176
|
-
├──
|
|
227
|
+
│ ├── ai_tools/ # AI-powered documentation features
|
|
228
|
+
│ ├── commons/ # Shared utilities
|
|
229
|
+
│ ├── extractors/ # Query parameter extraction
|
|
230
|
+
│ ├── endpoint_detail_generator.py
|
|
231
|
+
│ ├── endpoint_list_generator.py
|
|
232
|
+
│ ├── model_detail_generator.py
|
|
233
|
+
│ ├── model_list_generator.py
|
|
234
|
+
│ └── schema.py
|
|
235
|
+
├── docs/ # Generated documentation
|
|
236
|
+
├── pyproject.toml # Project configuration
|
|
177
237
|
└── README.md
|
|
178
238
|
```
|
|
179
239
|
|
|
@@ -232,5 +292,4 @@ your-project/
|
|
|
232
292
|
|
|
233
293
|
## Contributing
|
|
234
294
|
|
|
235
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
|
|
236
|
-
This will ensure that only the source configuration and scripts are versioned, while the generated documentation is excluded.
|
|
295
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
|
|
@@ -7,6 +7,8 @@ Generate beautiful, interactive Markdown API documentation from Django REST Fram
|
|
|
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
9
|
- **Lightning-fast discovery**: Interactive endpoint index with powerful filters and search
|
|
10
|
+
- **Try-it-out**: Interactive API testing directly in the documentation with request/response examples
|
|
11
|
+
- **AI-powered**: Optional AI-generated documentation with custom field generators(Wait for it...)
|
|
10
12
|
- **DRF-native**: Works with DRF Spectacular; no custom schema wiring needed
|
|
11
13
|
- **MkDocs Material**: Looks great out of the box with the Material theme
|
|
12
14
|
|
|
@@ -27,7 +29,7 @@ INSTALLED_APPS = [
|
|
|
27
29
|
|
|
28
30
|
# Required for OpenAPI schema generation
|
|
29
31
|
REST_FRAMEWORK = {
|
|
30
|
-
'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
|
|
32
|
+
'DEFAULT_SCHEMA_CLASS': 'drf_to_mkdoc.utils.schema.AutoSchema',
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
SPECTACULAR_SETTINGS = {
|
|
@@ -50,6 +52,12 @@ DRF_TO_MKDOC = {
|
|
|
50
52
|
# 'MODEL_DOCS_FILE': 'docs/model-docs.json',
|
|
51
53
|
# 'DOC_CONFIG_FILE': 'docs/configs/doc_config.json',
|
|
52
54
|
# 'CUSTOM_SCHEMA_FILE': 'docs/configs/custom_schema.json',
|
|
55
|
+
# 'FIELD_GENERATORS': {
|
|
56
|
+
# 'email': 'faker.email',
|
|
57
|
+
# 'name': 'faker.name',
|
|
58
|
+
# 'created_at': 'datetime.now',
|
|
59
|
+
# },
|
|
60
|
+
# 'ENABLE_AI_DOCS': False,
|
|
53
61
|
}
|
|
54
62
|
```
|
|
55
63
|
|
|
@@ -62,18 +70,54 @@ DRF_TO_MKDOC = {
|
|
|
62
70
|
python manage.py build_docs --settings=docs_settings
|
|
63
71
|
```
|
|
64
72
|
|
|
73
|
+
### Configuration Options
|
|
74
|
+
|
|
75
|
+
The `DRF_TO_MKDOC` setting supports several configuration options:
|
|
76
|
+
|
|
77
|
+
- **`DJANGO_APPS`** (required): List of Django app names to process
|
|
78
|
+
- **`DOCS_DIR`**: Directory where docs will be generated (default: `docs`)
|
|
79
|
+
- **`CONFIG_DIR`**: Directory for configuration files (default: `docs/configs`)
|
|
80
|
+
- **`FIELD_GENERATORS`**: Custom field value generators for better examples
|
|
81
|
+
- **`ENABLE_AI_DOCS`**: Enable AI-powered documentation features (default: `False`)
|
|
82
|
+
- **`PATH_PARAM_SUBSTITUTE_FUNCTION`**: Custom function for path parameter substitution
|
|
83
|
+
- **`PATH_PARAM_SUBSTITUTE_MAPPING`**: Mapping for path parameter substitution
|
|
84
|
+
|
|
65
85
|
## Available Commands
|
|
66
86
|
|
|
67
87
|
- `build_docs`: Build the complete documentation site with MkDocs
|
|
68
88
|
- `build_endpoint_docs`: Build endpoint documentation from OpenAPI schema
|
|
69
89
|
- `build_model_docs`: Build model documentation from model JSON data
|
|
70
90
|
- `extract_model_data`: Extract model data from Django model introspection and save as JSON
|
|
91
|
+
- `generate_doc_json`: Generate JSON context for new API endpoints to be documented
|
|
71
92
|
- `update_doc_schema`: Update the final schema by copying the documented schema
|
|
72
93
|
|
|
73
94
|
## What you get
|
|
74
95
|
|
|
75
96
|
See a detailed overview of generated files in `docs/structure.md` and a feature breakdown in `docs/features.md`.
|
|
76
97
|
|
|
98
|
+
## Key Features
|
|
99
|
+
|
|
100
|
+
### 🚀 Interactive API Testing (Try-Out)
|
|
101
|
+
- **Live API testing**: Test endpoints directly from the documentation
|
|
102
|
+
- **Request builder**: Interactive forms for parameters, headers, and request body
|
|
103
|
+
- **Response viewer**: Real-time response display with syntax highlighting
|
|
104
|
+
- **Floating action button**: Easy access to testing interface
|
|
105
|
+
- **Multiple examples**: Support for both empty and populated response examples
|
|
106
|
+
|
|
107
|
+
### 🤖 AI-Powered Documentation
|
|
108
|
+
- **Custom field generators**: Define custom value generators for specific fields
|
|
109
|
+
- **AI documentation**: Optional AI-generated documentation with context analysis
|
|
110
|
+
- **Smart examples**: Enhanced example generation for better API understanding
|
|
111
|
+
|
|
112
|
+
### 📊 Advanced Filtering & Search
|
|
113
|
+
- **Multi-criteria filtering**: Filter by app, HTTP method, path, and search terms
|
|
114
|
+
- **Real-time search**: Instant search across all endpoints
|
|
115
|
+
- **Smart suggestions**: Auto-complete for query parameters and field names
|
|
116
|
+
|
|
117
|
+
### 🎨 Beautiful UI
|
|
118
|
+
- **Material Design**: Modern, responsive interface with dark/light themes
|
|
119
|
+
- **Interactive elements**: Hover effects, animations, and smooth transitions
|
|
120
|
+
- **Mobile-friendly**: Fully responsive design for all devices
|
|
77
121
|
|
|
78
122
|
## How it works
|
|
79
123
|
|
|
@@ -118,13 +162,29 @@ drf-to-mkdoc/
|
|
|
118
162
|
│ │ ├── build_endpoint_docs.py # Build endpoint documentation
|
|
119
163
|
│ │ ├── build_model_docs.py # Build model documentation
|
|
120
164
|
│ │ ├── extract_model_data.py # Extract model data from Django
|
|
165
|
+
│ │ ├── generate_doc_json.py # Generate JSON context for AI docs
|
|
121
166
|
│ │ └── update_doc_schema.py # Schema updates
|
|
167
|
+
│ ├── static/
|
|
168
|
+
│ │ └── drf-to-mkdoc/
|
|
169
|
+
│ │ ├── javascripts/
|
|
170
|
+
│ │ │ ├── try-out/ # Interactive API testing
|
|
171
|
+
│ │ │ └── endpoints-filter.js # Endpoint filtering
|
|
172
|
+
│ │ └── stylesheets/ # CSS for styling
|
|
173
|
+
│ ├── templates/
|
|
174
|
+
│ │ ├── endpoints/ # Endpoint documentation templates
|
|
175
|
+
│ │ ├── model_detail/ # Model documentation templates
|
|
176
|
+
│ │ └── try-out/ # Interactive testing templates
|
|
122
177
|
│ └── utils/
|
|
123
|
-
│ ├──
|
|
124
|
-
│ ├──
|
|
125
|
-
│ ├──
|
|
126
|
-
│
|
|
127
|
-
├──
|
|
178
|
+
│ ├── ai_tools/ # AI-powered documentation features
|
|
179
|
+
│ ├── commons/ # Shared utilities
|
|
180
|
+
│ ├── extractors/ # Query parameter extraction
|
|
181
|
+
│ ├── endpoint_detail_generator.py
|
|
182
|
+
│ ├── endpoint_list_generator.py
|
|
183
|
+
│ ├── model_detail_generator.py
|
|
184
|
+
│ ├── model_list_generator.py
|
|
185
|
+
│ └── schema.py
|
|
186
|
+
├── docs/ # Generated documentation
|
|
187
|
+
├── pyproject.toml # Project configuration
|
|
128
188
|
└── README.md
|
|
129
189
|
```
|
|
130
190
|
|
|
@@ -183,5 +243,4 @@ your-project/
|
|
|
183
243
|
|
|
184
244
|
## Contributing
|
|
185
245
|
|
|
186
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
|
|
187
|
-
This will ensure that only the source configuration and scripts are versioned, while the generated documentation is excluded.
|
|
246
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# Customizing API Endpoint Documentation
|
|
3
3
|
|
|
4
|
-
`drf-to-mkdoc` automatically generates API documentation from your Django REST Framework (DRF) project using the OpenAPI schema from **DRF Spectacular**. You can refine and extend that documentation using a **custom JSON file
|
|
4
|
+
`drf-to-mkdoc` automatically generates API documentation from your Django REST Framework (DRF) project using the OpenAPI schema from **DRF Spectacular**. You can refine and extend that documentation using a **custom JSON file** and various configuration options.
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -170,3 +170,33 @@ Supported `queryparam_type` values:
|
|
|
170
170
|
* Keep `custom_schema.json` in version control so your team benefits.
|
|
171
171
|
* Start small: add descriptions first, then parameters, then responses.
|
|
172
172
|
* Use `append_fields` if you want to **add extra info** without overwriting auto-generated items.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 7. Advanced Configuration Options
|
|
177
|
+
|
|
178
|
+
### Field Generators
|
|
179
|
+
You can define custom field value generators for better example generation:
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
DRF_TO_MKDOC = {
|
|
183
|
+
'DJANGO_APPS': ['your_apps'],
|
|
184
|
+
'FIELD_GENERATORS': {
|
|
185
|
+
'created_at': datetime.now.strftime(settings.CUSTOM_DATETIME_FORMAT),
|
|
186
|
+
'phone_number': generate_phone_number_function,
|
|
187
|
+
},
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Path Parameter Substitution
|
|
192
|
+
Customize how path parameters are handled:
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
DRF_TO_MKDOC = {
|
|
196
|
+
'PATH_PARAM_SUBSTITUTE_FUNCTION': 'your_app.utils.custom_substitute',
|
|
197
|
+
'PATH_PARAM_SUBSTITUTE_MAPPING': {
|
|
198
|
+
'pk': 'id',
|
|
199
|
+
'uuid': 'identifier',
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Loader script for field sections functionality
|
|
2
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
3
|
+
// Load CSS
|
|
4
|
+
function loadCSS(url) {
|
|
5
|
+
const link = document.createElement('link');
|
|
6
|
+
link.rel = 'stylesheet';
|
|
7
|
+
link.href = url;
|
|
8
|
+
document.head.appendChild(link);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Load JavaScript
|
|
12
|
+
function loadScript(url, callback) {
|
|
13
|
+
const script = document.createElement('script');
|
|
14
|
+
script.src = url;
|
|
15
|
+
script.onload = callback || function() {};
|
|
16
|
+
document.body.appendChild(script);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Base URL for static files
|
|
20
|
+
const baseUrl = document.querySelector('meta[name="static-url"]')?.getAttribute('content') || '';
|
|
21
|
+
|
|
22
|
+
// Load CSS file
|
|
23
|
+
loadCSS(baseUrl + '/static/drf-to-mkdoc/stylesheets/field-sections.css');
|
|
24
|
+
|
|
25
|
+
// Load field extractor script
|
|
26
|
+
loadScript(baseUrl + '/static/drf-to-mkdoc/javascripts/try-out/field-extractor.js');
|
|
27
|
+
|
|
28
|
+
console.log('Field sections functionality loaded');
|
|
29
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Query parameters loader script
|
|
2
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
3
|
+
// Load JavaScript
|
|
4
|
+
function loadScript(url, callback) {
|
|
5
|
+
const script = document.createElement('script');
|
|
6
|
+
script.src = url;
|
|
7
|
+
script.onload = callback || function() {};
|
|
8
|
+
document.body.appendChild(script);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Base URL for static files
|
|
12
|
+
const baseUrl = document.querySelector('meta[name="static-url"]')?.getAttribute('content') || '';
|
|
13
|
+
|
|
14
|
+
// Load query parameters extractor script
|
|
15
|
+
loadScript(baseUrl + '/static/drf-to-mkdoc/javascripts/try-out/query-parameters-extractor.js');
|
|
16
|
+
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Field extractor for documentation content
|
|
2
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
3
|
+
// Extract filter fields and pagination fields from documentation
|
|
4
|
+
const FieldExtractor = {
|
|
5
|
+
init: function() {
|
|
6
|
+
// Extract fields from documentation
|
|
7
|
+
const fields = this.extractFieldsFromDocumentation();
|
|
8
|
+
|
|
9
|
+
// Make fields available for suggestions
|
|
10
|
+
if (fields && (fields.filter_fields.length > 0 || fields.pagination_fields.length > 0)) {
|
|
11
|
+
window.queryParametersData = window.queryParametersData || {};
|
|
12
|
+
|
|
13
|
+
// Add filter fields
|
|
14
|
+
if (fields.filter_fields.length > 0) {
|
|
15
|
+
window.queryParametersData.filter_fields = fields.filter_fields;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Add pagination fields
|
|
19
|
+
if (fields.pagination_fields.length > 0) {
|
|
20
|
+
window.queryParametersData.pagination_fields = fields.pagination_fields;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Initialize suggestions if TryOutSuggestions is available
|
|
24
|
+
if (window.TryOutSuggestions) {
|
|
25
|
+
window.TryOutSuggestions.init();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
extractFieldsFromDocumentation: function() {
|
|
31
|
+
const result = {
|
|
32
|
+
filter_fields: [],
|
|
33
|
+
pagination_fields: []
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Look for filter fields section
|
|
37
|
+
const filterFieldsHeading = document.querySelector('h3#filter-fields');
|
|
38
|
+
if (filterFieldsHeading) {
|
|
39
|
+
const filterFieldsList = filterFieldsHeading.nextElementSibling;
|
|
40
|
+
if (filterFieldsList && filterFieldsList.tagName === 'UL') {
|
|
41
|
+
const filterFields = Array.from(filterFieldsList.querySelectorAll('li code'))
|
|
42
|
+
.map(code => code.textContent.trim());
|
|
43
|
+
|
|
44
|
+
if (filterFields.length > 0) {
|
|
45
|
+
result.filter_fields = filterFields;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Look for pagination fields section
|
|
51
|
+
const paginationFieldsHeading = document.querySelector('h3#pagination-fields');
|
|
52
|
+
if (paginationFieldsHeading) {
|
|
53
|
+
const paginationFieldsList = paginationFieldsHeading.nextElementSibling;
|
|
54
|
+
if (paginationFieldsList && paginationFieldsList.tagName === 'UL') {
|
|
55
|
+
const paginationFields = Array.from(paginationFieldsList.querySelectorAll('li code'))
|
|
56
|
+
.map(code => code.textContent.trim());
|
|
57
|
+
|
|
58
|
+
if (paginationFields.length > 0) {
|
|
59
|
+
result.pagination_fields = paginationFields;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return result;
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
formatDocumentation: function() {
|
|
68
|
+
// Format filter fields section
|
|
69
|
+
this.formatSection('filter-fields', 'Filter Fields');
|
|
70
|
+
|
|
71
|
+
// Format pagination fields section
|
|
72
|
+
this.formatSection('pagination-fields', 'Pagination Fields');
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
formatSection: function(sectionId, title) {
|
|
76
|
+
const heading = document.querySelector(`h3#${sectionId}`);
|
|
77
|
+
if (!heading) return;
|
|
78
|
+
|
|
79
|
+
const list = heading.nextElementSibling;
|
|
80
|
+
if (!list || list.tagName !== 'UL') return;
|
|
81
|
+
|
|
82
|
+
// Create a new container div
|
|
83
|
+
const container = document.createElement('div');
|
|
84
|
+
container.className = 'api-parameters-section';
|
|
85
|
+
container.id = `${sectionId}-container`;
|
|
86
|
+
|
|
87
|
+
// Create a new heading
|
|
88
|
+
const newHeading = document.createElement('h3');
|
|
89
|
+
newHeading.id = sectionId;
|
|
90
|
+
newHeading.innerHTML = heading.innerHTML;
|
|
91
|
+
|
|
92
|
+
// Create a new list container
|
|
93
|
+
const listContainer = document.createElement('div');
|
|
94
|
+
listContainer.className = 'parameters-list';
|
|
95
|
+
|
|
96
|
+
// Create a description paragraph
|
|
97
|
+
const description = document.createElement('p');
|
|
98
|
+
description.className = 'parameters-description';
|
|
99
|
+
|
|
100
|
+
if (sectionId === 'filter-fields') {
|
|
101
|
+
description.textContent = 'These fields can be used to filter the API results. Add them as query parameters to your request.';
|
|
102
|
+
} else if (sectionId === 'pagination-fields') {
|
|
103
|
+
description.textContent = 'These fields control pagination of the API results.';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Process the list items to enhance them
|
|
107
|
+
const enhancedList = this.enhanceParametersList(list);
|
|
108
|
+
|
|
109
|
+
// Move the list into the container
|
|
110
|
+
listContainer.appendChild(enhancedList);
|
|
111
|
+
|
|
112
|
+
// Add elements to the container
|
|
113
|
+
container.appendChild(newHeading);
|
|
114
|
+
container.appendChild(description);
|
|
115
|
+
container.appendChild(listContainer);
|
|
116
|
+
|
|
117
|
+
// Replace the old elements with the new container
|
|
118
|
+
heading.parentNode.insertBefore(container, heading);
|
|
119
|
+
list.parentNode.removeChild(list);
|
|
120
|
+
heading.parentNode.removeChild(heading);
|
|
121
|
+
|
|
122
|
+
// Add try-it buttons
|
|
123
|
+
this.addTryItButtons(container, sectionId);
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
enhanceParametersList: function(list) {
|
|
127
|
+
// Clone the list
|
|
128
|
+
const enhancedList = list.cloneNode(true);
|
|
129
|
+
|
|
130
|
+
// Process each list item
|
|
131
|
+
Array.from(enhancedList.querySelectorAll('li')).forEach(li => {
|
|
132
|
+
const code = li.querySelector('code');
|
|
133
|
+
if (code) {
|
|
134
|
+
// Create a button to try this parameter
|
|
135
|
+
const tryButton = document.createElement('button');
|
|
136
|
+
tryButton.className = 'try-param-btn';
|
|
137
|
+
tryButton.textContent = 'Try it';
|
|
138
|
+
tryButton.dataset.param = code.textContent.trim();
|
|
139
|
+
tryButton.addEventListener('click', (e) => {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
this.addParameterToTryOut(e.target.dataset.param);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
li.appendChild(tryButton);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
return enhancedList;
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
addTryItButtons: function(container, sectionId) {
|
|
152
|
+
// Create a button to try all parameters in this section
|
|
153
|
+
const tryAllButton = document.createElement('button');
|
|
154
|
+
tryAllButton.className = 'try-all-params-btn';
|
|
155
|
+
tryAllButton.textContent = 'Try All Parameters';
|
|
156
|
+
|
|
157
|
+
tryAllButton.addEventListener('click', (e) => {
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
|
|
160
|
+
// Get all parameters in this section
|
|
161
|
+
const params = Array.from(container.querySelectorAll('code'))
|
|
162
|
+
.map(code => code.textContent.trim());
|
|
163
|
+
|
|
164
|
+
// Add all parameters to try-out form
|
|
165
|
+
params.forEach(param => this.addParameterToTryOut(param));
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Add the button to the container
|
|
169
|
+
container.appendChild(tryAllButton);
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
addParameterToTryOut: function(paramName) {
|
|
173
|
+
// Find the try-out modal or form
|
|
174
|
+
const tryOutModal = document.getElementById('tryOutModal');
|
|
175
|
+
if (!tryOutModal) return;
|
|
176
|
+
|
|
177
|
+
// Show the modal if it's not already visible
|
|
178
|
+
if (tryOutModal.style.display !== 'flex') {
|
|
179
|
+
if (window.ModalManager && window.ModalManager.openTryOut) {
|
|
180
|
+
window.ModalManager.openTryOut();
|
|
181
|
+
} else {
|
|
182
|
+
tryOutModal.style.display = 'flex';
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Add the parameter to the query parameters
|
|
187
|
+
if (window.TryOutSidebar && window.TryOutSidebar.addQueryParam) {
|
|
188
|
+
window.TryOutSidebar.addQueryParam(paramName);
|
|
189
|
+
} else if (window.FormManager && window.FormManager.addQueryParam) {
|
|
190
|
+
window.FormManager.addQueryParam(paramName);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// Initialize field extractor
|
|
196
|
+
FieldExtractor.init();
|
|
197
|
+
|
|
198
|
+
// Format documentation sections
|
|
199
|
+
FieldExtractor.formatDocumentation();
|
|
200
|
+
});
|