magento / architecture

A place where Magento architectural discussions happen
275 stars 153 forks source link

Proposal to solve dependency in GQL schema between QuoteGQL and WishlistGQL #413

Closed prabhuram93 closed 4 years ago

prabhuram93 commented 4 years ago

Problem

Based on the uid changes, new/existing mutations in the future will be leveraging the EnteredOptionInput type.

input EnteredOptionInput {
    uid: ID!
    value: String!
}

Based on this architecture AddProductsToCart the type EnteredOptionInput is inferred to be in QuoteGQL module.

The same type is being used in WishlistGQL Wishlist for its mutations. This creates a dependency between WishlistGQL and QuoteGQL.

Solution

There a couple of ways to fix this.

Solution 1. Move the EnteredOptionInput to the GraphQL framework module, which will avoid cross dependencies across modules except for the framework module. (Added in the document)

Solution 2. Rename field names specific to the modules, possibly WishlistEnteredOptionInput and CartItemEnteredOptionInput and have the type on respective modules. This introduces a very minimum level of duplication but the provides the flexibility to update input types in the future. Flexibility plays a key role here, since modifying input types impacts the mutations in which the those types are being used in.

Solution 3. Create a new module to move this type to. This might be an overkill for just a type.

Requested Reviewers

@paliarush @akaplya @DrewML