/// <summary>
        /// Generates an <see cref="EntryEndpoint"/> with children by matching patterns in the OpenAPI Spec document.
        /// </summary>
        /// <param name="document">The document to check for patterns.</param>
        /// <param name="patterns">An ordered list of all known <see cref="IPattern"/>s; leave <c>null</c> for default.</param>
        public static EntryEndpoint MatchTypedRestPatterns(this OpenApiDocument document, PatternRegistry?patterns = null)
        {
            var matcher = new PatternMatcher(patterns ?? PatternRegistry.Default);

            var entryEndpoint = new EntryEndpoint();

            entryEndpoint.Children.AddRange(matcher.GetEndpoints(PathTree.From(document.Paths ?? new OpenApiPaths())));

            return(entryEndpoint);
        }