From 03e3872d807136fa69033620f5bc363cd0e2d79c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 12 Nov 2026 02:44:35 +0000 Subject: [PATCH] rebuild schema dynamically --- docs/.gitignore | 1 + docs/docs/api/schema/auth.md | 7 - docs/docs/api/schema/background-task.md | 7 - docs/docs/api/schema/barcode.md | 7 - docs/docs/api/schema/bom.md | 7 - docs/docs/api/schema/build.md | 7 - docs/docs/api/schema/company.md | 7 - docs/docs/api/schema/general.md | 7 - docs/docs/api/schema/label.md | 7 - docs/docs/api/schema/machine.md | 7 - docs/docs/api/schema/order.md | 7 - docs/docs/api/schema/part.md | 7 - docs/docs/api/schema/plugins.md | 7 - docs/docs/api/schema/pricing.md | 7 - docs/docs/api/schema/report.md | 7 - docs/docs/api/schema/settings.md | 7 - docs/docs/api/schema/stock.md | 7 - docs/docs/api/schema/user.md | 7 - docs/docs/stylesheets/extra.css | 21 + docs/docs/stylesheets/neoteroi-mkdocs.css | 1399 --------------------- docs/extract_schema.py | 103 +- docs/mkdocs.yml | 3 - docs/mkdocs.zensical.yml | 5 +- docs/render_schema.py | 667 ++++++++++ docs/requirements.in | 1 - docs/requirements.txt | 54 +- 26 files changed, 701 insertions(+), 1672 deletions(-) delete mode 100644 docs/docs/api/schema/auth.md delete mode 100644 docs/docs/api/schema/background-task.md delete mode 100644 docs/docs/api/schema/barcode.md delete mode 100644 docs/docs/api/schema/bom.md delete mode 100644 docs/docs/api/schema/build.md delete mode 100644 docs/docs/api/schema/company.md delete mode 100644 docs/docs/api/schema/general.md delete mode 100644 docs/docs/api/schema/label.md delete mode 100644 docs/docs/api/schema/machine.md delete mode 100644 docs/docs/api/schema/order.md delete mode 100644 docs/docs/api/schema/part.md delete mode 100644 docs/docs/api/schema/plugins.md delete mode 100644 docs/docs/api/schema/pricing.md delete mode 100644 docs/docs/api/schema/report.md delete mode 100644 docs/docs/api/schema/settings.md delete mode 100644 docs/docs/api/schema/stock.md delete mode 100644 docs/docs/api/schema/user.md delete mode 100644 docs/docs/stylesheets/neoteroi-mkdocs.css create mode 100644 docs/render_schema.py diff --git a/docs/.gitignore b/docs/.gitignore index 5581d0ad69..35d9dc5745 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -12,6 +12,7 @@ site/ # Generated API schema files docs/api/schema/*.yml +docs/api/schema/*.md # Temporary cache files url_cache.txt diff --git a/docs/docs/api/schema/auth.md b/docs/docs/api/schema/auth.md deleted file mode 100644 index 62c8b50103..0000000000 --- a/docs/docs/api/schema/auth.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Authorization and Authentication ---- - -The *Authorization and Authentication* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/auth.yml)] diff --git a/docs/docs/api/schema/background-task.md b/docs/docs/api/schema/background-task.md deleted file mode 100644 index b1d5ad0b92..0000000000 --- a/docs/docs/api/schema/background-task.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Background Task Management ---- - -The *Background Task Management* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/background-task.yml)] diff --git a/docs/docs/api/schema/barcode.md b/docs/docs/api/schema/barcode.md deleted file mode 100644 index c0f5cab2bf..0000000000 --- a/docs/docs/api/schema/barcode.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Barcode Scanning ---- - -The *Barcode Scanning* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/barcode.yml)] diff --git a/docs/docs/api/schema/bom.md b/docs/docs/api/schema/bom.md deleted file mode 100644 index cdfd1ff9c2..0000000000 --- a/docs/docs/api/schema/bom.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Bill of Materials ---- - -The *Bill of Materials* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/bom.yml)] diff --git a/docs/docs/api/schema/build.md b/docs/docs/api/schema/build.md deleted file mode 100644 index 3de0e521c6..0000000000 --- a/docs/docs/api/schema/build.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Build Order Management ---- - -The *Build Order Management* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/build.yml)] diff --git a/docs/docs/api/schema/company.md b/docs/docs/api/schema/company.md deleted file mode 100644 index 924d899ad4..0000000000 --- a/docs/docs/api/schema/company.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Company Management ---- - -The *Company Management* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/company.yml)] diff --git a/docs/docs/api/schema/general.md b/docs/docs/api/schema/general.md deleted file mode 100644 index 5da17b815d..0000000000 --- a/docs/docs/api/schema/general.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: General API Endpoints ---- - -The *General API Endpoints* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/general.yml)] diff --git a/docs/docs/api/schema/label.md b/docs/docs/api/schema/label.md deleted file mode 100644 index d4bc47e57c..0000000000 --- a/docs/docs/api/schema/label.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Label Printing ---- - -The *Label Printing* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/label.yml)] diff --git a/docs/docs/api/schema/machine.md b/docs/docs/api/schema/machine.md deleted file mode 100644 index 2fbadd41e6..0000000000 --- a/docs/docs/api/schema/machine.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: External Machine Management ---- - -The *External Machine Management* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/machine.yml)] diff --git a/docs/docs/api/schema/order.md b/docs/docs/api/schema/order.md deleted file mode 100644 index 7f6c8fdfd7..0000000000 --- a/docs/docs/api/schema/order.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: External Order Management ---- - -The *External Order Management* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/order.yml)] diff --git a/docs/docs/api/schema/part.md b/docs/docs/api/schema/part.md deleted file mode 100644 index 67c73eb0fb..0000000000 --- a/docs/docs/api/schema/part.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Parts and Part Categories ---- - -The *Parts and Part Categories* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/part.yml)] diff --git a/docs/docs/api/schema/plugins.md b/docs/docs/api/schema/plugins.md deleted file mode 100644 index ee0263cffa..0000000000 --- a/docs/docs/api/schema/plugins.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Plugin Functionality ---- - -The *Plugin Functionality* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/plugins.yml)] diff --git a/docs/docs/api/schema/pricing.md b/docs/docs/api/schema/pricing.md deleted file mode 100644 index a5bd183a65..0000000000 --- a/docs/docs/api/schema/pricing.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Part Pricing ---- - -The *Part Pricing* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/pricing.yml)] diff --git a/docs/docs/api/schema/report.md b/docs/docs/api/schema/report.md deleted file mode 100644 index dfad6d74be..0000000000 --- a/docs/docs/api/schema/report.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Report Generation ---- - -The *Report Generation* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/report.yml)] diff --git a/docs/docs/api/schema/settings.md b/docs/docs/api/schema/settings.md deleted file mode 100644 index 4a6d4f4337..0000000000 --- a/docs/docs/api/schema/settings.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Settings Management ---- - -The *Settings Management* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/settings.yml)] diff --git a/docs/docs/api/schema/stock.md b/docs/docs/api/schema/stock.md deleted file mode 100644 index 7b961e4b5b..0000000000 --- a/docs/docs/api/schema/stock.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Stock and Stock Locations ---- - -The *Stock and Stock Locations* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/stock.yml)] diff --git a/docs/docs/api/schema/user.md b/docs/docs/api/schema/user.md deleted file mode 100644 index e0ebba2770..0000000000 --- a/docs/docs/api/schema/user.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: User Management ---- - -The *User Management* section of the InvenTree API schema is documented below. - -[OAD(./docs/docs/api/schema/user.yml)] diff --git a/docs/docs/stylesheets/extra.css b/docs/docs/stylesheets/extra.css index 06290b1c4f..a248d7c279 100644 --- a/docs/docs/stylesheets/extra.css +++ b/docs/docs/stylesheets/extra.css @@ -155,3 +155,24 @@ div:nth-of-type(1) p { background-color: #5bc0de; color: #555; } + +/* HTTP method badges for the generated API schema documentation */ +.api-method { + display: inline-block; + min-width: 4.2em; + padding: 0.1em 0.5em; + border-radius: 0.2rem; + color: #fff; + font-family: var(--md-code-font-family); + font-size: 0.75em; + font-weight: 700; + text-align: center; + vertical-align: middle; +} + +.api-method-get { background-color: #2b8a3e; } +.api-method-post { background-color: #1971c2; } +.api-method-put { background-color: #e67700; } +.api-method-patch { background-color: #9c36b5; } +.api-method-delete { background-color: #c92a2a; } +.api-method-head, .api-method-options { background-color: #495057; } diff --git a/docs/docs/stylesheets/neoteroi-mkdocs.css b/docs/docs/stylesheets/neoteroi-mkdocs.css deleted file mode 100644 index ee7d53a554..0000000000 --- a/docs/docs/stylesheets/neoteroi-mkdocs.css +++ /dev/null @@ -1,1399 +0,0 @@ -/** - * All CSS for the neoteroi.projects.gantt extension. - * - * https://github.com/Neoteroi/mkdocs-plugins -**/ -:root { - --nt-color-0: #CD853F; - --nt-color-1: #B22222; - --nt-color-2: #000080; - --nt-color-3: #4B0082; - --nt-color-4: #3CB371; - --nt-color-5: #D2B48C; - --nt-color-6: #FF00FF; - --nt-color-7: #98FB98; - --nt-color-8: #FFEBCD; - --nt-color-9: #2E8B57; - --nt-color-10: #6A5ACD; - --nt-color-11: #48D1CC; - --nt-color-12: #FFA500; - --nt-color-13: #F4A460; - --nt-color-14: #A52A2A; - --nt-color-15: #FFE4C4; - --nt-color-16: #FF4500; - --nt-color-17: #AFEEEE; - --nt-color-18: #FA8072; - --nt-color-19: #2F4F4F; - --nt-color-20: #FFDAB9; - --nt-color-21: #BC8F8F; - --nt-color-22: #FFC0CB; - --nt-color-23: #00FA9A; - --nt-color-24: #F0FFF0; - --nt-color-25: #FFFACD; - --nt-color-26: #F5F5F5; - --nt-color-27: #FF6347; - --nt-color-28: #FFFFF0; - --nt-color-29: #7FFFD4; - --nt-color-30: #E9967A; - --nt-color-31: #7B68EE; - --nt-color-32: #FFF8DC; - --nt-color-33: #0000CD; - --nt-color-34: #D2691E; - --nt-color-35: #708090; - --nt-color-36: #5F9EA0; - --nt-color-37: #008080; - --nt-color-38: #008000; - --nt-color-39: #FFE4E1; - --nt-color-40: #FFFF00; - --nt-color-41: #FFFAF0; - --nt-color-42: #DCDCDC; - --nt-color-43: #ADFF2F; - --nt-color-44: #ADD8E6; - --nt-color-45: #8B008B; - --nt-color-46: #7FFF00; - --nt-color-47: #800000; - --nt-color-48: #20B2AA; - --nt-color-49: #556B2F; - --nt-color-50: #778899; - --nt-color-51: #E6E6FA; - --nt-color-52: #FFFAFA; - --nt-color-53: #FF7F50; - --nt-color-54: #FF0000; - --nt-color-55: #F5DEB3; - --nt-color-56: #008B8B; - --nt-color-57: #66CDAA; - --nt-color-58: #808000; - --nt-color-59: #FAF0E6; - --nt-color-60: #00BFFF; - --nt-color-61: #C71585; - --nt-color-62: #00FFFF; - --nt-color-63: #8B4513; - --nt-color-64: #F0F8FF; - --nt-color-65: #FAEBD7; - --nt-color-66: #8B0000; - --nt-color-67: #4682B4; - --nt-color-68: #F0E68C; - --nt-color-69: #BDB76B; - --nt-color-70: #A0522D; - --nt-color-71: #FAFAD2; - --nt-color-72: #FFD700; - --nt-color-73: #DEB887; - --nt-color-74: #E0FFFF; - --nt-color-75: #8A2BE2; - --nt-color-76: #32CD32; - --nt-color-77: #87CEFA; - --nt-color-78: #00CED1; - --nt-color-79: #696969; - --nt-color-80: #DDA0DD; - --nt-color-81: #EE82EE; - --nt-color-82: #FFB6C1; - --nt-color-83: #8FBC8F; - --nt-color-84: #D8BFD8; - --nt-color-85: #9400D3; - --nt-color-86: #A9A9A9; - --nt-color-87: #FFFFE0; - --nt-color-88: #FFF5EE; - --nt-color-89: #FFF0F5; - --nt-color-90: #FFDEAD; - --nt-color-91: #800080; - --nt-color-92: #B0E0E6; - --nt-color-93: #9932CC; - --nt-color-94: #DAA520; - --nt-color-95: #F0FFFF; - --nt-color-96: #40E0D0; - --nt-color-97: #00FF7F; - --nt-color-98: #006400; - --nt-color-99: #808080; - --nt-color-100: #87CEEB; - --nt-color-101: #0000FF; - --nt-color-102: #6495ED; - --nt-color-103: #FDF5E6; - --nt-color-104: #B8860B; - --nt-color-105: #BA55D3; - --nt-color-106: #C0C0C0; - --nt-color-107: #000000; - --nt-color-108: #F08080; - --nt-color-109: #B0C4DE; - --nt-color-110: #00008B; - --nt-color-111: #6B8E23; - --nt-color-112: #FFE4B5; - --nt-color-113: #FFA07A; - --nt-color-114: #9ACD32; - --nt-color-115: #FFFFFF; - --nt-color-116: #F5F5DC; - --nt-color-117: #90EE90; - --nt-color-118: #1E90FF; - --nt-color-119: #7CFC00; - --nt-color-120: #FF69B4; - --nt-color-121: #F8F8FF; - --nt-color-122: #F5FFFA; - --nt-color-123: #00FF00; - --nt-color-124: #D3D3D3; - --nt-color-125: #DB7093; - --nt-color-126: #DA70D6; - --nt-color-127: #FF1493; - --nt-color-128: #228B22; - --nt-color-129: #FFEFD5; - --nt-color-130: #4169E1; - --nt-color-131: #191970; - --nt-color-132: #9370DB; - --nt-color-133: #483D8B; - --nt-color-134: #FF8C00; - --nt-color-135: #EEE8AA; - --nt-color-136: #CD5C5C; - --nt-color-137: #DC143C; -} - -:root { - --nt-group-0-main: #000000; - --nt-group-0-dark: #FFFFFF; - --nt-group-0-light: #000000; - --nt-group-0-main-bg: #F44336; - --nt-group-0-dark-bg: #BA000D; - --nt-group-0-light-bg: #FF7961; - --nt-group-1-main: #000000; - --nt-group-1-dark: #FFFFFF; - --nt-group-1-light: #000000; - --nt-group-1-main-bg: #E91E63; - --nt-group-1-dark-bg: #B0003A; - --nt-group-1-light-bg: #FF6090; - --nt-group-2-main: #FFFFFF; - --nt-group-2-dark: #FFFFFF; - --nt-group-2-light: #000000; - --nt-group-2-main-bg: #9C27B0; - --nt-group-2-dark-bg: #6A0080; - --nt-group-2-light-bg: #D05CE3; - --nt-group-3-main: #FFFFFF; - --nt-group-3-dark: #FFFFFF; - --nt-group-3-light: #000000; - --nt-group-3-main-bg: #673AB7; - --nt-group-3-dark-bg: #320B86; - --nt-group-3-light-bg: #9A67EA; - --nt-group-4-main: #FFFFFF; - --nt-group-4-dark: #FFFFFF; - --nt-group-4-light: #000000; - --nt-group-4-main-bg: #3F51B5; - --nt-group-4-dark-bg: #002984; - --nt-group-4-light-bg: #757DE8; - --nt-group-5-main: #000000; - --nt-group-5-dark: #FFFFFF; - --nt-group-5-light: #000000; - --nt-group-5-main-bg: #2196F3; - --nt-group-5-dark-bg: #0069C0; - --nt-group-5-light-bg: #6EC6FF; - --nt-group-6-main: #000000; - --nt-group-6-dark: #FFFFFF; - --nt-group-6-light: #000000; - --nt-group-6-main-bg: #03A9F4; - --nt-group-6-dark-bg: #007AC1; - --nt-group-6-light-bg: #67DAFF; - --nt-group-7-main: #000000; - --nt-group-7-dark: #000000; - --nt-group-7-light: #000000; - --nt-group-7-main-bg: #00BCD4; - --nt-group-7-dark-bg: #008BA3; - --nt-group-7-light-bg: #62EFFF; - --nt-group-8-main: #000000; - --nt-group-8-dark: #FFFFFF; - --nt-group-8-light: #000000; - --nt-group-8-main-bg: #009688; - --nt-group-8-dark-bg: #00675B; - --nt-group-8-light-bg: #52C7B8; - --nt-group-9-main: #000000; - --nt-group-9-dark: #FFFFFF; - --nt-group-9-light: #000000; - --nt-group-9-main-bg: #4CAF50; - --nt-group-9-dark-bg: #087F23; - --nt-group-9-light-bg: #80E27E; - --nt-group-10-main: #000000; - --nt-group-10-dark: #000000; - --nt-group-10-light: #000000; - --nt-group-10-main-bg: #8BC34A; - --nt-group-10-dark-bg: #5A9216; - --nt-group-10-light-bg: #BEF67A; - --nt-group-11-main: #000000; - --nt-group-11-dark: #000000; - --nt-group-11-light: #000000; - --nt-group-11-main-bg: #CDDC39; - --nt-group-11-dark-bg: #99AA00; - --nt-group-11-light-bg: #FFFF6E; - --nt-group-12-main: #000000; - --nt-group-12-dark: #000000; - --nt-group-12-light: #000000; - --nt-group-12-main-bg: #FFEB3B; - --nt-group-12-dark-bg: #C8B900; - --nt-group-12-light-bg: #FFFF72; - --nt-group-13-main: #000000; - --nt-group-13-dark: #000000; - --nt-group-13-light: #000000; - --nt-group-13-main-bg: #FFC107; - --nt-group-13-dark-bg: #C79100; - --nt-group-13-light-bg: #FFF350; - --nt-group-14-main: #000000; - --nt-group-14-dark: #000000; - --nt-group-14-light: #000000; - --nt-group-14-main-bg: #FF9800; - --nt-group-14-dark-bg: #C66900; - --nt-group-14-light-bg: #FFC947; - --nt-group-15-main: #000000; - --nt-group-15-dark: #FFFFFF; - --nt-group-15-light: #000000; - --nt-group-15-main-bg: #FF5722; - --nt-group-15-dark-bg: #C41C00; - --nt-group-15-light-bg: #FF8A50; - --nt-group-16-main: #FFFFFF; - --nt-group-16-dark: #FFFFFF; - --nt-group-16-light: #000000; - --nt-group-16-main-bg: #795548; - --nt-group-16-dark-bg: #4B2C20; - --nt-group-16-light-bg: #A98274; - --nt-group-17-main: #000000; - --nt-group-17-dark: #FFFFFF; - --nt-group-17-light: #000000; - --nt-group-17-main-bg: #9E9E9E; - --nt-group-17-dark-bg: #707070; - --nt-group-17-light-bg: #CFCFCF; - --nt-group-18-main: #000000; - --nt-group-18-dark: #FFFFFF; - --nt-group-18-light: #000000; - --nt-group-18-main-bg: #607D8B; - --nt-group-18-dark-bg: #34515E; - --nt-group-18-light-bg: #8EACBB; -} - -.nt-pastello { - --nt-group-0-main: #000000; - --nt-group-0-dark: #000000; - --nt-group-0-light: #000000; - --nt-group-0-main-bg: #EF9A9A; - --nt-group-0-dark-bg: #BA6B6C; - --nt-group-0-light-bg: #FFCCCB; - --nt-group-1-main: #000000; - --nt-group-1-dark: #000000; - --nt-group-1-light: #000000; - --nt-group-1-main-bg: #F48FB1; - --nt-group-1-dark-bg: #BF5F82; - --nt-group-1-light-bg: #FFC1E3; - --nt-group-2-main: #000000; - --nt-group-2-dark: #000000; - --nt-group-2-light: #000000; - --nt-group-2-main-bg: #CE93D8; - --nt-group-2-dark-bg: #9C64A6; - --nt-group-2-light-bg: #FFC4FF; - --nt-group-3-main: #000000; - --nt-group-3-dark: #000000; - --nt-group-3-light: #000000; - --nt-group-3-main-bg: #B39DDB; - --nt-group-3-dark-bg: #836FA9; - --nt-group-3-light-bg: #E6CEFF; - --nt-group-4-main: #000000; - --nt-group-4-dark: #000000; - --nt-group-4-light: #000000; - --nt-group-4-main-bg: #9FA8DA; - --nt-group-4-dark-bg: #6F79A8; - --nt-group-4-light-bg: #D1D9FF; - --nt-group-5-main: #000000; - --nt-group-5-dark: #000000; - --nt-group-5-light: #000000; - --nt-group-5-main-bg: #90CAF9; - --nt-group-5-dark-bg: #5D99C6; - --nt-group-5-light-bg: #C3FDFF; - --nt-group-6-main: #000000; - --nt-group-6-dark: #000000; - --nt-group-6-light: #000000; - --nt-group-6-main-bg: #81D4FA; - --nt-group-6-dark-bg: #4BA3C7; - --nt-group-6-light-bg: #B6FFFF; - --nt-group-7-main: #000000; - --nt-group-7-dark: #000000; - --nt-group-7-light: #000000; - --nt-group-7-main-bg: #80DEEA; - --nt-group-7-dark-bg: #4BACB8; - --nt-group-7-light-bg: #B4FFFF; - --nt-group-8-main: #000000; - --nt-group-8-dark: #000000; - --nt-group-8-light: #000000; - --nt-group-8-main-bg: #80CBC4; - --nt-group-8-dark-bg: #4F9A94; - --nt-group-8-light-bg: #B2FEF7; - --nt-group-9-main: #000000; - --nt-group-9-dark: #000000; - --nt-group-9-light: #000000; - --nt-group-9-main-bg: #A5D6A7; - --nt-group-9-dark-bg: #75A478; - --nt-group-9-light-bg: #D7FFD9; - --nt-group-10-main: #000000; - --nt-group-10-dark: #000000; - --nt-group-10-light: #000000; - --nt-group-10-main-bg: #C5E1A5; - --nt-group-10-dark-bg: #94AF76; - --nt-group-10-light-bg: #F8FFD7; - --nt-group-11-main: #000000; - --nt-group-11-dark: #000000; - --nt-group-11-light: #000000; - --nt-group-11-main-bg: #E6EE9C; - --nt-group-11-dark-bg: #B3BC6D; - --nt-group-11-light-bg: #FFFFCE; - --nt-group-12-main: #000000; - --nt-group-12-dark: #000000; - --nt-group-12-light: #000000; - --nt-group-12-main-bg: #FFF59D; - --nt-group-12-dark-bg: #CBC26D; - --nt-group-12-light-bg: #FFFFCF; - --nt-group-13-main: #000000; - --nt-group-13-dark: #000000; - --nt-group-13-light: #000000; - --nt-group-13-main-bg: #FFE082; - --nt-group-13-dark-bg: #CAAE53; - --nt-group-13-light-bg: #FFFFB3; - --nt-group-14-main: #000000; - --nt-group-14-dark: #000000; - --nt-group-14-light: #000000; - --nt-group-14-main-bg: #FFCC80; - --nt-group-14-dark-bg: #CA9B52; - --nt-group-14-light-bg: #FFFFB0; - --nt-group-15-main: #000000; - --nt-group-15-dark: #000000; - --nt-group-15-light: #000000; - --nt-group-15-main-bg: #FFAB91; - --nt-group-15-dark-bg: #C97B63; - --nt-group-15-light-bg: #FFDDC1; - --nt-group-16-main: #000000; - --nt-group-16-dark: #000000; - --nt-group-16-light: #000000; - --nt-group-16-main-bg: #BCAAA4; - --nt-group-16-dark-bg: #8C7B75; - --nt-group-16-light-bg: #EFDCD5; - --nt-group-17-main: #000000; - --nt-group-17-dark: #000000; - --nt-group-17-light: #000000; - --nt-group-17-main-bg: #EEEEEE; - --nt-group-17-dark-bg: #BCBCBC; - --nt-group-17-light-bg: #FFFFFF; - --nt-group-18-main: #000000; - --nt-group-18-dark: #000000; - --nt-group-18-light: #000000; - --nt-group-18-main-bg: #B0BEC5; - --nt-group-18-dark-bg: #808E95; - --nt-group-18-light-bg: #E2F1F8; -} - -.nt-group-0 .nt-plan-group-summary, -.nt-group-0 .nt-timeline-dot { - color: var(--nt-group-0-dark); - background-color: var(--nt-group-0-dark-bg); -} -.nt-group-0 .period { - color: var(--nt-group-0-main); - background-color: var(--nt-group-0-main-bg); -} - -.nt-group-1 .nt-plan-group-summary, -.nt-group-1 .nt-timeline-dot { - color: var(--nt-group-1-dark); - background-color: var(--nt-group-1-dark-bg); -} -.nt-group-1 .period { - color: var(--nt-group-1-main); - background-color: var(--nt-group-1-main-bg); -} - -.nt-group-2 .nt-plan-group-summary, -.nt-group-2 .nt-timeline-dot { - color: var(--nt-group-2-dark); - background-color: var(--nt-group-2-dark-bg); -} -.nt-group-2 .period { - color: var(--nt-group-2-main); - background-color: var(--nt-group-2-main-bg); -} - -.nt-group-3 .nt-plan-group-summary, -.nt-group-3 .nt-timeline-dot { - color: var(--nt-group-3-dark); - background-color: var(--nt-group-3-dark-bg); -} -.nt-group-3 .period { - color: var(--nt-group-3-main); - background-color: var(--nt-group-3-main-bg); -} - -.nt-group-4 .nt-plan-group-summary, -.nt-group-4 .nt-timeline-dot { - color: var(--nt-group-4-dark); - background-color: var(--nt-group-4-dark-bg); -} -.nt-group-4 .period { - color: var(--nt-group-4-main); - background-color: var(--nt-group-4-main-bg); -} - -.nt-group-5 .nt-plan-group-summary, -.nt-group-5 .nt-timeline-dot { - color: var(--nt-group-5-dark); - background-color: var(--nt-group-5-dark-bg); -} -.nt-group-5 .period { - color: var(--nt-group-5-main); - background-color: var(--nt-group-5-main-bg); -} - -.nt-group-6 .nt-plan-group-summary, -.nt-group-6 .nt-timeline-dot { - color: var(--nt-group-6-dark); - background-color: var(--nt-group-6-dark-bg); -} -.nt-group-6 .period { - color: var(--nt-group-6-main); - background-color: var(--nt-group-6-main-bg); -} - -.nt-group-7 .nt-plan-group-summary, -.nt-group-7 .nt-timeline-dot { - color: var(--nt-group-7-dark); - background-color: var(--nt-group-7-dark-bg); -} -.nt-group-7 .period { - color: var(--nt-group-7-main); - background-color: var(--nt-group-7-main-bg); -} - -.nt-group-8 .nt-plan-group-summary, -.nt-group-8 .nt-timeline-dot { - color: var(--nt-group-8-dark); - background-color: var(--nt-group-8-dark-bg); -} -.nt-group-8 .period { - color: var(--nt-group-8-main); - background-color: var(--nt-group-8-main-bg); -} - -.nt-group-9 .nt-plan-group-summary, -.nt-group-9 .nt-timeline-dot { - color: var(--nt-group-9-dark); - background-color: var(--nt-group-9-dark-bg); -} -.nt-group-9 .period { - color: var(--nt-group-9-main); - background-color: var(--nt-group-9-main-bg); -} - -.nt-group-10 .nt-plan-group-summary, -.nt-group-10 .nt-timeline-dot { - color: var(--nt-group-10-dark); - background-color: var(--nt-group-10-dark-bg); -} -.nt-group-10 .period { - color: var(--nt-group-10-main); - background-color: var(--nt-group-10-main-bg); -} - -.nt-group-11 .nt-plan-group-summary, -.nt-group-11 .nt-timeline-dot { - color: var(--nt-group-11-dark); - background-color: var(--nt-group-11-dark-bg); -} -.nt-group-11 .period { - color: var(--nt-group-11-main); - background-color: var(--nt-group-11-main-bg); -} - -.nt-group-12 .nt-plan-group-summary, -.nt-group-12 .nt-timeline-dot { - color: var(--nt-group-12-dark); - background-color: var(--nt-group-12-dark-bg); -} -.nt-group-12 .period { - color: var(--nt-group-12-main); - background-color: var(--nt-group-12-main-bg); -} - -.nt-group-13 .nt-plan-group-summary, -.nt-group-13 .nt-timeline-dot { - color: var(--nt-group-13-dark); - background-color: var(--nt-group-13-dark-bg); -} -.nt-group-13 .period { - color: var(--nt-group-13-main); - background-color: var(--nt-group-13-main-bg); -} - -.nt-group-14 .nt-plan-group-summary, -.nt-group-14 .nt-timeline-dot { - color: var(--nt-group-14-dark); - background-color: var(--nt-group-14-dark-bg); -} -.nt-group-14 .period { - color: var(--nt-group-14-main); - background-color: var(--nt-group-14-main-bg); -} - -.nt-group-15 .nt-plan-group-summary, -.nt-group-15 .nt-timeline-dot { - color: var(--nt-group-15-dark); - background-color: var(--nt-group-15-dark-bg); -} -.nt-group-15 .period { - color: var(--nt-group-15-main); - background-color: var(--nt-group-15-main-bg); -} - -.nt-group-16 .nt-plan-group-summary, -.nt-group-16 .nt-timeline-dot { - color: var(--nt-group-16-dark); - background-color: var(--nt-group-16-dark-bg); -} -.nt-group-16 .period { - color: var(--nt-group-16-main); - background-color: var(--nt-group-16-main-bg); -} - -.nt-group-17 .nt-plan-group-summary, -.nt-group-17 .nt-timeline-dot { - color: var(--nt-group-17-dark); - background-color: var(--nt-group-17-dark-bg); -} -.nt-group-17 .period { - color: var(--nt-group-17-main); - background-color: var(--nt-group-17-main-bg); -} - -.nt-group-18 .nt-plan-group-summary, -.nt-group-18 .nt-timeline-dot { - color: var(--nt-group-18-dark); - background-color: var(--nt-group-18-dark-bg); -} -.nt-group-18 .period { - color: var(--nt-group-18-main); - background-color: var(--nt-group-18-main-bg); -} - -/** - * Extra CSS file for MkDocs and the neoteroi.timeline extension. - * - * https://github.com/Neoteroi/mkdocs-plugins -**/ -.nt-error { - border: 2px dashed darkred; - padding: 0 1rem; - background: #faf9ba; - color: darkred; -} - -.nt-timeline { - margin-top: 30px; -} -.nt-timeline .nt-timeline-title { - font-size: 1.1rem; - margin-top: 0; -} -.nt-timeline .nt-timeline-sub-title { - margin-top: 0; -} -.nt-timeline .nt-timeline-content { - font-size: 0.8rem; - border-bottom: 2px dashed #ccc; - padding-bottom: 1.2rem; -} -.nt-timeline.horizontal .nt-timeline-items { - flex-direction: row; - overflow-x: scroll; -} -.nt-timeline.horizontal .nt-timeline-items > div { - min-width: 400px; - margin-right: 50px; -} -.nt-timeline.horizontal.reverse .nt-timeline-items { - flex-direction: row-reverse; -} -.nt-timeline.horizontal.center .nt-timeline-before { - background-image: linear-gradient(rgba(252, 70, 107, 0) 0%, rgb(252, 70, 107) 100%); - background-repeat: no-repeat; - background-size: 100% 2px; - background-position: 0 center; -} -.nt-timeline.horizontal.center .nt-timeline-after { - background-image: linear-gradient(180deg, rgb(252, 70, 107) 0%, rgba(252, 70, 107, 0) 100%); - background-repeat: no-repeat; - background-size: 100% 2px; - background-position: 0 center; -} -.nt-timeline.horizontal.center .nt-timeline-items { - background-image: radial-gradient(circle, rgb(63, 94, 251) 0%, rgb(252, 70, 107) 100%); - background-repeat: no-repeat; - background-size: 100% 2px; - background-position: 0 center; -} -.nt-timeline.horizontal .nt-timeline-dot { - left: 50%; -} -.nt-timeline.horizontal .nt-timeline-dot:not(.bigger) { - top: calc(50% - 4px); -} -.nt-timeline.horizontal .nt-timeline-dot.bigger { - top: calc(50% - 15px); -} -.nt-timeline.vertical .nt-timeline-items { - flex-direction: column; -} -.nt-timeline.vertical.reverse .nt-timeline-items { - flex-direction: column-reverse; -} -.nt-timeline.vertical.center .nt-timeline-before { - background: linear-gradient(rgba(252, 70, 107, 0) 0%, rgb(252, 70, 107) 100%) no-repeat center/2px 100%; -} -.nt-timeline.vertical.center .nt-timeline-after { - background: linear-gradient(rgb(252, 70, 107) 0%, rgba(252, 70, 107, 0) 100%) no-repeat center/2px 100%; -} -.nt-timeline.vertical.center .nt-timeline-items { - background: radial-gradient(circle, rgb(63, 94, 251) 0%, rgb(252, 70, 107) 100%) no-repeat center/2px 100%; -} -.nt-timeline.vertical.center .nt-timeline-dot { - left: calc(50% - 10px); -} -.nt-timeline.vertical.center .nt-timeline-dot:not(.bigger) { - top: 10px; -} -.nt-timeline.vertical.center .nt-timeline-dot.bigger { - left: calc(50% - 20px); -} -.nt-timeline.vertical.left { - padding-left: 100px; -} -.nt-timeline.vertical.left .nt-timeline-item { - padding-left: 70px; -} -.nt-timeline.vertical.left .nt-timeline-sub-title { - left: -100px; - width: 100px; -} -.nt-timeline.vertical.left .nt-timeline-before { - background: linear-gradient(rgba(252, 70, 107, 0) 0%, rgb(252, 70, 107) 100%) no-repeat 30px/2px 100%; -} -.nt-timeline.vertical.left .nt-timeline-after { - background: linear-gradient(rgb(252, 70, 107) 0%, rgba(252, 70, 107, 0) 100%) no-repeat 30px/2px 100%; -} -.nt-timeline.vertical.left .nt-timeline-items { - background: radial-gradient(circle, rgb(63, 94, 251) 0%, rgb(252, 70, 107) 100%) no-repeat 30px/2px 100%; -} -.nt-timeline.vertical.left .nt-timeline-dot { - left: 21px; - top: 8px; -} -.nt-timeline.vertical.left .nt-timeline-dot.bigger { - top: 0px; - left: 10px; -} -.nt-timeline.vertical.right { - padding-right: 100px; -} -.nt-timeline.vertical.right .nt-timeline-sub-title { - right: -100px; - text-align: left; - width: 100px; -} -.nt-timeline.vertical.right .nt-timeline-item { - padding-right: 70px; -} -.nt-timeline.vertical.right .nt-timeline-before { - background: linear-gradient(rgba(252, 70, 107, 0) 0%, rgb(252, 70, 107) 100%) no-repeat calc(100% - 30px)/2px 100%; -} -.nt-timeline.vertical.right .nt-timeline-after { - background: linear-gradient(rgb(252, 70, 107) 0%, rgba(252, 70, 107, 0) 100%) no-repeat calc(100% - 30px)/2px 100%; -} -.nt-timeline.vertical.right .nt-timeline-items { - background: radial-gradient(circle, rgb(63, 94, 251) 0%, rgb(252, 70, 107) 100%) no-repeat calc(100% - 30px)/2px 100%; -} -.nt-timeline.vertical.right .nt-timeline-dot { - right: 21px; - top: 8px; -} -.nt-timeline.vertical.right .nt-timeline-dot.bigger { - top: 10px; - right: 10px; -} - -.nt-timeline-items { - display: flex; - position: relative; -} -.nt-timeline-items > div { - min-height: 100px; - padding-top: 2px; - padding-bottom: 20px; -} - -.nt-timeline-before { - content: ""; - height: 15px; -} - -.nt-timeline-after { - content: ""; - height: 60px; - margin-bottom: 20px; -} - -.nt-timeline-sub-title { - position: absolute; - width: 50%; - top: 4px; - font-size: 18px; - color: var(--nt-color-50); -} - -[data-md-color-scheme=slate] .nt-timeline-sub-title { - color: var(--nt-color-51); -} - -.nt-timeline-item { - position: relative; -} - -.nt-timeline.vertical.center:not(.alternate) .nt-timeline-item { - padding-left: calc(50% + 40px); -} -.nt-timeline.vertical.center:not(.alternate) .nt-timeline-item .nt-timeline-sub-title { - left: 0; - padding-right: 40px; - text-align: right; -} -.nt-timeline.vertical.center.alternate .nt-timeline-item:nth-child(odd) { - padding-left: calc(50% + 40px); -} -.nt-timeline.vertical.center.alternate .nt-timeline-item:nth-child(odd) .nt-timeline-sub-title { - left: 0; - padding-right: 40px; - text-align: right; -} -.nt-timeline.vertical.center.alternate .nt-timeline-item:nth-child(even) { - text-align: right; - padding-right: calc(50% + 40px); -} -.nt-timeline.vertical.center.alternate .nt-timeline-item:nth-child(even) .nt-timeline-sub-title { - right: 0; - padding-left: 40px; - text-align: left; -} - -.nt-timeline-dot { - position: relative; - width: 20px; - height: 20px; - border-radius: 100%; - background-color: #fc5b5b; - position: absolute; - top: 0px; - z-index: 2; - display: flex; - justify-content: center; - align-items: center; - box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12); - border: 3px solid white; -} -.nt-timeline-dot:not(.bigger) .icon { - font-size: 10px; -} -.nt-timeline-dot.bigger { - width: 40px; - height: 40px; - padding: 3px; -} -.nt-timeline-dot .icon { - color: white; -} - -/* Fix for webkit (Chrome, Safari) */ -@supports not (-moz-appearance: none) { - /* - This fix is necessary, for some reason, to render the timeline properly - inside `details` elements used by pymdownx. Firefox doesn't need this fix, - it renders elements properly. - */ - details .nt-timeline.vertical.center.alternate .nt-timeline-item:nth-child(odd) .nt-timeline-sub-title, -details .nt-timeline.vertical.center:not(.alternate) .nt-timeline-item .nt-timeline-sub-title { - left: -40px; - } - details .nt-timeline.vertical.center.alternate .nt-timeline-item:nth-child(even) .nt-timeline-sub-title { - right: -40px; - } - details .nt-timeline.vertical.center .nt-timeline-dot { - left: calc(50% - 12px); - } - details .nt-timeline-dot.bigger { - font-size: 1rem !important; - } -} -/* default colors */ -.nt-timeline-item:nth-child(0) .nt-timeline-dot { - background-color: var(--nt-color-0); -} - -.nt-timeline-item:nth-child(1) .nt-timeline-dot { - background-color: var(--nt-color-1); -} - -.nt-timeline-item:nth-child(2) .nt-timeline-dot { - background-color: var(--nt-color-2); -} - -.nt-timeline-item:nth-child(3) .nt-timeline-dot { - background-color: var(--nt-color-3); -} - -.nt-timeline-item:nth-child(4) .nt-timeline-dot { - background-color: var(--nt-color-4); -} - -.nt-timeline-item:nth-child(5) .nt-timeline-dot { - background-color: var(--nt-color-5); -} - -.nt-timeline-item:nth-child(6) .nt-timeline-dot { - background-color: var(--nt-color-6); -} - -.nt-timeline-item:nth-child(7) .nt-timeline-dot { - background-color: var(--nt-color-7); -} - -.nt-timeline-item:nth-child(8) .nt-timeline-dot { - background-color: var(--nt-color-8); -} - -.nt-timeline-item:nth-child(9) .nt-timeline-dot { - background-color: var(--nt-color-9); -} - -.nt-timeline-item:nth-child(10) .nt-timeline-dot { - background-color: var(--nt-color-10); -} - -.nt-timeline-item:nth-child(11) .nt-timeline-dot { - background-color: var(--nt-color-11); -} - -.nt-timeline-item:nth-child(12) .nt-timeline-dot { - background-color: var(--nt-color-12); -} - -.nt-timeline-item:nth-child(13) .nt-timeline-dot { - background-color: var(--nt-color-13); -} - -.nt-timeline-item:nth-child(14) .nt-timeline-dot { - background-color: var(--nt-color-14); -} - -.nt-timeline-item:nth-child(15) .nt-timeline-dot { - background-color: var(--nt-color-15); -} - -.nt-timeline-item:nth-child(16) .nt-timeline-dot { - background-color: var(--nt-color-16); -} - -.nt-timeline-item:nth-child(17) .nt-timeline-dot { - background-color: var(--nt-color-17); -} - -.nt-timeline-item:nth-child(18) .nt-timeline-dot { - background-color: var(--nt-color-18); -} - -.nt-timeline-item:nth-child(19) .nt-timeline-dot { - background-color: var(--nt-color-19); -} - -.nt-timeline-item:nth-child(20) .nt-timeline-dot { - background-color: var(--nt-color-20); -} - -/** - * Extra CSS for the neoteroi.projects.gantt extension. - * - * https://github.com/Neoteroi/mkdocs-plugins -**/ -:root { - --nt-scrollbar-color: #2751b0; - --nt-plan-actions-height: 24px; - --nt-units-background: #ff9800; - --nt-months-background: #2751b0; - --nt-plan-vertical-line-color: #a3a3a3ad; -} - -.nt-pastello { - --nt-scrollbar-color: #9fb8f4; - --nt-units-background: #f5dc82; - --nt-months-background: #5b7fd1; -} - -[data-md-color-scheme=slate] { - --nt-units-background: #003773; -} -[data-md-color-scheme=slate] .nt-pastello { - --nt-units-background: #3f4997; -} - -.nt-plan-root { - min-height: 200px; - scrollbar-width: 20px; - scrollbar-color: var(--nt-scrollbar-color); - display: flex; -} -.nt-plan-root ::-webkit-scrollbar { - width: 20px; -} -.nt-plan-root ::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px grey; - border-radius: 10px; -} -.nt-plan-root ::-webkit-scrollbar-thumb { - background: var(--nt-scrollbar-color); - border-radius: 10px; -} -.nt-plan-root .nt-plan { - flex: 80%; -} -.nt-plan-root.no-groups .nt-plan-periods { - padding-left: 0; -} -.nt-plan-root.no-groups .nt-plan-group-summary { - display: none; -} -.nt-plan-root .nt-timeline-dot.bigger { - top: -10px; -} -.nt-plan-root .nt-timeline-dot.bigger[title] { - cursor: help; -} - -.nt-plan { - white-space: nowrap; - overflow-x: auto; - display: flex; -} -.nt-plan .ug-timeline-dot { - left: 368px; - top: -8px; - cursor: help; -} - -.months { - display: flex; -} - -.month { - flex: auto; - display: inline-block; - box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 1px -2px, rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px inset; - background-color: var(--nt-months-background); - color: white; - text-transform: uppercase; - font-family: Roboto, Helvetica, Arial, sans-serif; - padding: 2px 5px; - font-size: 12px; - border: 1px solid #000; - width: 150px; - border-radius: 8px; -} - -.nt-plan-group-activities { - flex: auto; - position: relative; -} - -.nt-vline { - border-left: 1px dashed var(--nt-plan-vertical-line-color); - height: 100%; - left: 0; - position: absolute; - margin-left: -0.5px; - top: 0; - -webkit-transition: all 0.5s linear !important; - -moz-transition: all 0.5s linear !important; - -ms-transition: all 0.5s linear !important; - -o-transition: all 0.5s linear !important; - transition: all 0.5s linear !important; - z-index: -2; -} - -.nt-plan-activity { - display: flex; - margin: 2px 0; - background-color: rgba(187, 187, 187, 0.2509803922); -} - -.actions { - height: var(--nt-plan-actions-height); -} - -.actions { - position: relative; -} - -.period { - display: inline-block; - height: var(--nt-plan-actions-height); - width: 120px; - position: absolute; - left: 0px; - background: #1da1f2; - border-radius: 5px; - transition: all 0.5s; - cursor: help; - -webkit-transition: width 1s ease-in-out; - -moz-transition: width 1s ease-in-out; - -o-transition: width 1s ease-in-out; - transition: width 1s ease-in-out; -} -.period .nt-tooltip { - display: none; - top: 30px; - position: relative; - padding: 1rem; - text-align: center; - font-size: 12px; -} -.period:hover .nt-tooltip { - display: inline-block; -} - -.period-0 { - left: 340px; - visibility: visible; - background-color: rgb(69, 97, 101); -} - -.period-1 { - left: 40px; - visibility: visible; - background-color: green; -} - -.period-2 { - left: 120px; - visibility: visible; - background-color: pink; - width: 80px; -} - -.period-3 { - left: 190px; - visibility: visible; - background-color: darkred; - width: 150px; -} - -.weeks > span, -.days > span { - height: 25px; -} - -.weeks > span { - display: inline-block; - margin: 0; - padding: 0; - font-weight: bold; -} -.weeks > span .week-text { - font-size: 10px; - position: absolute; - display: inline-block; - padding: 3px 4px; -} - -.days { - z-index: -2; - position: relative; -} - -.day-text { - font-size: 10px; - position: absolute; - display: inline-block; - padding: 3px 4px; -} - -.period span { - font-size: 12px; - vertical-align: top; - margin-left: 4px; - color: black; - background: rgba(255, 255, 255, 0.6588235294); - border-radius: 6px; - padding: 0 4px; -} - -.weeks, -.days { - height: 20px; - display: flex; - box-sizing: content-box; -} - -.months { - display: flex; -} - -.week, -.day { - height: 20px; - position: relative; - border: 1; - flex: auto; - border: 2px solid white; - border-radius: 4px; - background-color: var(--nt-units-background); - cursor: help; -} - -.years { - display: flex; -} - -.year { - text-align: center; - border-right: 1px solid var(--nt-plan-vertical-line-color); - font-weight: bold; -} -.year:first-child { - border-left: 1px solid var(--nt-plan-vertical-line-color); -} -.year:first-child:last-child { - width: 100%; -} - -.quarters { - display: flex; -} - -.quarter { - width: 12.5%; - text-align: center; - border-right: 1px solid var(--nt-plan-vertical-line-color); - font-weight: bold; -} -.quarter:first-child { - border-left: 1px solid var(--nt-plan-vertical-line-color); -} - -.nt-plan-group { - margin: 20px 0; - position: relative; -} - -.nt-plan-group { - display: flex; -} - -.nt-plan-group-summary { - background: #2751b0; - width: 150px; - white-space: normal; - padding: 0.1rem 0.5rem; - border-radius: 5px; - color: #fff; - z-index: 3; -} -.nt-plan-group-summary p { - margin: 0; - padding: 0; - font-size: 0.6rem; - color: #fff; -} - -.nt-plan-group-summary, -.month, -.period, -.week, -.day, -.nt-tooltip { - border: 3px solid white; - box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.2), 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.nt-plan-periods { - padding-left: 150px; -} - -.months { - z-index: 2; - position: relative; -} - -.weeks { - position: relative; - top: -2px; - z-index: 0; -} - -.month, -.quarter, -.year, -.week, -.day, -.nt-tooltip { - font-family: Roboto, Helvetica, Arial, sans-serif; - box-sizing: border-box; -} - -.nt-cards.nt-grid { - display: grid; - grid-auto-columns: 1fr; - gap: 0.5rem; - max-width: 100vw; - overflow-x: auto; - padding: 1px; -} -.nt-cards.nt-grid.cols-1 { - grid-template-columns: repeat(1, 1fr); -} -.nt-cards.nt-grid.cols-2 { - grid-template-columns: repeat(2, 1fr); -} -.nt-cards.nt-grid.cols-3 { - grid-template-columns: repeat(3, 1fr); -} -.nt-cards.nt-grid.cols-4 { - grid-template-columns: repeat(4, 1fr); -} -.nt-cards.nt-grid.cols-5 { - grid-template-columns: repeat(5, 1fr); -} -.nt-cards.nt-grid.cols-6 { - grid-template-columns: repeat(6, 1fr); -} - -@media only screen and (max-width: 400px) { - .nt-cards.nt-grid { - grid-template-columns: repeat(1, 1fr) !important; - } -} -.nt-card { - box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} -.nt-card:hover { - box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.24), 0 3px 1px -2px rgba(0, 0, 0, 0.3), 0 1px 5px 0 rgba(0, 0, 0, 0.22); -} - -[data-md-color-scheme=slate] .nt-card { - box-shadow: 0 2px 2px 0 rgba(4, 40, 33, 0.14), 0 3px 1px -2px rgba(40, 86, 94, 0.47), 0 1px 5px 0 rgba(139, 252, 255, 0.64); -} -[data-md-color-scheme=slate] .nt-card:hover { - box-shadow: 0 2px 2px 0 rgba(0, 255, 206, 0.14), 0 3px 1px -2px rgba(33, 156, 177, 0.47), 0 1px 5px 0 rgba(96, 251, 255, 0.64); -} - -.nt-card > a { - color: var(--md-default-fg-color); -} - -.nt-card > a > div { - cursor: pointer; -} - -.nt-card { - padding: 5px; - margin-bottom: 0.5rem; -} - -.nt-card-title { - font-size: 1rem; - font-weight: bold; - margin: 4px 0 8px 0; - line-height: 22px; -} - -.nt-card-content { - padding: 0.4rem 0.8rem 0.8rem 0.8rem; -} - -.nt-card-text { - font-size: 14px; - padding: 0; - margin: 0; -} - -.nt-card .nt-card-image { - text-align: center; - border-radius: 2px; - background-position: center center; - background-size: cover; - background-repeat: no-repeat; - min-height: 120px; -} - -.nt-card .nt-card-image.tags img { - margin-top: 12px; -} - -.nt-card .nt-card-image img { - height: 105px; - margin-top: 5px; -} - -.nt-card a:hover, -.nt-card a:focus { - color: var(--md-accent-fg-color); -} - -.nt-card h2 { - margin: 0; -} - -/** - * Extra CSS file recommended for MkDocs and neoteroi.spantable extension. - * - * https://github.com/Neoteroi/mkdocs-plugins -**/ -.span-table-wrapper table { - border-collapse: collapse; - margin-bottom: 2rem; - border-radius: 0.1rem; -} - -.span-table td, -.span-table th { - padding: 0.2rem; - background-color: var(--md-default-bg-color); - font-size: 0.64rem; - max-width: 100%; - overflow: auto; - touch-action: auto; - border-top: 0.05rem solid var(--md-typeset-table-color); - padding: 0.9375em 1.25em; - vertical-align: top; -} - -.span-table tr:first-child td { - font-weight: 700; - min-width: 5rem; - padding: 0.9375em 1.25em; - vertical-align: top; -} - -.span-table td:first-child { - border-left: 0.05rem solid var(--md-typeset-table-color); -} - -.span-table td:last-child { - border-right: 0.05rem solid var(--md-typeset-table-color); -} - -.span-table tr:last-child { - border-bottom: 0.05rem solid var(--md-typeset-table-color); -} - -.span-table [colspan], -.span-table [rowspan] { - font-weight: bold; - border: 0.05rem solid var(--md-typeset-table-color); -} - -.span-table tr:not(:first-child):hover td:not([colspan]):not([rowspan]), -.span-table td[colspan]:hover, -.span-table td[rowspan]:hover { - background-color: rgba(0, 0, 0, 0.035); - box-shadow: 0 0.05rem 0 var(--md-default-bg-color) inset; - transition: background-color 125ms; -} diff --git a/docs/extract_schema.py b/docs/extract_schema.py index f7608a062e..a54fd58719 100644 --- a/docs/extract_schema.py +++ b/docs/extract_schema.py @@ -2,10 +2,10 @@ import argparse import os -import re import textwrap import yaml +from render_schema import SchemaRenderer OUTPUT_DIR = './docs/api/schema/' @@ -54,21 +54,11 @@ def top_level_path(path: str) -> str: return GENERAL_PATH -def generate_schema_file(key: str) -> None: - """Generate a schema file for the provided key.""" +def generate_schema_file(key: str, renderer: SchemaRenderer, paths: dict) -> None: + """Render the API documentation page for the provided key.""" description = SPECIAL_PATHS.get(key, 'General API Endpoints') - output = f""" - --- - title: {description} - --- - - The *{description}* section of the InvenTree API schema is documented below. - - [OAD(./docs/docs/api/schema/{key}.yml)] - """ - - output = textwrap.dedent(output).strip() + '\n' + output = renderer.render_page(description, paths) output_file = os.path.join(os.path.dirname(__file__), OUTPUT_DIR, f'{key}.md') output_file = os.path.abspath(output_file) @@ -125,99 +115,26 @@ def generate_index_file(version: str): f.write(output) -def extract_refs(data: dict, components: dict) -> dict: - """Extract a dict of refs from the provided paths dict. - - The refs are located like so: - ::responses::content:application/json:schema:$ref - - Also, the referenced components might reference *sub* components, - so we need to do this step recursively. - - """ - pattern = r"'?\$ref'?: '#\/components\/schemas\/(\S+)'" - - # First, extract the results from the paths data dict - matches = re.findall(pattern, str(data)) - - refs = list(matches) - - # Next, extract additional refs from the components dict - # Note that the components dict may reference other components - - idx = 0 - - while idx < len(refs): - ref = refs[idx] - - schema = components.get('schemas', {}).get(ref, None) - - if schema: - # Search for additional refs - matches = re.findall(pattern, str(schema)) - - for match in matches: - if match not in refs: - refs.append(match) - - idx += 1 - - # Return a dict only of the extracted refs - schemas = {ref: components['schemas'][ref] for ref in refs} - - return schemas - - def parse_api_file(filename: str): - """Parse the input API file, and split into smaller sections. + """Parse the input API file, and render it as a set of smaller documentation pages. The intent is to make the API schema easier to peruse on the documentation. """ with open(filename, encoding='utf-8') as f: data = yaml.safe_load(f) - paths = data['paths'] - top_level_paths = {} - for path, methods in paths.items(): + for path, methods in data['paths'].items(): tlp = top_level_path(path) + top_level_paths.setdefault(tlp, {})[path] = methods - if tlp not in top_level_paths: - top_level_paths[tlp] = {} - - top_level_paths[tlp][path] = methods + # The renderer uses the complete schema, so all references can be resolved + renderer = SchemaRenderer(data) # Generate output files for key, value in top_level_paths.items(): - output_file = os.path.join(os.path.dirname(__file__), OUTPUT_DIR, f'{key}.yml') - - output = {} - - output['paths'] = value - - components = data.get('components', {}) - - # Extract only the schemas relating to the provided paths - path_schemas = extract_refs(value, components) - - for k, v in data.items(): - if k == 'components': - v = v.copy() - v['schemas'] = path_schemas - - if k != 'paths': - output[k] = v - - print(f'Writing schema file to {output_file}...') - - output_file = os.path.abspath(output_file) - - with open(output_file, 'w', encoding='utf-8') as f: - yaml.dump(output, f) - - # Generate a markdown file for the schema - generate_schema_file(key) + generate_schema_file(key, renderer, value) # Finally, generate an index file for the API schema generate_index_file(data['info']['version']) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index d89068ca31..ba869bf1f1 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -57,7 +57,6 @@ extra_css: - stylesheets/bootstrap.css - stylesheets/splide.min.css - stylesheets/extra.css - - stylesheets/neoteroi-mkdocs.css - https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3.31.0/dist/tabler-icons.min.css extra_javascript: - javascripts/extra.js @@ -303,8 +302,6 @@ nav: # Plugins plugins: - - neoteroi.mkdocsoad: - use_pymdownx: true - include-markdown: opening_tag: "{!" closing_tag: "!}" diff --git a/docs/mkdocs.zensical.yml b/docs/mkdocs.zensical.yml index 6795158c23..67c381ab89 100644 --- a/docs/mkdocs.zensical.yml +++ b/docs/mkdocs.zensical.yml @@ -2,7 +2,7 @@ # zensical build -f docs/mkdocs.zensical.yml # Differences: theme.variant classic, include_dir relative to this file, native mermaid, # macros on_error_fail, separate site_dir. mermaid2 / simple-hooks / git-revision-date / -# neoteroi plugins are not supported by Zensical (silently ignored). +# plugins are not supported by Zensical (silently ignored). # Project site_url: https://inventree.readthedocs.io @@ -64,7 +64,6 @@ extra_css: - stylesheets/bootstrap.css - stylesheets/splide.min.css - stylesheets/extra.css - - stylesheets/neoteroi-mkdocs.css - https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3.31.0/dist/tabler-icons.min.css extra_javascript: - javascripts/extra.js @@ -310,8 +309,6 @@ nav: # Plugins plugins: - - neoteroi.mkdocsoad: - use_pymdownx: true - include-markdown: opening_tag: "{!" closing_tag: "!}" diff --git a/docs/render_schema.py b/docs/render_schema.py new file mode 100644 index 0000000000..984b5ceafc --- /dev/null +++ b/docs/render_schema.py @@ -0,0 +1,667 @@ +"""Render sections of the InvenTree OpenAPI schema as static Markdown pages. + +This replaces the 'neoteroi.mkdocsoad' plugin, so that the API documentation +is plain Markdown which can be rendered by any static site generator +(mkdocs, zensical, etc), without requiring a build-time plugin. + +The rendered pages are generated as a pre-build step (see 'extract_schema.py'). +""" + +import json +import re +from typing import Any, Optional + +HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'] + +# Placeholder values for generated examples, keyed by OpenAPI 'format' +FORMAT_EXAMPLES = { + 'date': '2024-01-01', + 'date-time': '2024-01-01T12:00:00Z', + 'time': '12:00:00', + 'email': 'user@example.com', + 'uri': 'https://example.com', + 'uuid': '3fa85f64-5717-4562-b3fc-2c963f66afa6', + 'decimal': '0.00', + 'binary': '', + 'ipv4': '127.0.0.1', +} + +# Maximum depth when generating JSON examples (guards against deep nesting) +EXAMPLE_MAX_DEPTH = 5 + + +def schema_anchor(name: str) -> str: + """Return the HTML anchor for a named component schema.""" + return 'schema-' + re.sub(r'[^a-z0-9]+', '-', name.lower()).strip('-') + + +def operation_anchor(method: str, path: str) -> str: + """Return the HTML anchor for a single API operation.""" + return method.lower() + '-' + re.sub(r'[^a-z0-9]+', '-', path.lower()).strip('-') + + +def escape_text(text: Any) -> str: + """Escape free text so it cannot inject HTML into the rendered page. + + Markdown formatting (e.g. `code` or *emphasis*) is preserved. + """ + text = '' if text is None else str(text) + return text.replace('&', '&').replace('<', '<').replace('>', '>') + + +def escape_cell(text: Any) -> str: + """Escape text for use within a single Markdown table cell.""" + text = escape_text(text).strip() + text = text.replace('|', '\\|') + + lines = [] + + for line in text.splitlines(): + line = line.strip() + # Bulleted lists cannot be rendered within a table cell + if line.startswith(('* ', '- ')): + line = '• ' + line[2:] + lines.append(line) + + return '
'.join(line for line in lines if line) + + +def inline_code(text: Any) -> str: + """Wrap a value as inline code, coping with embedded backticks.""" + text = str(text) + fence = '``' if '`' in text else '`' + pad = ' ' if '`' in text else '' + return f'{fence}{pad}{text}{pad}{fence}' + + +class SchemaRenderer: + """Render API operations and their component schemas to Markdown.""" + + def __init__(self, spec: dict): + """Initialize the renderer with the *complete* OpenAPI spec. + + The full spec is required so that '$ref' entries can always be resolved, + regardless of which subset of paths is being rendered. + """ + self.spec = spec + self.components = spec.get('components', {}) + self.schemas = self.components.get('schemas', {}) + + # ------------------------------------------------------------------ # + # Reference handling + # ------------------------------------------------------------------ # + + @staticmethod + def ref_name(ref: str) -> str: + """Return the final component name from a '$ref' string.""" + return ref.split('/')[-1] + + def resolve(self, obj: Any) -> Any: + """Resolve a '$ref' (to any component type) into the referenced object.""" + seen = set() + + while isinstance(obj, dict) and '$ref' in obj: + ref = obj['$ref'] + + if ref in seen or not ref.startswith('#/'): + break + + seen.add(ref) + node = self.spec + + for part in ref[2:].split('/'): + node = node.get(part, {}) if isinstance(node, dict) else {} + + obj = node + + return obj + + def collect_schema_refs(self, obj: Any, found: Optional[set] = None) -> set: + """Find all component schemas referenced (transitively) by an object. + + References to other component types (e.g. responses or parameters) + are followed, so that the schemas they use are also included. + """ + found = set() if found is None else found + stack = [obj] + visited = set() + + while stack: + node = stack.pop() + + if isinstance(node, list): + stack.extend(node) + continue + + if not isinstance(node, dict): + continue + + ref = node.get('$ref') + + if isinstance(ref, str) and ref not in visited: + visited.add(ref) + + if ref.startswith('#/components/schemas/'): + found.add(self.ref_name(ref)) + + stack.append(self.resolve(node)) + + stack.extend(v for k, v in node.items() if k != '$ref') + + return found + + # ------------------------------------------------------------------ # + # Type descriptions + # ------------------------------------------------------------------ # + + def type_str(self, schema: Any) -> str: + """Return a short (Markdown) description of a schema's type.""" + if not isinstance(schema, dict): + return '' + + if '$ref' in schema: + ref = schema['$ref'] + + if ref.startswith('#/components/schemas/'): + name = self.ref_name(ref) + return f'[{name}](#{schema_anchor(name)})' + + return self.type_str(self.resolve(schema)) + + for key, joiner in (('allOf', ' & '), ('oneOf', ' or '), ('anyOf', ' or ')): + if key in schema: + options = [self.type_str(s) for s in schema[key]] + return joiner.join(o for o in options if o) or 'any' + + schema_type = schema.get('type') + + if schema_type == 'array': + return f'array[{self.type_str(schema.get("items", {})) or "any"}]' + + if schema_type == 'object' or (not schema_type and 'properties' in schema): + extra = schema.get('additionalProperties') + + if isinstance(extra, dict) and extra: + return f'object[string, {self.type_str(extra) or "any"}]' + + return 'object' + + if not schema_type: + return 'any' + + if fmt := schema.get('format'): + return f'{schema_type}({fmt})' + + return schema_type + + def merged(self, schema: dict) -> dict: + """Flatten 'allOf' wrappers so that flags such as 'readOnly' are visible.""" + if not isinstance(schema, dict): + return {} + + result = {k: v for k, v in schema.items() if k != 'allOf'} + + for sub in schema.get('allOf', []): + sub = self.resolve(sub) + if isinstance(sub, dict): + for k, v in sub.items(): + result.setdefault(k, v) + + return result + + def constraints(self, schema: dict, description: str = '') -> list[str]: + """Return a list of human readable constraints for a schema. + + Arguments: + schema: The schema to describe + description: Accompanying description text. Enum values are not + repeated if the description already lists them all. + """ + notes = [] + + enum_listed = all( + f'`{v}`' in (description or '') for v in schema.get('enum', []) if v + ) + + if 'enum' in schema and not enum_listed: + values = ', '.join(inline_code(json.dumps(v)) for v in schema['enum']) + notes.append(f'One of: {values}') + + for key, label in ( + ('minLength', 'Min length'), + ('maxLength', 'Max length'), + ('minimum', 'Minimum'), + ('maximum', 'Maximum'), + ('minItems', 'Min items'), + ('maxItems', 'Max items'), + ): + if key in schema: + notes.append(f'{label}: {inline_code(schema[key])}') + + if 'pattern' in schema: + notes.append(f'Pattern: {inline_code(schema["pattern"])}') + + if 'default' in schema: + notes.append(f'Default: {inline_code(json.dumps(schema["default"]))}') + + return notes + + # ------------------------------------------------------------------ # + # Example generation + # ------------------------------------------------------------------ # + + def example( + self, schema: Any, mode: str = 'response', depth: int = 0, stack=() + ) -> Any: + """Generate an example value for a schema. + + Arguments: + schema: The schema to generate an example for + mode: 'request' (omit read-only fields) or 'response' (omit write-only fields) + depth: Current nesting depth + stack: Component names currently being expanded (cycle protection) + """ + if not isinstance(schema, dict) or depth > EXAMPLE_MAX_DEPTH: + return None + + if '$ref' in schema: + name = self.ref_name(schema['$ref']) + + if name in stack: + return {} + + return self.example(self.resolve(schema), mode, depth, (*stack, name)) + + if 'example' in schema: + return schema['example'] + + if 'allOf' in schema: + result = {} + for sub in schema['allOf']: + value = self.example(sub, mode, depth, stack) + if isinstance(value, dict): + result.update(value) + elif value is not None: + return value + return result + + for key in ('oneOf', 'anyOf'): + if key in schema: + # Prefer the first option which is not a 'null' or 'blank' variant + for sub in schema[key]: + value = self.example(sub, mode, depth, stack) + if value not in (None, ''): + return value + return None + + if 'default' in schema: + return schema['default'] + + if 'enum' in schema: + options = [v for v in schema['enum'] if v not in (None, '')] + return options[0] if options else None + + schema_type = schema.get('type') + + if schema_type == 'object' or 'properties' in schema: + result = {} + + for name, prop in schema.get('properties', {}).items(): + flags = self.merged(prop) + if mode == 'request' and flags.get('readOnly'): + continue + if mode == 'response' and flags.get('writeOnly'): + continue + result[name] = self.example(prop, mode, depth + 1, stack) + + return result + + if schema_type == 'array': + item = self.example(schema.get('items', {}), mode, depth + 1, stack) + return [] if item is None else [item] + + if schema_type == 'string': + return FORMAT_EXAMPLES.get(schema.get('format'), 'string') + + if schema_type == 'integer': + return 0 + + if schema_type == 'number': + return 0.0 + + if schema_type == 'boolean': + return False + + return None + + def example_block(self, schema: dict, mode: str, title: str) -> list[str]: + """Render a collapsible JSON example for the given schema.""" + value = self.example(schema, mode) + + if value is None: + return [] + + body = json.dumps(value, indent=2) + + lines = [f'??? example "{title}"', ' ```json'] + lines += [' ' + line for line in body.splitlines()] + lines += [' ```', ''] + + return lines + + # ------------------------------------------------------------------ # + # Operations + # ------------------------------------------------------------------ # + + @staticmethod + def security_names(security: Optional[list]) -> tuple: + """Return a sorted tuple of security scheme names for an operation.""" + if not security: + return () + + names = set() + + for requirement in security: + names.update(requirement.keys()) + + return tuple(sorted(names)) + + def render_security(self, names: tuple) -> str: + """Render a list of security schemes as Markdown.""" + if not names: + return 'No authentication required' + + return ', '.join(inline_code(n) for n in names) + + def render_parameters(self, parameters: list) -> list[str]: + """Render the parameters of an operation as a table.""" + if not parameters: + return [] + + lines = [ + '**Parameters**', + '', + '| Name | In | Type | Required | Description |', + '| --- | --- | --- | --- | --- |', + ] + + for param in parameters: + param = self.resolve(param) + schema = param.get('schema', {}) + notes = [escape_cell(param.get('description', ''))] + notes += self.constraints( + self.merged(self.resolve(schema)), param.get('description', '') + ) + description = '
'.join(n for n in notes if n) + + lines.append( + f'| {inline_code(param.get("name", ""))} ' + f'| {param.get("in", "")} ' + f'| {self.type_str(schema)} ' + f'| {"Yes" if param.get("required") else "No"} ' + f'| {description} |' + ) + + return [*lines, ''] + + def render_request_body(self, body: dict) -> list[str]: + """Render the request body of an operation.""" + body = self.resolve(body) + content = body.get('content', {}) + + if not content: + return [] + + content_types = ', '.join(inline_code(c) for c in content) + required = ' (required)' if body.get('required') else '' + + # Prefer the JSON representation for documentation purposes + media = content.get('application/json') or next(iter(content.values())) + schema = media.get('schema', {}) + + lines = [ + f'**Request body**{required}: {self.type_str(schema)}', + '', + f'Content types: {content_types}', + '', + ] + + lines += self.example_block(schema, 'request', 'Example request body') + + return lines + + def render_responses(self, responses: dict) -> list[str]: + """Render the responses of an operation.""" + if not responses: + return [] + + lines = [ + '**Responses**', + '', + '| Status | Description | Schema |', + '| --- | --- | --- |', + ] + + examples = [] + + for status, response in responses.items(): + response = self.resolve(response) + content = response.get('content', {}) + media = content.get('application/json') or ( + next(iter(content.values())) if content else {} + ) + schema = media.get('schema', {}) if media else {} + + lines.append( + f'| {inline_code(status)} ' + f'| {escape_cell(response.get("description", ""))} ' + f'| {self.type_str(schema) if schema else ""} |' + ) + + # Provide an example for successful JSON responses only + if schema and str(status).startswith('2') and not examples: + examples = self.example_block( + schema, 'response', f'Example response ({status})' + ) + + return [*lines, '', *examples] + + def render_operation( + self, path: str, method: str, operation: dict, default_security: tuple + ) -> list[str]: + """Render a single API operation (path + method).""" + anchor = operation_anchor(method, path) + label = method.upper() + + lines = [ + f'### {label} ' + f'{inline_code(path)} {{#{anchor}}}', + '', + ] + + if operation.get('deprecated'): + lines += [ + '!!! warning "Deprecated"', + ' This endpoint is deprecated.', + '', + ] + + if summary := operation.get('summary'): + lines += [f'**{escape_text(summary).strip()}**', ''] + + if description := operation.get('description'): + lines += [escape_text(description).strip(), ''] + + security = self.security_names(operation.get('security')) + + if security != default_security: + lines += [f'**Authentication**: {self.render_security(security)}', ''] + + lines += self.render_parameters(operation.get('parameters', [])) + lines += self.render_request_body(operation.get('requestBody', {})) + lines += self.render_responses(operation.get('responses', {})) + + return lines + + # ------------------------------------------------------------------ # + # Component schemas + # ------------------------------------------------------------------ # + + def render_schema(self, name: str) -> list[str]: + """Render a single named component schema.""" + schema = self.schemas.get(name, {}) + + lines = [f'### {name} {{#{schema_anchor(name)}}}', ''] + + if description := schema.get('description'): + lines += [escape_text(description).strip(), ''] + + properties = schema.get('properties', {}) + + if properties: + required = set(schema.get('required', [])) + + lines += [ + '| Field | Type | Required | Description |', + '| --- | --- | --- | --- |', + ] + + for field, prop in properties.items(): + flags = self.merged(prop) + resolved = self.merged(self.resolve(prop)) + + notes = [] + badges = [] + + if flags.get('readOnly'): + badges.append('read-only') + if flags.get('writeOnly'): + badges.append('write-only') + if flags.get('nullable'): + badges.append('nullable') + + if badges: + notes.append(' '.join(f'*{b}*' for b in badges)) + + if title := flags.get('title'): + if title.lower() != field.replace('_', ' ').lower(): + notes.append(f'**{escape_cell(title)}**') + + field_description = flags.get('description') or resolved.get( + 'description' + ) + notes.append(escape_cell(field_description)) + + # Constraints of referenced schemas are documented on that schema + notes += self.constraints(flags, field_description) + + lines.append( + f'| {inline_code(field)} ' + f'| {self.type_str(prop)} ' + f'| {"Yes" if field in required else "No"} ' + f'| {"
".join(n for n in notes if n)} |' + ) + + lines.append('') + + elif 'enum' in schema: + base_type = self.type_str({k: v for k, v in schema.items() if k != 'enum'}) + lines += [f'Type: {base_type}', ''] + + # Only list the values if the description does not already do so + if self.constraints({'enum': schema['enum']}, description or ''): + lines += ['| Value |', '| --- |'] + lines += [f'| {inline_code(json.dumps(v))} |' for v in schema['enum']] + lines.append('') + + else: + lines += [f'Type: {self.type_str(schema)}', ''] + + if notes := self.constraints(schema): + lines += ['
'.join(notes), ''] + + return lines + + # ------------------------------------------------------------------ # + # Page rendering + # ------------------------------------------------------------------ # + + def default_security(self, paths: dict) -> tuple: + """Return the most common set of security schemes across the given paths.""" + counts = {} + + for methods in paths.values(): + for method, operation in methods.items(): + if method in HTTP_METHODS: + key = self.security_names(operation.get('security')) + counts[key] = counts.get(key, 0) + 1 + + if not counts: + return () + + return max(counts, key=counts.get) + + def render_page(self, title: str, paths: dict) -> str: + """Render a full documentation page for a subset of API paths. + + Arguments: + title: The title of this section of the API + paths: Dict of {path: {method: operation}} items to render + """ + info = self.spec.get('info', {}) + default_security = self.default_security(paths) + + lines = [ + '---', + f'title: {json.dumps(title)}', + # Schema text must never be interpreted as Jinja2 template code + 'render_macros: false', + '---', + '', + f'The *{escape_text(title)}* section of the InvenTree API schema is documented below.', + '', + f'!!! info "API Version {escape_text(info.get("version", ""))}"', + ' This page was generated automatically from the InvenTree API schema.', + '', + ] + + if default_security: + lines += [ + '## Authentication', + '', + 'Unless otherwise noted, endpoints on this page accept the following authentication methods: ' + + self.render_security(default_security) + + '. Refer to the [API documentation](../index.md#authentication) for more information.', + '', + ] + + lines += ['## Endpoints', ''] + + referenced = set() + + for path in sorted(paths): + methods = paths[path] + + # Parameters may also be declared at the path level (shared by all methods) + path_params = methods.get('parameters', []) + + for method in HTTP_METHODS: + if operation := methods.get(method): + if path_params: + operation = { + **operation, + 'parameters': path_params + operation.get('parameters', []), + } + + lines += self.render_operation( + path, method, operation, default_security + ) + self.collect_schema_refs(operation, referenced) + + if referenced: + lines += ['## Schemas', ''] + + for name in sorted(referenced, key=str.lower): + lines += self.render_schema(name) + + return '\n'.join(lines).rstrip() + '\n' diff --git a/docs/requirements.in b/docs/requirements.in index 5ce607779e..98f622aea4 100644 --- a/docs/requirements.in +++ b/docs/requirements.in @@ -6,6 +6,5 @@ mkdocs-git-revision-date-localized-plugin>=1.6.0,<2.0 mkdocs-redirects mkdocs-simple-hooks mkdocs-include-markdown-plugin -neoteroi-mkdocs mkdocstrings[python] mkdocs-mermaid2-plugin diff --git a/docs/requirements.txt b/docs/requirements.txt index 6f7e22cbb7..fe8c0efef6 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,9 +1,5 @@ # This file was autogenerated by uv via the following command: # uv pip compile docs/requirements.in -o docs/requirements.txt -c src/backend/requirements.txt -anyio==4.15.1 \ - --hash=sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101 \ - --hash=sha256:9f28306018cbd6d329e64a36d58256edff76dd996fe423bc957326e578b82a94 - # via httpx babel==2.18.0 \ --hash=sha256:b80b99a14bd085fcacfa15c9165f651fbb3406e66cc603abf11c5750937c992d \ --hash=sha256:e2b422b277c2b9a9630c1d7903c2a00d0830c409c59ac8cae9081c92f1aeba35 @@ -33,8 +29,6 @@ certifi==2026.10.23 \ --hash=sha256:e9b54de76e530bb6cf0ccd036787103acb58fd42ba930ea8bf948ddbaa2f61d1 # via # -c src/backend/requirements.txt - # httpcore - # httpx # requests charset-normalizer==3.5.2 \ --hash=sha256:01077390b03f7988f11d700a2194e69b119741a86b1a638b1db88891e3eced8e \ @@ -217,7 +211,6 @@ click==8.5.0 \ --hash=sha256:ba0d2089de75ea0310e2dde03160e6ca10009947fb95a182f9b54021bb272e34 # via # mkdocs - # neoteroi-mkdocs # properdocs colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ @@ -227,14 +220,6 @@ editorconfig==0.17.1 \ --hash=sha256:1eda9c2c0db8c16dbd50111b710572a5e6de934e39772de1959d41f64fc17c82 \ --hash=sha256:23c08b00e8e08cc3adcddb825251c497478df1dada6aefeb01e626ad37303745 # via jsbeautifier -essentials==1.1.9 \ - --hash=sha256:71ef161e0e27ef77cd6f5fc05e0b8688a575fcab870c01c95940f832e321dfbb \ - --hash=sha256:7fbea3a518cbeafe5374fb7e2ea2c15a109e8a7fd1eaab62ae87cbd1b3b1e8d0 - # via essentials-openapi -essentials-openapi==1.4.0 \ - --hash=sha256:578c81501ccf6d18c0839d60636214fbd051f0ef37f1d207d4e3c92de2aac008 \ - --hash=sha256:86d879c32734248ad52482a90ee89a32883bce348b4edd323c01556b505b45b9 - # via neoteroi-mkdocs ghp-import==2.1.0 \ --hash=sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619 \ --hash=sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343 @@ -253,31 +238,17 @@ griffelib==2.4.1 \ --hash=sha256:40c028dd2e623f464423f0e11e3c553158f1cf4f1368239a370534d73e1407ff \ --hash=sha256:76bc562f936ad1ce198d2cf6d0731bd5c92a7d934b69ef828ef22ee0ffdb62ce # via mkdocstrings-python -h11==0.16.0 \ - --hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \ - --hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86 - # via httpcore hjson==3.1.0 \ --hash=sha256:55af475a27cf83a7969c808399d7bccdec8fb836a07ddbd574587593b9cdcf75 \ --hash=sha256:65713cdcf13214fb554eb8b4ef803419733f4f5e551047c9b711098ab7186b89 # via # mkdocs-macros-plugin # super-collections -httpcore==1.0.9 \ - --hash=sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55 \ - --hash=sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8 - # via httpx -httpx==0.28.1 \ - --hash=sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc \ - --hash=sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad - # via neoteroi-mkdocs idna==3.20 \ --hash=sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44 \ --hash=sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c # via # -c src/backend/requirements.txt - # anyio - # httpx # requests jinja2==3.1.6 \ --hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \ @@ -288,7 +259,6 @@ jinja2==3.1.6 \ # mkdocs-macros-plugin # mkdocs-material # mkdocstrings - # neoteroi-mkdocs # properdocs jsbeautifier==2.0.3 \ --hash=sha256:9579d4e9dbaa00383f3efdff4c98c8140bb85ba319398e8b97cdaba27abd6ba3 \ @@ -305,10 +275,6 @@ markdown==3.11.2 \ # mkdocstrings # properdocs # pymdown-extensions -markdown-it-py==4.2.0 \ - --hash=sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49 \ - --hash=sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a - # via rich markupsafe==3.0.4 \ --hash=sha256:007e1ffd9bf65bb6ee96df7b258fc632a4868dd5566037986c64781f35a36e98 \ --hash=sha256:02fa4acbc6a3fc5c693c34d4dd8c1130b7fe99cc915181b0ddd6f72aeb296002 \ @@ -463,16 +429,11 @@ markupsafe==3.0.4 \ --hash=sha256:fdb4ca07ab75ffadab4a8b135ad59cdbb3156b99310f3d565370da74a15d6bd3 # via # -c src/backend/requirements.txt - # essentials-openapi # jinja2 # mkdocs # mkdocs-autorefs # mkdocstrings # properdocs -mdurl==0.1.2 \ - --hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \ - --hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba - # via markdown-it-py mergedeep==1.3.4 \ --hash=sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8 \ --hash=sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307 @@ -493,7 +454,6 @@ mkdocs==1.6.1 \ # mkdocs-redirects # mkdocs-simple-hooks # mkdocstrings - # neoteroi-mkdocs mkdocs-autorefs==1.4.5 \ --hash=sha256:68ee484e0800f3ba50cda1bc4a94293adbdfcc010243c322b3f5d66e15d06770 \ --hash=sha256:856f75b327b7717923ce06267094650689a510a748c48657f5333965950c2788 @@ -546,10 +506,6 @@ mkdocstrings-python==2.0.10 \ --hash=sha256:4a3aaeebb25ba5ae57a8f9e75432fe4571984889602f2b2f7d672faa760e9062 \ --hash=sha256:5e34ae56b2f20a57807ee479d603ddc5ec7cc6d2252c4c177754627ef2d3b833 # via mkdocstrings -neoteroi-mkdocs==1.2.0 \ - --hash=sha256:58e25cb1b9db093ffa8d12bdb33264bf567cac30fb964b56e0a493efa749ad6e \ - --hash=sha256:91b6aa95a4e46c9bb93e00e021d2044cb0c7d80c0b4600434ff8f440d613a0a8 - # via -r docs/requirements.in packaging==26.3 \ --hash=sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79 \ --hash=sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c @@ -586,9 +542,7 @@ properdocs==1.6.7 \ pygments==2.21.0 \ --hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9 \ --hash=sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c - # via - # mkdocs-material - # rich + # via mkdocs-material pymdown-extensions==12.3 \ --hash=sha256:345493a8e3497e24382902903a1c43a28e34a52f2b7571a1c9641429b820ca74 \ --hash=sha256:a7f2a4e0bc60c6e6babfa7922cfb3b01cd640eb00fb208f3c582e12bae00ea67 @@ -679,7 +633,6 @@ pyyaml==6.0.3 \ --hash=sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0 # via # -c src/backend/requirements.txt - # essentials-openapi # mkdocs # mkdocs-get-deps # mkdocs-macros-plugin @@ -700,10 +653,6 @@ requests==2.34.2 \ # mkdocs-macros-plugin # mkdocs-material # mkdocs-mermaid2-plugin -rich==15.0.0 \ - --hash=sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb \ - --hash=sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36 - # via neoteroi-mkdocs setuptools==84.2.1 \ --hash=sha256:3ff8b3b5492a0aa66960f4419365a86b84e013070d4313e4d4a6894f5d64d6bc \ --hash=sha256:ca140b45d5325a9478f880e351484f62fef15f336462e449ca0c03c873d589c2 @@ -737,7 +686,6 @@ typing-extensions==4.16.0 \ --hash=sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5 # via # -c src/backend/requirements.txt - # anyio # beautifulsoup4 urllib3==2.8.0 \ --hash=sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3 \