private static void AddVersions(VersionInfoBuilder versionInfoBuilder)
        {
            var versionsAvaliable = GetVersionsAvaliable();

            foreach (var version in versionsAvaliable)
            {
                versionInfoBuilder.Version(version, $"{ApiName} {version}");
            }
        }
Пример #2
0
 public SwaggerDocsConfig()
 {
     this._versionInfoBuilder             = new VersionInfoBuilder();
     this._securitySchemeBuilders         = (IDictionary <string, SecuritySchemeBuilder>) new Dictionary <string, SecuritySchemeBuilder>();
     this._prettyPrint                    = false;
     this._ignoreObsoleteActions          = false;
     this._customSchemaMappings           = (IDictionary <Type, Func <Schema> >) new Dictionary <Type, Func <Schema> >();
     this._schemaFilters                  = (IList <Func <ISchemaFilter> >) new List <Func <ISchemaFilter> >();
     this._modelFilters                   = (IList <Func <IModelFilter> >) new List <Func <IModelFilter> >();
     this._ignoreObsoleteProperties       = false;
     this._describeAllEnumsAsStrings      = false;
     this._describeStringEnumsInCamelCase = false;
     this._applyFiltersToAllSchemas       = false;
     this._operationFilters               = (IList <Func <IOperationFilter> >) new List <Func <IOperationFilter> >();
     this._documentFilters                = (IList <Func <IDocumentFilter> >) new List <Func <IDocumentFilter> >();
     this._xmlDocFactories                = (IList <Func <XPathDocument> >) new List <Func <XPathDocument> >();
     this._rootUrlResolver                = new Func <HttpRequestMessage, string>(SwaggerDocsConfig.DefaultRootUrlResolver);
     this.SchemaFilter <ApplySwaggerSchemaFilterAttributes>();
     this.OperationFilter <HandleFromUriParams>();
     this.OperationFilter <ApplySwaggerOperationAttributes>();
     this.OperationFilter <ApplySwaggerResponseAttributes>();
     this.OperationFilter <ApplySwaggerOperationFilterAttributes>();
 }
Пример #3
0
        public SwaggerDocsConfig()
        {
            _versionInfoBuilder             = new VersionInfoBuilder();
            _securitySchemeBuilders         = new Dictionary <string, SecuritySchemeBuilder>();
            _prettyPrint                    = false;
            _ignoreObsoleteActions          = false;
            _customSchemaMappings           = new Dictionary <Type, Func <Schema> >();
            _schemaFilters                  = new List <Func <ISchemaFilter> >();
            _modelFilters                   = new List <Func <IModelFilter> >();
            _ignoreObsoleteProperties       = false;
            _describeAllEnumsAsStrings      = false;
            _describeStringEnumsInCamelCase = false;
            _operationFilters               = new List <Func <IOperationFilter> >();
            _documentFilters                = new List <Func <IDocumentFilter> >();
            _rootUrlResolver                = DefaultRootUrlResolver;

            SchemaFilter <ApplySwaggerSchemaFilterAttributes>();

            OperationFilter <HandleFromUriParams>();
            OperationFilter <ApplySwaggerOperationAttributes>();
            OperationFilter <ApplySwaggerResponseAttributes>();
            OperationFilter <ApplySwaggerOperationFilterAttributes>();
        }
Пример #4
0
 public InfoBuilder SingleApiVersion(string version, string title)
 {
     _versionSupportResolver = null;
     _versionInfoBuilder     = new VersionInfoBuilder();
     return(_versionInfoBuilder.Version(version, title));
 }
Пример #5
0
 public InfoBuilder SingleApiVersion(string version, string title)
 {
     this._versionSupportResolver = (Func <ApiDescription, string, bool>)null;
     this._versionInfoBuilder     = new VersionInfoBuilder();
     return(this._versionInfoBuilder.Version(version, title));
 }
Пример #6
0
 public void MultipleApiVersions(Func <ApiDescription, string, bool> versionSupportResolver, Action <VersionInfoBuilder> configure)
 {
     _versionSupportResolver = versionSupportResolver;
     _versionInfoBuilder     = new VersionInfoBuilder();
     configure(_versionInfoBuilder);
 }