In a custom module in etc/schema.graphqls, I declared my query :
type Query { getAvailableCountries: [Country!] @resolver(class: "\\Vendor\\Module\\Model\\Resolver\\getAvailableCountries") @doc(description: "Get list of country allowed on magento's side.") } There is my resolver code :
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) { $allowedCountries = $this->scopeConfig->getValue( AllowedCountries::ALLOWED_COUNTRIES_PATH ); if (empty($allowedCountries)) { return []; } $allowedCountries = explode(",", $allowedCountries); $return = []; foreach ($allowedCountries as $countryCode) { $return[] = [ "two_letter_abbreviation" => $countryCode, "full_name_english" => $this->translate->getCountryTranslation($countryCode, "en_US") ]; } return $return; } In the schema.graphql generated I have : getAvailableCountries: [Country] Why is the ! not kept ?
I also tried [Country!]! and it's becoming [Country]!
Is there a way to force it to be : [Country!] the type Country is coming from Magento_DirectoryGraphQl but i also tried to declare my own type with only the two field i want and it's the same, the ! is still removed
query Countries { countries { full_name_english two_letter_abbreviation } }countriesquery returns all countries in which the entity can do business. developer.adobe.com/commerce/webapi/graphql/schema/store/…