/// <summary> /// Add a new swagger document based on a subscope of the existing api. /// </summary> /// <param name="options">The options to confugure</param> /// <param name="settings"></param> /// <param name="scopeOrGroup">The url segment that the schild scope will live under</param> /// <param name="description"></param> public static OpenApiInfo AddDoc(this SwaggerGenOptions options, GeneralSettings settings, string scopeOrGroup, string description) { var apiSettings = settings?.Api ?? new ApiSettings(); var version = $"v{apiSettings.DefaultVersion}"; var scope = scopeOrGroup; var license = apiSettings.License == null ? null : new OpenApiLicense { Name = apiSettings.License.Name, Url = new Uri(apiSettings.License.Url) }; var contact = apiSettings.Contact == null ? null : new OpenApiContact { Name = apiSettings.Contact.Name, Url = new Uri(apiSettings.Contact.Url), Email = apiSettings.Contact.Email }; var title = $"{apiSettings.FriendlyName}. {scopeOrGroup}"; apiSettings.Scopes.TryGetValue(scopeOrGroup, out title); return(options.AddDoc(scope, title, description, version, apiSettings.TermsOfServiceUrl, license, contact)); }