Skip to content

feat: add dynamic OpenAPI/Swagger documentation#1761

Open
monil80 wants to merge 1 commit into
typicode:mainfrom
monil80:feat/dynamic-swagger
Open

feat: add dynamic OpenAPI/Swagger documentation#1761
monil80 wants to merge 1 commit into
typicode:mainfrom
monil80:feat/dynamic-swagger

Conversation

@monil80
Copy link
Copy Markdown

@monil80 monil80 commented May 17, 2026

Summary

  • GET /docs — Swagger UI (CDN, no new dependencies)
  • GET /openapi.json — OpenAPI 3.0 generated from db.json at runtime
  • --no-swagger and createApp({ swagger: false }) to disable

Test plan

  • npm test
  • npm run lint
  • npx json-server fixtures/db.jsonhttp://localhost:3000/docs
  • npx json-server --no-swagger fixtures/db.json/docs returns 404

@tamjid14
Copy link
Copy Markdown

This looks like a useful change. One thing I would suggest is adding regression tests for both the new behavior and the existing behavior, so the change does not accidentally break current filtering syntax.

For example, if the PR changes filtering behavior, it would be useful to test:

GET /posts?title=hello

and also any equivalent _where or operator-based syntax that should still work.

That would make the change safer and easier to review because maintainers can see exactly which behavior is intended to change and which behavior should stay compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants