equinor / equinor/fusion-framework
context: parse/map raw `value` payload on ContextItem into a typed shape
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 10
- Avg merge
- 19h 40m
- Merged PRs (30d)
- 150
Description
In `packages/modules/context/src/parse-context-item.ts`, `parseContextItem` currently passes the raw API `value` payload through as-is (`value: item.value ?? {}`) without any parsing or typing.
```ts
export const parseContextItem = (item: ApiContextEntity): ContextItem => {
return {
...
value: item.value ?? {},
};
};
```
Consider defining a typed shape for `value` (or a per-context-type schema) and parsing/validating it here instead of passing the raw payload through untyped.
_Originally flagged as a `// TODO` comment while resolving fusion-lint warnings on `fix/sematic-lint`._
Contributor guide
Research direction
Start in packages/modules/context/src/parse-context-item.ts at parseContextItem, and compare the ApiContextEntity and ContextItem shapes involved in the mapping. Determine the intended typed or per-context-type value contract and how it should be parsed or validated. Done means the value is no longer passed through as an untyped raw payload and the resulting ContextItem remains correctly typed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100