input_file_param = QgsProcessingParameterString('input_file', 'Input File', defaultValue='') input_file_param.setMetadata({'required': True}) params.append(input_file_param)
output_path_param = QgsProcessingParameterString('output_path', 'Output Path', defaultValue='') output_path_param.setMetadata({'constraints': 'file_exists'}) params.append(output_path_param)In both cases, the setMetadata method is used to attach additional information to the parameter. The metadata is passed in as a dictionary, with keys indicating the type of information being provided (e.g. "required" or "constraints") and values providing the actual details. Package/Library: This method is part of the QGIS Python library, which is included with the QGIS application. Specifically, it is found in the qgis.core module.