internal static void AddTagFromSwaggerTagAttribute(SwaggerDocument document, dynamic tagAttribute)
        {
            if (document.Tags == null)
            {
                document.Tags = new List <SwaggerTag>();
            }

            var tag = document.Tags.SingleOrDefault(t => t.Name == tagAttribute.Name);

            if (tag == null)
            {
                tag = new SwaggerTag();
                document.Tags.Add(tag);
            }

            tag.Description = tagAttribute.Description;
            tag.Name        = tagAttribute.Name;

            if (!string.IsNullOrEmpty(tagAttribute.DocumentationDescription) ||
                !string.IsNullOrEmpty(tagAttribute.DocumentationUrl))
            {
                tag.ExternalDocumentation = new SwaggerExternalDocumentation
                {
                    Description = tagAttribute.DocumentationDescription,
                    Url         = tagAttribute.DocumentationUrl
                };
            }
        }
Exemplo n.º 2
0
        internal static void AddTagFromSwaggerTagAttribute(SwaggerDocument document, dynamic tagAttribute)
        {
            if (document.Tags == null)
                document.Tags = new List<SwaggerTag>();

            var tag = document.Tags.SingleOrDefault(t => t.Name == tagAttribute.Name);
            if (tag == null)
            {
                tag = new SwaggerTag();
                document.Tags.Add(tag);
            }

            tag.Description = tagAttribute.Description;
            tag.Name = tagAttribute.Name;

            if (!string.IsNullOrEmpty(tagAttribute.DocumentationDescription) ||
                !string.IsNullOrEmpty(tagAttribute.DocumentationUrl))
            {
                tag.ExternalDocumentation = new SwaggerExternalDocumentation
                {
                    Description = tagAttribute.DocumentationDescription,
                    Url = tagAttribute.DocumentationUrl
                };
            }
        }
Exemplo n.º 3
0
 public SwaggerTagAttribute(SwaggerTag tag)
 {
     Tag = tag;
 }