Skip to content

New: Add POST /validate endpoint to AbstractApiModule - #111

Merged
taylortom merged 1 commit into
masterfrom
new/validate-endpoint
Jun 30, 2026
Merged

New: Add POST /validate endpoint to AbstractApiModule#111
taylortom merged 1 commit into
masterfrom
new/validate-endpoint

Conversation

@taylortom

Copy link
Copy Markdown
Collaborator

Fixes #110

New

  • Add a POST /validate route to default-routes.json, inherited by every AbstractApiModule subclass. modifying: false so the raw body reaches the handler un-sanitised (we validate exactly what was sent).
  • Add validateHandler() to AbstractApiModule: validates req.apiData.data against the resolved schema (honouring subclass getSchemaName() overrides), responds 200 with the validated/normalised document, or forwards the schema validation error via next().
  • Gated on write:${scope} — validation is a pre-write operation; read-only users have no create/edit flow and so no use for it.

Docs

  • Document the new inherited route in both endpoint tables in writing-an-api.md.

Testing

  • #validateHandler(): responds 200 with the validated data (asserts schema name + body + options passed through); forwards a validation error to next and sends no response.
  • default-routes.json: /validate present, modifying: false, gated on the write scope.
  • Full suite (66 tests) passes; npx standard clean.

@taylortom
taylortom merged commit 30835af into master Jun 30, 2026
2 checks passed
@taylortom
taylortom deleted the new/validate-endpoint branch June 30, 2026 14:43
github-actions Bot pushed a commit that referenced this pull request Jun 30, 2026
# [3.10.0](v3.9.0...v3.10.0) (2026-06-30)

### New

* Add POST /validate endpoint to AbstractApiModule (fixes #110) (#111) ([30835af](30835af)), closes [#110](#110) [#111](#111)
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a POST /validate endpoint to AbstractApiModule

1 participant