Skip to content

feat: add force flag to import omitted fields [#62]#919

Draft
Marco Link (marcolink) wants to merge 1 commit intomainfrom
feat/62-add-force-flag-for-omitted-fields
Draft

feat: add force flag to import omitted fields [#62]#919
Marco Link (marcolink) wants to merge 1 commit intomainfrom
feat/62-add-force-flag-for-omitted-fields

Conversation

@marcolink
Copy link
Member

@marcolink Marco Link (marcolink) commented Oct 10, 2023

Introduce a new flag force to 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:

Copy link
Contributor

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)

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

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?

Copy link
Member Author

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)

@marcolink Marco Link (marcolink) force-pushed the feat/62-add-force-flag-for-omitted-fields branch 3 times, most recently from 64a4b71 to d8c310a Compare October 12, 2023 12:58
@marcolink Marco Link (marcolink) force-pushed the feat/62-add-force-flag-for-omitted-fields branch from d8c310a to 4dcf628 Compare October 24, 2023 07:41
@marcolink Marco Link (marcolink) force-pushed the feat/62-add-force-flag-for-omitted-fields branch from 4dcf628 to eb98727 Compare April 22, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants