What prevented the value type of field my_attribute from changing?

An external system integrates functionality of a product catalog search using Adobe Commerce GraphQL API. The Architect creates a new attribute my_attribute in the admin panel with frontend type select-Later, the Architect sees that Productlnterf ace already has the field my_attribute, but returns an Int value. The Architect wants this field to be a new type that contains both option id and label.

To meet this requirement, an Adobe Commerce Architect creates a new module and file etc/schema.graphqls that declares as follows:

After calling command setup:upgrade, the introspection of Productlnterface field my_attribute remains Int.

What prevented the value type of field my_attribute from changing?
A . The Magento_CatalogGraphQI module occurs later in sequence than the Magento_GraphQI module and merging output of dynamic attributes schema reader overrides types declared in schema.graphqls
B . The fields of Productlnterface are checked during processing schema.graphqls files. If they have a corresponding attribute, then the backendjype of product attribute is set for field type.
C . The interface Productlnterface is already declared in Magento.CatalogGraphQI module. Extending requires use of the keyword extend before a new declaration of Productlnterface.

Answer: C

Explanation:

According to the Adobe Commerce documentation, to extend an existing GraphQL interface, the

keyword extend must be used before the interface name. This indicates that the new declaration is

adding or modifying fields to the existing interface, rather than redefining it. If the keyword extend is

omitted, the new declaration will be ignored and the original interface will be used. In this case, the

Architect wants to change the type of the my_attribute field in the ProductInterface interface, which

is already declared in the Magento.CatalogGraphQl module. Therefore, the Architect should use the

keyword extend before declaring the ProductInterface interface in the schema.graphqls file of the

custom module. This will allow the Architect to override the type of the my_attribute field from Int

to MyAttributeType.

Reference: Extend existing schema | Adobe Commerce Developer Guide 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

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments