mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use neoteroi-mkdocs instead
- seems to render more reliably
This commit is contained in:
parent
2627917383
commit
45ac4e774f
@ -514,21 +514,6 @@ if USE_JWT:
|
||||
INSTALLED_APPS.append('rest_framework_simplejwt')
|
||||
|
||||
# WSGI default setting
|
||||
SPECTACULAR_SETTINGS = {
|
||||
'TITLE': 'InvenTree API',
|
||||
'DESCRIPTION': 'API for InvenTree - the intuitive open source inventory management system',
|
||||
'LICENSE': {
|
||||
'name': 'MIT',
|
||||
'url': 'https://github.com/inventree/InvenTree/blob/master/LICENSE',
|
||||
},
|
||||
'EXTERNAL_DOCS': {
|
||||
'description': 'More information about InvenTree in the official docs',
|
||||
'url': 'https://docs.inventree.org',
|
||||
},
|
||||
'VERSION': str(inventreeApiVersion()),
|
||||
'SERVE_INCLUDE_SCHEMA': False,
|
||||
}
|
||||
|
||||
WSGI_APPLICATION = 'InvenTree.wsgi.application'
|
||||
|
||||
"""
|
||||
@ -1177,3 +1162,23 @@ if CUSTOM_FLAGS:
|
||||
# Magic login django-sesame
|
||||
SESAME_MAX_AGE = 300
|
||||
LOGIN_REDIRECT_URL = '/api/auth/login-redirect/'
|
||||
|
||||
# Configuratino for API schema generation
|
||||
SPECTACULAR_SETTINGS = {
|
||||
'TITLE': 'InvenTree API',
|
||||
'DESCRIPTION': 'API for InvenTree - the intuitive open source inventory management system',
|
||||
'LICENSE': {
|
||||
'name': 'MIT',
|
||||
'url': 'https://github.com/inventree/InvenTree/blob/master/LICENSE',
|
||||
},
|
||||
'EXTERNAL_DOCS': {
|
||||
'description': 'More information about InvenTree in the official docs',
|
||||
'url': 'https://docs.inventree.org',
|
||||
},
|
||||
'VERSION': str(inventreeApiVersion()),
|
||||
'SERVE_INCLUDE_SCHEMA': False,
|
||||
'SCHEMA_PATH_PREFIX': '/api/',
|
||||
}
|
||||
|
||||
if SITE_URL:
|
||||
SPECTACULAR_SETTINGS['SERVERS'] = [SITE_URL]
|
||||
|
33261
docs/api.yml
Normal file
33261
docs/api.yml
Normal file
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,9 @@ The API is self-documenting, and the documentation is provided alongside any Inv
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
!!! info "Schema Description"
|
||||
The API schema is also documented in the [API Schema](./schema.md) page.
|
||||
|
||||
## Authentication
|
||||
|
||||
Users must be authenticated to gain access to the InvenTree API. The API accepts either basic username:password authentication, or token authentication. Token authentication is recommended as it provides much faster API access.
|
||||
|
@ -4,6 +4,10 @@ title: API Schema
|
||||
|
||||
The InvenTree API is implemented using the [Django REST framework](https://www.django-rest-framework.org). The API schema as documented below is generated using the [drf-spectactular](https://github.com/tfranzel/drf-spectacular/) extensions.
|
||||
|
||||
## Schama
|
||||
## Schema File
|
||||
|
||||
!!swagger api.yaml!!
|
||||
-- TODO -- download
|
||||
|
||||
## Schama Spcecification
|
||||
|
||||
[OAD(./docs/api.yml)]
|
||||
|
1399
docs/docs/stylesheets/neoteroi-mkdocs.css
Normal file
1399
docs/docs/stylesheets/neoteroi-mkdocs.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -55,6 +55,7 @@ extra_css:
|
||||
- stylesheets/bootstrap.css
|
||||
- stylesheets/splide.min.css
|
||||
- stylesheets/extra.css
|
||||
- stylesheets/neoteroi-mkdocs.css
|
||||
extra_javascript:
|
||||
- javascripts/extra.js
|
||||
- javascripts/fontawesome.js
|
||||
@ -223,7 +224,8 @@ nav:
|
||||
|
||||
# Plugins
|
||||
plugins:
|
||||
- render_swagger
|
||||
- neoteroi.mkdocsoad:
|
||||
use_pymdownx: true
|
||||
- include-markdown:
|
||||
opening_tag: "{!"
|
||||
closing_tag: "!}"
|
||||
@ -242,6 +244,8 @@ markdown_extensions:
|
||||
- meta
|
||||
- pymdownx.details
|
||||
- pymdownx.highlight
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
- pymdownx.superfences:
|
||||
custom_fences:
|
||||
- name: mermaid
|
||||
|
@ -4,4 +4,4 @@ mkdocs-material>=9.0,<10.0
|
||||
mkdocs-git-revision-date-localized-plugin>=1.1,<2.0
|
||||
mkdocs-simple-hooks>=0.1,<1.0
|
||||
mkdocs-include-markdown-plugin
|
||||
mkdocs-render-swagger-plugin
|
||||
neoteroi-mkdocs
|
||||
|
2
tasks.py
2
tasks.py
@ -898,6 +898,8 @@ def schema(c, filename='schema.yml', overwrite=False, ignore_warnings=False):
|
||||
"""Export current API schema."""
|
||||
check_file_existance(filename, overwrite)
|
||||
|
||||
filename = os.path.abspath(filename)
|
||||
|
||||
cmd = f'spectacular --file {filename} --validate --color'
|
||||
|
||||
if not ignore_warnings:
|
||||
|
Loading…
Reference in New Issue
Block a user