[PR #3094] [CLOSED] Openapi middleware validation #3861

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

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3094
Author: @nichwall
Created: 6/22/2024
Status: Closed

Base: masterHead: openapi_middleware_validation_2


📝 Commits (10+)

  • 89685b6 Add: express-openapi-validator to package file
  • 327ddd8 Initial OpenApiValidator middleware
  • 0a4d24f Add: format and unknownFormats
  • f5d7a71 Fix: allow comma in Author query
  • 62fbae6 Revert "Add: express-openapi-validator to package file"
  • 0122f88 Add: express-openapi-validator to dev dependencies
  • ac4bd0a Change: OpenApiValidator to only be created in dev
  • 7613580 Update spec path in Server.js
  • 86cb504 Update bundled spec
  • faa3147 Update: some library parameters

📊 Changes

7 files changed (+902 additions, -266 deletions)

View changed files

📝 docs/controllers/AuthorController.yaml (+19 -11)
📝 docs/controllers/LibraryController.yaml (+94 -71)
📝 docs/openapi.json (+307 -181)
📝 docs/schemas.yaml (+9 -0)
📝 package-lock.json (+438 -3)
📝 package.json (+1 -0)
📝 server/Server.js (+34 -0)

📄 Description

This PR adds openapi-openapi-validator to compare API requests and responses against the OpenAPI specification located in docs. I am only adding this as a dev dependency because if the request/response does not match the spec, the web client may render incorrectly (I ran into issues with the "edit library item" modal sometimes presenting a blank tab when the spec was not met).

An example of errors given to help identify how a request or response does not match the spec:
Screenshot from 2024-06-21 14-52-02

This PR also updates some of the requestBody to parameters and creates some generic parameters in response to changes made in https://github.com/advplyr/audiobookshelf/commit/d6438590d7010e9e9f512ecfdbf4cd7f0d149407


🔄 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/3094 **Author:** [@nichwall](https://github.com/nichwall) **Created:** 6/22/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `openapi_middleware_validation_2` --- ### 📝 Commits (10+) - [`89685b6`](https://github.com/advplyr/audiobookshelf/commit/89685b677b139b874618edbec3c907e87cc43fc5) Add: `express-openapi-validator` to package file - [`327ddd8`](https://github.com/advplyr/audiobookshelf/commit/327ddd8ec5b1a8345e77c5268a4e4fa581e4f929) Initial OpenApiValidator middleware - [`0a4d24f`](https://github.com/advplyr/audiobookshelf/commit/0a4d24f1b3765a17efec54b7eabb0e6f858e5ee6) Add: `format` and `unknownFormats` - [`f5d7a71`](https://github.com/advplyr/audiobookshelf/commit/f5d7a71f62c5f1a8cfaf0195feb69290dafa56a8) Fix: allow comma in Author query - [`62fbae6`](https://github.com/advplyr/audiobookshelf/commit/62fbae6f7b5fc9e5b745df6903b4d27a46ea7c1d) Revert "Add: `express-openapi-validator` to package file" - [`0122f88`](https://github.com/advplyr/audiobookshelf/commit/0122f88b4681ad7561aac2dc1c586627dcc47a56) Add: `express-openapi-validator` to dev dependencies - [`ac4bd0a`](https://github.com/advplyr/audiobookshelf/commit/ac4bd0a558d95aaa155c68cc66e07d6c676e54b4) Change: OpenApiValidator to only be created in dev - [`7613580`](https://github.com/advplyr/audiobookshelf/commit/76135800d5df2cb261e5671d78541fe610802987) Update spec path in `Server.js` - [`86cb504`](https://github.com/advplyr/audiobookshelf/commit/86cb5049ee14c75300dcdac496ba3269a357cb57) Update bundled spec - [`faa3147`](https://github.com/advplyr/audiobookshelf/commit/faa31471b40bb545e1ebccc4fc2fd70f10500512) Update: some library parameters ### 📊 Changes **7 files changed** (+902 additions, -266 deletions) <details> <summary>View changed files</summary> 📝 `docs/controllers/AuthorController.yaml` (+19 -11) 📝 `docs/controllers/LibraryController.yaml` (+94 -71) 📝 `docs/openapi.json` (+307 -181) 📝 `docs/schemas.yaml` (+9 -0) 📝 `package-lock.json` (+438 -3) 📝 `package.json` (+1 -0) 📝 `server/Server.js` (+34 -0) </details> ### 📄 Description This PR adds `openapi-openapi-validator` to compare API requests and responses against the OpenAPI specification located in `docs`. I am only adding this as a dev dependency because if the request/response does not match the spec, the web client may render incorrectly (I ran into issues with the "edit library item" modal sometimes presenting a blank tab when the spec was not met). An example of errors given to help identify how a request or response does not match the spec: ![Screenshot from 2024-06-21 14-52-02](https://github.com/advplyr/audiobookshelf/assets/5686638/90addac2-803b-459d-9d3a-193978d060ee) This PR also updates some of the `requestBody` to `parameters` and creates some generic `parameter`s in response to changes made in https://github.com/advplyr/audiobookshelf/commit/d6438590d7010e9e9f512ecfdbf4cd7f0d149407 --- <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:21 +02:00
adam closed this issue 2026-04-25 00:17:21 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3861