equinor / equinor/fusion-framework
services module: support stricter validation options in isApiPerson
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 10
- Avg merge
- 19h 40m
- Merged PRs (30d)
- 150
Description
## Context
In `packages/modules/services/src/people/is-api-person.ts`, the `isApiPerson` type-guard factory only checks for the presence of required attributes:
```ts
export const isApiPerson = (version: V) => {
/** todo add options for more strict check */
return (value: T): value is T extends ApiPerson ? T : never => {
...
```
## Task
- Add an options parameter (e.g. `{ strict?: boolean }`) to `isApiPerson` allowing callers to opt into a stricter check (e.g. validating value types of required attributes, not just presence).
- Document the new option in the function's TSDoc with an example.
## File
`packages/modules/services/src/people/is-api-person.ts` (line ~37)
Contributor guide
Research direction
Start in packages/modules/services/src/people/is-api-person.ts around line 37 and inspect the existing isApiPerson type-guard factory and its required-attribute checks. Add the documented strict option so callers can opt into value-type validation, then update the function TSDoc with an example; done when both default and strict usage are clearly described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100