in src/Microsoft.NET.Sdk.Functions.Generator/FunctionJsonConverter.cs [121:168]
public IEnumerable<(FunctionJsonSchema schema, FileInfo outputFile)?> GenerateFunctions(IEnumerable<TypeDefinition> types)
{
foreach (var type in types)
{
foreach (var method in type.Methods)
{
if (method.HasFunctionNameAttribute())
{
if (method.HasUnsuportedAttributes(out string error))
{
_logger.LogError(error);
yield return null;
}
else if (method.IsWebJobsSdkMethod())
{
var functionName = method.GetSdkFunctionName();
var artifactName = Path.Combine(functionName, "function.json");
var path = Path.Combine(_outputPath, artifactName);
var relativeAssemblyPath = PathUtility.MakeRelativePath(Path.Combine(_outputPath, "dummyFunctionName"), type.Module.FileName);
var functionJson = method.ToFunctionJson(relativeAssemblyPath);
if (CheckAppSettingsAndFunctionName(functionJson, method))
{
yield return (functionJson, new FileInfo(path));
}
else
{
yield return null;
}
}
else if (method.HasFunctionNameAttribute())
{
if (method.HasNoAutomaticTriggerAttribute() && method.HasTriggerAttribute())
{
_logger.LogWarning($"Method {method.DeclaringType.GetReflectionFullName()}.{method.Name} has both a 'NoAutomaticTrigger' attribute and a trigger attribute. Both can't be used together for an Azure function definition.");
}
else
{
_logger.LogWarning($"Method {method.DeclaringType.GetReflectionFullName()}.{method.Name} is missing a trigger attribute. Both a trigger attribute and FunctionName attribute are required for an Azure function definition.");
}
}
else if (method.HasValidWebJobSdkTriggerAttribute())
{
_logger.LogWarning($"Method {method.DeclaringType.GetReflectionFullName()}.{method.Name} is missing the 'FunctionName' attribute. Both a trigger attribute and 'FunctionName' are required for an Azure function definition.");
}
}
}
}
}