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

Field Merging[1/x] Configuration Options #306

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AnthonyMDev
Copy link
Contributor

@AnthonyMDev AnthonyMDev commented Mar 21, 2024

TL;DR

Update the configuration in ApolloCodegen to allow for selecting specific field merging strategies.

What changed?

Added the ability to select specific field merging strategies such as ancestors, siblings, and named fragments in the ApolloCodegen configuration.

How to test?

Unit tests have been added to ensure encoding and decoding of field merging configurations work correctly.

Why make this change?

This change provides more flexibility in handling merged fields and named fragment accessors in the generated selection set models.


Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for eclectic-pie-88a2ba canceled.

Name Link
🔨 Latest commit 86fec35
🔍 Latest deploy log https://app.netlify.com/sites/eclectic-pie-88a2ba/deploys/663198e6bf19db000889c0dd

Copy link

netlify bot commented Mar 21, 2024

Deploy Preview for apollo-ios-docc canceled.

Name Link
🔨 Latest commit 86fec35
🔍 Latest deploy log https://app.netlify.com/sites/apollo-ios-docc/deploys/663198e695062600082bd150

@AnthonyMDev AnthonyMDev force-pushed the 03-20-field_merging_1_x_configuration_options branch from 1353191 to eec8762 Compare March 21, 2024 19:39
@AnthonyMDev AnthonyMDev changed the base branch from main to Remove_redundant_iteration_in_EntitySelectionTree_merging_algorithm March 22, 2024 01:21
@AnthonyMDev AnthonyMDev force-pushed the 03-20-field_merging_1_x_configuration_options branch from eec8762 to f9cdce4 Compare March 22, 2024 01:21
Base automatically changed from Remove_redundant_iteration_in_EntitySelectionTree_merging_algorithm to main March 22, 2024 18:10
@AnthonyMDev AnthonyMDev force-pushed the 03-20-field_merging_1_x_configuration_options branch from f9cdce4 to 88084be Compare March 25, 2024 23:11
@AnthonyMDev AnthonyMDev marked this pull request as ready for review March 26, 2024 23:20
@AnthonyMDev AnthonyMDev force-pushed the 03-20-field_merging_1_x_configuration_options branch from 88084be to 5748c50 Compare April 24, 2024 19:28
@AnthonyMDev AnthonyMDev force-pushed the 03-20-field_merging_1_x_configuration_options branch from 5748c50 to 86fec35 Compare May 1, 2024 01:20
Copy link
Member

@calvincestari calvincestari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, had a couple questions.

@@ -1351,6 +1483,7 @@ extension ApolloCodegenConfiguration.OutputOptions {
deprecatedEnumCases: ApolloCodegenConfiguration.Composition = Default.deprecatedEnumCases,
schemaDocumentation: ApolloCodegenConfiguration.Composition = Default.schemaDocumentation,
selectionSetInitializers: ApolloCodegenConfiguration.SelectionSetInitializers = Default.selectionSetInitializers,
fieldMerging: ApolloCodegenConfiguration.FieldMerging = Default.fieldMerging,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for adding this parameter to the initializer parameters? Couldn't we just be using Default.fieldMerging down in the body of the initializer? That would maintain the signature and functionality both as before and if a user wants the new functionality then they must use the new initializer?

@@ -169,6 +169,7 @@ extension ComputedSelectionSet {
fileprivate func finalize() -> ComputedSelectionSet {
let merged = MergedSelections(
mergedSources: mergedSources,
mergingStrategy: .all,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change in a future PR to use the codegen configuration value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants