private function setRequired(array $fields, string $groupName = null): array
    {
        foreach ($fields as $fieldName => $field) {
            if (!empty($field['required'])) {
                if (isset($field['groups']) && !is_array($field['groups'])) {
                    $field['groups'] = [$field['groups']];
                }
                if (empty($field['groups']) || in_array($groupName, $field['groups'])) {
                    $fields[$fieldName] = $this->makeRequired($fields[$fieldName]);
                }
            }
        }

        return $fields;
    }
private function setRequired(array $fields, string $groupName = null): array
    {
        foreach ($fields as $fieldName => $field) {
            if (!empty($field['required'])) {
                if (isset($field['groups']) && !is_array($field['groups'])) {
                    $field['groups'] = [$field['groups']];
                }
                if (empty($field['groups']) || in_array($groupName, $field['groups'])) {
                    $fields[$fieldName] = $this->makeRequired($fields[$fieldName]);
                }
            }
        }

        return $fields;
    }
private function setRequired ( array $ fields , string $ groupName = null ) : array { foreach ( $ fields as $ fieldName => $ field ) { if ( ! empty ( $ field [ 'required' ] ) ) { if ( isset ( $ field [ 'groups' ] ) && ! is_array ( $ field [ 'groups' ] ) ) { $ field [ 'groups' ] = [ $ field [ 'groups' ] ] ; } if ( empty ( $ field [ 'groups' ] ) || in_array ( $ groupName , $ field [ 'groups' ] ) ) { $ fields [ $ fieldName ] = $ this -> makeRequired ( $ fields [ $ fieldName ] ) ; } } } return $ fields ; }
Set required to attributes

@param array  $fields
@param string $groupName
@return array
@throws \Youshido\GraphQL\Exception\ConfigurationException
Set required to attributes