protected string Visit()

in src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Visitors/TypeVisitor.cs [124:179]


        protected string Visit(IAcceptor acceptor, string name, string title, string dataType, string dataFormat, params Attribute[] attributes)
        {
            var instance = acceptor as OpenApiSchemaAcceptor;
            if (instance.IsNullOrDefault())
            {
                return null;
            }

            if (instance.Schemas.ContainsKey(name))
            {
                return null;
            }

            var schema = new OpenApiSchema()
            {
                Title = title,
                Type = dataType,
                Format = dataFormat
            };

            // Adds the extra properties.
            if (attributes.Any())
            {
                Attribute attr = attributes.OfType<OpenApiPropertyAttribute>().SingleOrDefault();
                if (!attr.IsNullOrDefault())
                {
                    if (dataType != "object")
                    {
                        schema.Default = this.GetOpenApiPropertyDefault(attr as OpenApiPropertyAttribute);
                    }
                    schema.Nullable = this.GetOpenApiPropertyNullable(attr as OpenApiPropertyAttribute);
                    schema.Description = this.GetOpenApiPropertyDescription(attr as OpenApiPropertyAttribute);
                    schema.Deprecated = this.GetOpenApiPropertyDeprecated(attr as OpenApiPropertyAttribute);
                }

                attr = attributes.OfType<OpenApiSchemaVisibilityAttribute>().SingleOrDefault();
                if (!attr.IsNullOrDefault())
                {
                    var extension = new OpenApiString((attr as OpenApiSchemaVisibilityAttribute).Visibility.ToDisplayName());

                    schema.Extensions.Add("x-ms-visibility", extension);
                }

                attr = attributes.OfType<JsonPropertyAttribute>().SingleOrDefault();
                if (!attr.IsNullOrDefault())
                {
                    schema.Nullable = this.GetNewtonsoftPropertNullable(attr as JsonPropertyAttribute);
                }

                schema.ApplyValidationAttributes(attributes.OfType<ValidationAttribute>());
            }

            instance.Schemas.Add(name, schema);

            return name;
        }