<commit_before>﻿// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this 
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

namespace ServiceStack.IntroSpec
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Enrichers;
    using Enrichers.Infrastructure;
    using Enrichers.Interfaces;
    using Extensions;
    using FluentValidation;
    using Funq;
    using Host;
    using Logging;
    using Models;
    using Postman.Services;
    using Services;
    using Settings;
    using Validators;
    using XmlDocumentation;

    public class ApiSpecFeature : IPlugin
    {
        private readonly ILog log = LogManager.GetLogger(typeof (ApiSpecFeature));
        private static readonly ApiSpecConfigValidator ConfigValidator = new ApiSpecConfigValidator();

        private readonly ApiSpecConfig config;

        public ApiDocumentation Documentation { get; private set; }
        public IApiDocumentationGenerator DocumentationGenerator { get; private set; }
        public Func<IEnumerable<IApiResourceEnricher>> Enrichers { get; private set; }

        // NOTE Similar to what's in NativeTypesFeature - use that if present?
        public static List<string> IgnoreTypesInNamespaces = new List<string>
        {
            "ServiceStack",
            "ServiceStack.Auth",
            "ServiceStack.Caching",
            "ServiceStack.Configuration",
            "ServiceStack.Data",
            "ServiceStack.IO",
            "ServiceStack.Logging",
            "ServiceStack.Messaging",
            "ServiceStack.Model",
            "ServiceStack.Redis",
            "ServiceStack.Web",
            "ServiceStack.Admin",
            "ServiceStack.NativeTypes",
            "ServiceStack.Api.Swagger",
            "ServiceStack.Documentation"
        };

        public Func<KeyValuePair<Type, Operation>, bool> OperationsMapFilter { get; private set; } = kvp =>
            !IgnoreTypesInNamespaces.Contains(kvp.Key.Namespace) && 
            !kvp.Key.ExcludesFeature(Feature.Metadata) &&
            !kvp.Key.ExcludesFeature(Feature.ServiceDiscovery);

        // Take object that represents contact details etc
        public ApiSpecFeature(ApiSpecConfig config)
        {
            config.ThrowIfNull(nameof(config));
            ConfigValidator.ValidateAndThrow(config);<commit_msg>Missed reference to old name<commit_after>﻿// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this 
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

namespace ServiceStack.IntroSpec
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Enrichers;
    using Enrichers.Infrastructure;
    using Enrichers.Interfaces;
    using Extensions;
    using FluentValidation;
    using Funq;
    using Host;
    using Logging;
    using Models;
    using Postman.Services;
    using Services;
    using Settings;
    using Validators;
    using XmlDocumentation;

    public class ApiSpecFeature : IPlugin
    {
        private readonly ILog log = LogManager.GetLogger(typeof (ApiSpecFeature));
        private static readonly ApiSpecConfigValidator ConfigValidator = new ApiSpecConfigValidator();

        private readonly ApiSpecConfig config;

        public ApiDocumentation Documentation { get; private set; }
        public IApiDocumentationGenerator DocumentationGenerator { get; private set; }
        public Func<IEnumerable<IApiResourceEnricher>> Enrichers { get; private set; }

        // NOTE Similar to what's in NativeTypesFeature - use that if present?
        public static List<string> IgnoreTypesInNamespaces = new List<string>
        {
            "ServiceStack",
            "ServiceStack.Auth",
            "ServiceStack.Caching",
            "ServiceStack.Configuration",
            "ServiceStack.Data",
            "ServiceStack.IO",
            "ServiceStack.Logging",
            "ServiceStack.Messaging",
            "ServiceStack.Model",
            "ServiceStack.Redis",
            "ServiceStack.Web",
            "ServiceStack.Admin",
            "ServiceStack.NativeTypes",
            "ServiceStack.Api.Swagger",
            "ServiceStack.IntroSpec"
        };

        public Func<KeyValuePair<Type, Operation>, bool> OperationsMapFilter { get; private set; } = kvp =>
            !IgnoreTypesInNamespaces.Contains(kvp.Key.Namespace) && 
            !kvp.Key.ExcludesFeature(Feature.Metadata) &&
            !kvp.Key.ExcludesFeature(Feature.ServiceDiscovery);

        // Take object that represents contact details etc
        public ApiSpecFeature(ApiSpecConfig config)
        {
            config.ThrowIfNull(nameof(config));
            ConfigValidator.ValidateAndThrow(config);
{'fraction_non_alphanumeric': 0.08287179487179487, 'fraction_numerical': 0.001641025641025641, 'mean_word_length': 2.5565280816921954, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5563912', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1252, 'n_words': 333}