equinor / equinor/fusion-framework

services module: support stricter validation options in isApiPerson

Open Beginner friendly
#5,161 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.