[PR #2803] [MERGED] OpenAPI Spec, try 2 #3810

Closed
opened 2026-04-25 00:17:09 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/2803
Author: @nichwall
Created: 4/1/2024
Status: Merged
Merged: 4/20/2024
Merged by: @advplyr

Base: masterHead: vacuum_bundling


📝 Commits (7)

📊 Changes

16 files changed (+1015 additions, -0 deletions)

View changed files

docs/README.md (+30 -0)
docs/controllers/AuthorController.yaml (+139 -0)
docs/objects/Folder.yaml (+21 -0)
docs/objects/Library.yaml (+12 -0)
docs/objects/LibraryItem.yaml (+66 -0)
docs/objects/entities/Author.yaml (+104 -0)
docs/objects/entities/Series.yaml (+11 -0)
docs/objects/files/AudioFile.yaml (+94 -0)
docs/objects/mediaTypes/Book.yaml (+70 -0)
docs/objects/mediaTypes/media.yaml (+10 -0)
docs/objects/metadata/AudioMetaTags.yaml (+103 -0)
docs/objects/metadata/BookMetadata.yaml (+126 -0)
docs/objects/metadata/FileMetadata.yaml (+39 -0)
docs/openapi.json (+0 -0)
docs/root.yaml (+157 -0)
docs/schemas.yaml (+33 -0)

📄 Description

This is another attempt to do the OpenAPI spec better than initially done in https://github.com/advplyr/audiobookshelf/pull/2671. That PR focused on the Collections endpoints, but this PR focuses on a stripped down version of the Author endpoints to make reviewing easier (the missing schemas will be added back in future PRs).

I changed from OpenAPI 3.1 to OpenAPI 3.0 due to better tool support as of March 2024. I still prefer 3.1, but migrating will be easier than writing it all from scratch twice.

I opted to create a new directory named docs/ for the API spec files which matches the source code structure. While swagger-jsdoc did work well, it makes editing the schemas more difficult because VSCode cannot assist with any formatting in the block comments. Separating the documentation and code into their own files but keeping it in the same repository should still help keep the API docs up to date as unit/integration testing is added.

Initial research shows other projects tend to keep their OpenAPI spec in the same repository as the source code.

I am using the vacuum tool for bundling and linting the spec. Running the tool is discussed in docs/README.md.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/2803 **Author:** [@nichwall](https://github.com/nichwall) **Created:** 4/1/2024 **Status:** ✅ Merged **Merged:** 4/20/2024 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `vacuum_bundling` --- ### 📝 Commits (7) - [`afe40be`](https://github.com/advplyr/audiobookshelf/commit/afe40be957eda7d7679f69e78ff0c16f162d2af9) Initial large file - [`c7ac12a`](https://github.com/advplyr/audiobookshelf/commit/c7ac12a67a3b3bf9fbd4b64b333d1f8563bb4434) Split schema to sub files - [`7b85647`](https://github.com/advplyr/audiobookshelf/commit/7b856474afcf33cae2c0c9adccd1fa3fd1026593) Rename base document - [`74dd24f`](https://github.com/advplyr/audiobookshelf/commit/74dd24febf216edd9a9eda2f7778d943d39fbaf5) Bundled spec - [`ca7eaf9`](https://github.com/advplyr/audiobookshelf/commit/ca7eaf97502676f0933925ad9450396f0c18161f) OpenAPI spec readme - [`8e6ead5`](https://github.com/advplyr/audiobookshelf/commit/8e6ead59ceea4653b562fa108242e494e568bf6d) Update yaml keys to camelCase - [`b124d61`](https://github.com/advplyr/audiobookshelf/commit/b124d6182669dd1e6abc226ac42715983ac9ca1f) Update yaml docs to include BearerAuth ### 📊 Changes **16 files changed** (+1015 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `docs/README.md` (+30 -0) ➕ `docs/controllers/AuthorController.yaml` (+139 -0) ➕ `docs/objects/Folder.yaml` (+21 -0) ➕ `docs/objects/Library.yaml` (+12 -0) ➕ `docs/objects/LibraryItem.yaml` (+66 -0) ➕ `docs/objects/entities/Author.yaml` (+104 -0) ➕ `docs/objects/entities/Series.yaml` (+11 -0) ➕ `docs/objects/files/AudioFile.yaml` (+94 -0) ➕ `docs/objects/mediaTypes/Book.yaml` (+70 -0) ➕ `docs/objects/mediaTypes/media.yaml` (+10 -0) ➕ `docs/objects/metadata/AudioMetaTags.yaml` (+103 -0) ➕ `docs/objects/metadata/BookMetadata.yaml` (+126 -0) ➕ `docs/objects/metadata/FileMetadata.yaml` (+39 -0) ➕ `docs/openapi.json` (+0 -0) ➕ `docs/root.yaml` (+157 -0) ➕ `docs/schemas.yaml` (+33 -0) </details> ### 📄 Description This is another attempt to do the OpenAPI spec better than initially done in https://github.com/advplyr/audiobookshelf/pull/2671. That PR focused on the Collections endpoints, but this PR focuses on a stripped down version of the Author endpoints to make reviewing easier (the missing schemas will be added back in future PRs). I changed from OpenAPI 3.1 to OpenAPI 3.0 due to better tool support as of March 2024. I still prefer 3.1, but migrating will be easier than writing it all from scratch twice. I opted to create a new directory named `docs/` for the API spec files which matches the source code structure. While `swagger-jsdoc` did work well, it makes editing the schemas more difficult because VSCode cannot assist with any formatting in the block comments. Separating the documentation and code into their own files but keeping it in the same repository should still help keep the API docs up to date as unit/integration testing is added. Initial research shows other projects tend to keep their OpenAPI spec in the same repository as the source code. I am using the `vacuum` tool for bundling and linting the spec. Running the tool is discussed in `docs/README.md`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:17:09 +02:00
adam closed this issue 2026-04-25 00:17:09 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3810