How should the Adobe Commerce Architect declare output of this mutation?
An Adobe Commerce Architect is creating a new GraphQL API mutation to alter the process of adding configurable products to the cart. The mutation accepts configurable product ID. If the given product has only one variant, then the mutation should add this variant to the cart and return not nullable Cart type. If the configurable product has more variants, then the mutation should return not
nullable Conf igurableProduct type.
The mutation declaration looks as follows:
How should the Adobe Commerce Architect declare output of this mutation?
A)
B)
C)
A . Option A
B . Option B
C . Option C
Answer: B
Explanation:
According to the Adobe Commerce documentation, the output of a GraphQL mutation is declared by specifying the type of the data returned by the mutation. The type can be either a scalar type (such as String, Int, Boolean, etc.), an object type (such as Cart, Product, Customer, etc.), or a union type (such as SearchResult, which can be either Product or Category). A union type is used when the mutation can return more than one possible type of data, depending on the input or the logic of the mutation. In this case, the mutation can return either a Cart type or a ConfigurableProduct type, depending on the number of variants of the configurable product. Therefore, the output of the mutation should be declared as a union type that includes both Cart and ConfigurableProduct types. Option B is the only option that correctly declares a union type using the pipe symbol (|) to separate the possible types. Option A and Option C are incorrect because they use brackets ([ ]) and curly braces ({ }), which are used for declaring list types and input object types, respectively.
Reference: GraphQL API – Adobe Inc.
Schema language with GraphQL | Adobe Commerce
Latest AD0-E722 Dumps Valid Version with 50 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund