Skip to content

Fix: Route loading, serveSchema bugs, and handler name migration#86

Merged
taylortom merged 9 commits intomasterfrom
fix/routes-json-fixes
Feb 26, 2026
Merged

Fix: Route loading, serveSchema bugs, and handler name migration#86
taylortom merged 9 commits intomasterfrom
fix/routes-json-fixes

Conversation

@taylortom
Copy link
Contributor

Summary

Follow-up fixes to #85 which moved route definitions to routes.json.

  • Adds the missing loadRouteConfig call to setValues() so routes are actually loaded
  • Converts serveSchema from factory to standard handler
  • Fixes serveSchema error handling: uses next() instead of res.sendError(), returns schema.built, uses NO_SCHEMA_DEF error
  • Renames handler strings from aliases (default, query) to method names (requestHandler, queryHandler) to match the factory-to-standard-method conversion in adapt-authoring-api
  • Adds API metadata from removed apidefs.js to routes.json
  • Adds adapt-authoring-server peer dependency

Fix

  • setValues() now calls loadRouteConfig so routes.json is actually loaded
  • serveSchema uses next() for error propagation, NO_SCHEMA_DEF error, and returns schema.built

Update

  • Handler strings renamed to match method names
  • API metadata for install, update, and uses endpoints added to routes.json

Test plan

  • npm test — all 44 ContentPluginModule tests pass
  • Start app with npm run dev, verify:
    • Standard endpoints (GET/PATCH/DELETE) work
    • Plugin install via zip upload works (POST /api/contentplugins/install)
    • Schema endpoint works (GET /api/contentplugins/schema)

Depends on adapt-security/adapt-authoring-api#78

🤖 Generated with Claude Code

Copilot AI and others added 9 commits February 26, 2026 13:06
Co-authored-by: taylortom <1059083+taylortom@users.noreply.github.com>
…efs #85)

setValues() was missing the loadRouteConfig call so routes.json was
never loaded. Also converts serveSchema from factory to standard handler,
renames handler strings to match method names, adds API metadata from
the removed apidefs.js, and adds adapt-authoring-server peer dependency.
#85)

The override was using res.sendError() instead of next() for error
propagation, and returning the raw schema object instead of schema.built.
Both now match the base class convention in AbstractApiModule.
Meta has been moved to routes.json.
@taylortom taylortom merged commit 9b12a4c into master Feb 26, 2026
2 checks passed
@taylortom taylortom deleted the fix/routes-json-fixes branch February 26, 2026 23:15
github-actions bot pushed a commit that referenced this pull request Feb 26, 2026
## [1.5.1](v1.5.0...v1.5.1) (2026-02-26)

### Fix

* Route loading, serveSchema bugs, and handler name migration (#86) ([9b12a4c](9b12a4c)), closes [#86](#86)
@github-actions
Copy link

🎉 This PR is included in version 1.5.1 🎉

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.

2 participants