We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
But not in the resulting json schema
Do you have an idea on how to achieve this using ts-json-schema-generator ?
Thanks for the help
The text was updated successfully, but these errors were encountered:
Currently, I use a workaround on the generated schema that I don't find performant-friendly :
function removeUnderscoreProperties(obj) { for (var prop in obj) { if (prop.startsWith('_')) { delete obj[prop]; } else if (typeof obj[prop] === 'object') { removeUnderscoreProperties(obj[prop]); } } } function stringifyWithoutUnderscore(obj) { var newObj = {... obj}; removeUnderscoreProperties(newObj); return JSON.stringify(newObj, null, 2); }
Sorry, something went wrong.
No branches or pull requests
Hello,
I would like to exclude properties that starts with a underscore which pollute a type I don't have any control on
It works in Typescript
But not in the resulting json schema
Do you have an idea on how to achieve this using ts-json-schema-generator ?
Thanks for the help
The text was updated successfully, but these errors were encountered: