in src/Microsoft.Azure.WebJobs.Extensions.OpenApi/Document.cs [134:198]
public IDocument Build(Assembly assembly, OpenApiVersionType version = OpenApiVersionType.V2)
{
if (this._strategy.IsNullOrDefault())
{
this._strategy = new DefaultNamingStrategy();
}
var paths = new OpenApiPaths();
var tags = this._req.Query["tag"].ToArray(",");
var methods = this._helper.GetHttpTriggerMethods(assembly, tags);
foreach (var method in methods)
{
var trigger = this._helper.GetHttpTriggerAttribute(method);
if (trigger.IsNullOrDefault())
{
continue;
}
var function = this._helper.GetFunctionNameAttribute(method);
if (function.IsNullOrDefault())
{
continue;
}
var path = this._helper.GetHttpEndpoint(function, trigger);
if (path.IsNullOrWhiteSpace())
{
continue;
}
var verb = this._helper.GetHttpVerb(trigger);
var item = this._helper.GetOpenApiPath(path, paths);
var operations = item.Operations;
var operation = this._helper.GetOpenApiOperation(method, function, verb);
if (operation.IsNullOrDefault())
{
continue;
}
operation.Security = this._helper.GetOpenApiSecurityRequirement(method, this._strategy);
operation.Parameters = this._helper.GetOpenApiParameters(method, trigger, this._strategy, this._collection, version);
operation.RequestBody = this._helper.GetOpenApiRequestBody(method, this._strategy, this._collection, version);
operation.Responses = this._helper.GetOpenApiResponses(method, this._strategy, this._collection, version);
operations[verb] = operation;
item.Operations = operations;
paths[path] = item;
}
this.OpenApiDocument.Paths = paths;
this.OpenApiDocument.Components.Schemas = this._helper.GetOpenApiSchemas(methods, this._strategy, this._collection);
this.OpenApiDocument.Components.SecuritySchemes = this._helper.GetOpenApiSecuritySchemes(methods, this._strategy);
// this.OpenApiDocument.SecurityRequirements = this.OpenApiDocument
// .Paths
// .SelectMany(p => p.Value.Operations.SelectMany(q => q.Value.Security))
// .Where(p => !p.IsNullOrDefault())
// .Distinct(new OpenApiSecurityRequirementComparer())
// .ToList();
return this;
}