Skip to content

How to exclude underscore properties from json schema ? #1913

@jy95

Description

@jy95

Hello,

I would like to exclude properties that starts with a underscore which pollute a type I don't have any control on

// npm install -D @types/fhir
import type { Dosage as DosageR4 } from "fhir/r4";

type DeepOmit<T, K extends string> = {
  [P in keyof T as Exclude<P, `${K}${string}`>]: T[P] extends object ? DeepOmit<T[P], K> : T[P];
};

export type Entry = DeepOmit<DosageR4, "_">;

It works in Typescript
image

But not in the resulting json schema
image

Do you have an idea on how to achieve this using ts-json-schema-generator ?

Thanks for the help

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions