Skip to content

typing(web): unify JSONResponse return in context route handlers#190

Merged
memtomem merged 2 commits intomainfrom
typing/web-json-response-112
Apr 16, 2026
Merged

typing(web): unify JSONResponse return in context route handlers#190
memtomem merged 2 commits intomainfrom
typing/web-json-response-112

Conversation

@memtomem
Copy link
Copy Markdown
Owner

Summary

  • Change 5 route handlers (`update_skill`, `rendered_command`,
    `update_command`, `rendered_agent`, `update_agent`) from
    `-> dict` to `-> JSONResponse`.
  • Wrap success-path `return {...}` in `JSONResponse(content={...})`.
  • Error paths already returned `JSONResponse` (409 mtime conflict /
    422 parse error), so this unifies the return type.

Option 2 from the issue: uniform `JSONResponse` is more accurate
and self-documenting than a union type, and avoids pushing narrowing
burden to callers. Response bodies are byte-for-byte equivalent —
FastAPI serialises `dict` and `JSONResponse(content=dict)` identically.

Closes #112

Change 5 handlers from -> dict to -> JSONResponse and wrap
success-path dicts in JSONResponse(content=...).  Error paths already
returned JSONResponse (409 mtime conflict / 422 parse error), so this
unifies the return type without changing response bodies.
@memtomem memtomem merged commit 240bc2c into main Apr 16, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2026
@memtomem memtomem deleted the typing/web-json-response-112 branch April 16, 2026 15:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

typing(web): unify JSONResponse return path in context_{skills,commands,agents}.py routes

2 participants