Skip to content
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

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marcolink
Copy link
Member

@marcolink 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:

ruderngespra
ruderngespra previously approved these changes Oct 11, 2023
Copy link
Contributor

@ruderngespra ruderngespra left a 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)
Copy link
Contributor

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?

transformedLocale.sys = pick(destinationLocale.sys, 'id')
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return transformedLocale
Copy link
Contributor

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 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 marcolink force-pushed the feat/62-add-force-flag-for-omitted-fields branch from d8c310a to 4dcf628 Compare October 24, 2023 07:41
@marcolink 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.

None yet

2 participants