Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from ApiApprover/options
Introduce Options to configure the generator
- Loading branch information
Showing
21 changed files
with
230 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
|
||
namespace PublicApiGenerator | ||
{ | ||
/// <summary> | ||
/// Options to influence the ApiGenerator | ||
/// </summary> | ||
public class ApiGeneratorOptions | ||
{ | ||
/// <summary> | ||
/// Allows to control which types of the generated assembly should be included. If this option is specified all other types found in the assembly that are not present here will be exclude. | ||
/// </summary> | ||
public Type[]? IncludeTypes { get; set; } | ||
|
||
/// <summary> | ||
/// Instructs the generator to include assembly level attributes. | ||
/// </summary> | ||
/// <remarks>Defaults to true</remarks> | ||
public bool IncludeAssemblyAttributes { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Allows to whitelist certain namespace prefixes. For example by default types found in Microsoft or System namespaces are not treated as part of the public API. | ||
/// </summary> | ||
/// <example> | ||
/// <code> | ||
/// var options = new DefaultApiGeneratorOptions | ||
/// { | ||
/// WhitelistedNamespacePrefixes = new[] {"Microsoft.Whitelisted" } | ||
/// }; | ||
/// </code> | ||
/// </example> | ||
public string[] WhitelistedNamespacePrefixes { get; set; } = DefaultWhitelistedNamespacePrefixes; | ||
|
||
/// <summary> | ||
/// Allows to exclude attributes by specifying the fullname of the attribute to exclude. | ||
/// </summary> | ||
/// <example> | ||
///<code> | ||
/// var options = new DefaultApiGeneratorOptions | ||
/// { | ||
/// ExcludeAttributes = new[] { "PublicApiGeneratorTests.Examples.SimpleAttribute" } | ||
/// }; | ||
/// </code> | ||
/// </example> | ||
public string[]? ExcludeAttributes { get; set; } | ||
|
||
static readonly string[] DefaultWhitelistedNamespacePrefixes = Array.Empty<string>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using PublicApiGenerator; | ||
|
||
namespace PublicApiGeneratorTests | ||
{ | ||
class DefaultApiGeneratorOptions : ApiGeneratorOptions | ||
{ | ||
public DefaultApiGeneratorOptions() | ||
{ | ||
IncludeAssemblyAttributes = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.