linkedin / linkedin/ambry

Handle RestRequest arguments in a (more) type safe way

Open
#979 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
298
Avg merge
21h 43m
Merged PRs (30d)
9

Description

`RestRequest` has an argument map that we use for storing request headers, query params, cookies, and context objects that are set inside of our business logic. Currently, reading these arguments requires an unsafe cast from `Object` to whatever type the argument is supposed to be.

If we used something similar to Netty's `AttributeMap` system, the key could include the type of the value and the cast in the business logic could be avoided (`AttributeMap` still does a cast internally, but this is a little bit cleaner since the casts aren't spread out across the codebase).

### Inspiration
- [AttributeMap javadoc](https://netty.io/4.1/api/io/netty/util/AttributeMap.html)
- [DefaultAttributeMap](https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/DefaultAttributeMap.java)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the RestRequest argument map and the linked Netty AttributeMap and DefaultAttributeMap references. Define completion as request arguments exposing typed keys so callers no longer need unsafe Object casts, while preserving support for headers, query parameters, cookies, and context objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.