ts-json-schema-generator icon indicating copy to clipboard operation
ts-json-schema-generator copied to clipboard

How to exclude underscore properties from json schema ?

Open jy95 opened this issue 1 year ago • 1 comments

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

jy95 avatar Apr 11 '24 08:04 jy95