Skip to content

services module: support stricter validation options in isApiPerson #5161

Description

@odinr

Context

In packages/modules/services/src/people/is-api-person.ts, the isApiPerson type-guard factory only checks for the presence of required attributes:

export const isApiPerson = <V extends keyof typeof ApiVersion>(version: V) => {
  /** todo add options for more strict check */
  return <T>(value: T): value is T extends ApiPerson<V> ? 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)

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