Skip to content

Route trailing slash compliance: Add trailing slashes to subresource ID paths #407

@nycomp

Description

@nycomp

Problem

Per campus API conventions, subresource paths with ID parameters should have trailing slashes (e.g., /assignments/{assignment_id}/ instead of /assignments/{assignment_id}).

Routes to Fix

campus/api/routes/assignments.py

# Line 103
@bp.get('/<string:assignment_id>')  # → @bp.get('/<string:assignment_id>/')

# Line 119
@bp.patch('/<string:assignment_id>')  # → @bp.patch('/<string:assignment_id>/')

# Line 166
@bp.delete('/<string:assignment_id>')  # → @bp.delete('/<string:assignment_id>/')

campus/api/routes/submissions.py

# Line 106
@bp.get('/by-assignment/<string:assignment_id>')  # → @bp.get('/by-assignment/<string:assignment_id>/')

# Line 124
@bp.get('/by-student/<string:student_id>')  # → @bp.get('/by-student/<string:student_id>/')

# Line 142
@bp.get('/<string:submission_id>')  # → @bp.get('/<string:submission_id>/')

# Line 158
@bp.patch('/<string:submission_id>')  # → @bp.patch('/<string:submission_id>/')

# Line 202
@bp.delete('/<string:submission_id>')  # → @bp.delete('/<string:submission_id>/')

campus/api/routes/circles.py

# Line 109
@bp.delete('/<string:circle_id>')  # → @bp.delete('/<string:circle_id>/')

# Line 149
@bp.get('/<string:circle_id>')  # → @bp.get('/<string:circle_id>/')

# Line 198
@bp.patch('/<string:circle_id>')  # → @bp.patch('/<string:circle_id>/')

campus/auth/routes/credentials.py

# Line 52
@bp.delete("/<provider>/<user_id>")  # → @bp.delete("/<provider>/<user_id>/")

# Line 70
@bp.get("/<provider>/<user_id>")  # → @bp.get("/<provider>/<user_id>/")

# Line 91
@bp.patch("/<provider>/<user_id>")  # → @bp.patch("/<provider>/<user_id>/")

# Line 115
@bp.post("/<provider>/<user_id>")  # → @bp.post("/<provider>/<user_id>/")

campus/auth/routes/users.py

# Line 69
@bp.delete("/<user_id>")  # → @bp.delete("/<user_id>/")

# Line 82
@bp.get("/<user_id>")  # → @bp.get("/<user_id>/")

# Line 98
@bp.patch("/<user_id>")  # → @bp.patch("/<user_id>/")

campus/auth/routes/vaults.py

# Line 39
@bp.delete("/<label>/<key>")  # → @bp.delete("/<label>/<key>/")

# Line 52
@bp.get("/<label>/<key>")  # → @bp.get("/<label>/<key>/")

# Line 70
@bp.post("/<label>/<key>")  # → @bp.post("/<label>/<key>/")

Tasks

  1. Add trailing slashes to all 19 routes listed above
  2. Update create_blueprint() functions in affected files (where routes are manually registered)
  3. Update any tests that reference these routes
  4. Update API documentation if needed

Notes

  • Routes ending in verbs (e.g., /activate, /submit, /move) do NOT need trailing slashes
  • Routes ending in subresource names (e.g., /links, /responses, /metadata) do NOT need trailing slashes - the trailing slash is only needed on the ID segment itself

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions