Beispiel #1
0
        public static string GetIdentifier(this OpenApiUrlTreeNode currentNode)
        {
            if (currentNode == null)
            {
                return(string.Empty);
            }
            string identifier;

            if (currentNode.IsParameter())
            {
                identifier = currentNode.Segment.Substring(1, currentNode.Segment.Length - 2).ToPascalCase();
            }
            else
            {
                identifier = currentNode.Segment.ToPascalCase().Replace("()", "");
                var openParen = identifier.IndexOf("(");
                if (openParen >= 0)
                {
                    identifier = identifier.Substring(0, openParen);
                }
            }
            return(identifier);
        }