Skip to content

Persistent mock data store with rebuild endpoint and Swagger UI button #17

@Many0nne

Description

@Many0nne

Currently, mock data is regenerated on every request (array pools always, single objects unless config.cache is enabled), making it hard to test filtering/sorting/pagination consistently.

Changes needed:

  • Data store: Cache both single object mocks and array pools on first request (always-on, independent of config.cache). Data stays stable across requests.
  • POST /mock-reset: Clears the data store so everything regenerates fresh on the next requests. Returns a summary of what was cleared.
  • Swagger UI "Rebuild Data" button: Inject custom JS into the Swagger UI that adds a button calling POST /mock-reset and reloading the page — useful when interfaces change or fresh data is needed.
  • Swagger spec: Document the /mock-reset endpoint.

Affected files: src/core/cache.ts, src/core/router.ts, src/server.ts, src/core/swagger.ts

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions