-
Notifications
You must be signed in to change notification settings - Fork 40
feat: add force flag to import omitted fields [#62] #919
New issue
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
base: main
Are you sure you want to change the base?
Conversation
ruderngespra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool stuff, love all the additional types as well. Maybe we can add an additional entry to the readme list here.
Also, what do you think about "delete-omitted-fields" instead of "force", just because force could be needed for other things in the future and sounds quite generic.
| ctx.sourceData = transformedSourceData | ||
| const customTransformers: Partial<typeof transformers> = {} | ||
| if (options.force) { | ||
| customTransformers.contentTypes = (contentType: ContentTypeProps) => pipe(transformers.contentTypes, forceDeleteOmittedFieldTransform)(contentType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally not the biggest fan of adding the pipe dependency "just" for this, not sure about the benefit, we also just can pass the params through all all transformers instead, no?
|
|
||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore | ||
| return transformedLocale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this ignore here, what's the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The retuned shape only has a subset of data in the sys field (only the id field)
test/unit/transform/force-delete-omitted-field-transform.test.ts
Outdated
Show resolved
Hide resolved
64a4b71 to
d8c310a
Compare
d8c310a to
4dcf628
Compare
4dcf628 to
eb98727
Compare
Introduce a new flag
forceto enforce content type imports with omitted fields. If the flag is present, we delete omitted fields before importing the content type.Addresses the feature request formulated in several issues: