in src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Visitors/ObjectTypeVisitor.cs [91:134]
public override void Visit(IAcceptor acceptor, KeyValuePair<string, Type> type, NamingStrategy namingStrategy, params Attribute[] attributes)
{
var title = type.Value.IsGenericType
? namingStrategy.GetPropertyName(type.Value.Name.Split('`').First(), hasSpecifiedName: false) + "_" +
string.Join("_",
type.Value.GenericTypeArguments.Select(a => namingStrategy.GetPropertyName(a.Name, false)))
: namingStrategy.GetPropertyName(type.Value.Name, hasSpecifiedName: false);
var name = this.Visit(acceptor, name: type.Key, title: title, dataType: "object", dataFormat: null, attributes: attributes);
if (name.IsNullOrWhiteSpace())
{
return;
}
if (!this.IsNavigatable(type.Value))
{
return;
}
var instance = acceptor as OpenApiSchemaAcceptor;
if (instance.IsNullOrDefault())
{
return;
}
// Processes properties.
var properties = type.Value
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Where(p => !p.ExistsCustomAttribute<JsonIgnoreAttribute>())
.ToDictionary(p => p.GetJsonPropertyName(namingStrategy), p => p);
this.ProcessProperties(instance, name, properties, namingStrategy);
// Adds the reference.
var reference = new OpenApiReference()
{
Type = ReferenceType.Schema,
Id = type.Value.GetOpenApiReferenceId(isDictionary: false, isList: false, namingStrategy)
};
instance.Schemas[name].Reference = reference;
instance.Schemas[name].Example = this.GetExample(type.Value, namingStrategy);
}