@@ -11,28 +11,35 @@ public class OpenApiEnvironment
11
11
{
12
12
public string Version { get ; }
13
13
public string PathToXmlDocumentationFile { get ; private set ; }
14
- public Dictionary < string , OpenApiInfo > OpenApiGroups { get ; }
14
+ public Dictionary < string , OpenApiConfig > OpenApiGroups { get ; }
15
15
public bool RemoveDtoSuffix { get ; }
16
16
public List < Action < SwaggerGenOptions > > SwaggerGenOptions { get ; }
17
17
18
18
public OpenApiEnvironment ( string version , string pathToXmlDocumentationFile )
19
19
{
20
20
Version = version ;
21
21
PathToXmlDocumentationFile = pathToXmlDocumentationFile ;
22
- OpenApiGroups = new Dictionary < string , OpenApiInfo > ( ) ;
22
+ OpenApiGroups = new Dictionary < string , OpenApiConfig > ( ) ;
23
23
RemoveDtoSuffix = true ;
24
24
SwaggerGenOptions = new List < Action < SwaggerGenOptions > > { x => x . SupportNonNullableReferenceTypes ( ) } ;
25
25
}
26
26
27
- public OpenApiEnvironment WithApiGroup ( string name , string title , string description )
27
+ /// <summary>
28
+ /// Adds a new API group to the OpenAPI specification.
29
+ /// </summary>
30
+ /// <param name="name">Name of the OpenAPI spec file (no special chars)</param>
31
+ /// <param name="title">Title of the OpenAPI spec.</param>
32
+ /// <param name="description">Description of the OpenAPI spec.</param>
33
+ /// <param name="publish">Publish OpenAPI specification to the UI.</param>
34
+ public OpenApiEnvironment WithApiGroup ( string name , string title , string description , bool publish = true )
28
35
{
29
36
var info = new OpenApiInfo
30
37
{
31
38
Title = title ,
32
39
Version = Version ,
33
40
Description = description
34
41
} ;
35
- OpenApiGroups . Add ( name , info ) ;
42
+ OpenApiGroups . Add ( name , new OpenApiConfig ( info , publish ) ) ;
36
43
SwaggerGenOptions . Add ( c => c . AddDefaults ( name , info , PathToXmlDocumentationFile , RemoveDtoSuffix ) ) ;
37
44
return this ;
38
45
}
0 commit comments