-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Custom namespace filter rules not working anymore #8427
Comments
I think they changed how namespace filters work so one can exclude all child namespaces with a single rule. My guess is that if you change the order of your filter rules and put the rule to include |
@OscarAbraham thanks for feedback. However, I tried reversing the apiRules as you suggested , but it still doesn't work apiRules:
- exclude:
uidRegex: ^ConsoleApp1\.Domain
- include:
uidRegex: ^ConsoleApp1\.Domain\.Models |
@Krusty93 Sorry. I don't know why I thought it'd work. |
No problem In my opinion, this is the line that introduced the bug in PR #8408: public bool IncludeApi(ISymbol symbol)
{
return IsSymbolAccessible(symbol) && IncludeApiCore(symbol);
bool IncludeApiCore(ISymbol symbol)
{
return _cache.GetOrAdd(symbol, _ => _options.IncludeApi?.Invoke(_) switch
{
SymbolIncludeState.Include => true,
SymbolIncludeState.Exclude => false,
_ => IncludeApiDefault(symbol),
});
}
bool IncludeApiDefault(ISymbol symbol)
{
if (_filterRule is not null && !_filterRule.CanVisitApi(RoslynFilterData.GetSymbolFilterData(symbol)))
return false;
return symbol.ContainingSymbol is null || IncludeApiCore(symbol.ContainingSymbol);
}
}
|
I'm encountering the same problem, the include doesn't seem to work at all. |
I just ran into the same issue with DocFx V2.71.0 apiRules:
- include:
uidRegex: ^Company\.Product\.Component\.
#type: Namespace
- exclude:
uidRegex: .*
#type: Namespace I tried it with the |
This issue is expected to be fixed in latest version of docfx. (By #9666) |
Describe the bug
I use DocFx to document a specific namespace in my dotnet project.
To achieve my goal I have a
filterConfig.yml
file where I exclude everything but what I need:But unfortunately, the produced documentation is empty because the last
exclude
rule is removing everything.I cloned the source code to attach the debugger and I saw that the class
SymbolFilter
(methodIncludeApi
) is correctly validating my rules, but then it checks for theContainingSymbol
as well. And being theModels
a child of theDomain
namespace, this obviously breaks my rules invalidating theinclude
one.This didn't happen with the v2.61.0 and according to the documentation this approach shall work.
To Reproduce
Create a dotnet console app
MyApp
and two classes in two different namespaces:Run
docfx init --quiet
Fill the
metadata
property of thedocfx.json
file as follow:And create in the same folder a
filterConfig.yml
file:Run the
serve
command. Generated documentation will be emptyExpected behavior
Generated documentation shall contain documentation for the
ConsoleApp1.Domain.Models
namespace (Class1
).To have a test, perform the same steps as above but with the 2.61.0 version installed.
Context:
OS: Windows
Docfx version: [e.g. 2.62.x]
.NET version: NET 6.0
docfx.json
configAdditional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: