Skip to content
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

API Filtering Yml Cannot Include Specific Namespace #9404

Closed
groogiam opened this issue Nov 8, 2023 · 3 comments · Fixed by #9666
Closed

API Filtering Yml Cannot Include Specific Namespace #9404

groogiam opened this issue Nov 8, 2023 · 3 comments · Fixed by #9666
Labels
bug A bug to fix dotnet: api-filter Filter APIs for .NET API reference docs

Comments

@groogiam
Copy link

groogiam commented Nov 8, 2023

Describe the bug
The api filtering yml mechanism does not allow keeping a specific sub namespace as per https://dotnet.github.io/docfx/docs/dotnet-api-docs.html#filter-by-uid.

To Reproduce
Steps to reproduce the behavior:

The following api rules yml does filters out all items in the MyProject.Server namespace.

apiRules:
- include:
    uidRegex: ^MyProject\.Server\.Config
- exclude:
    uidRegex: ^MyProject\.Server

Expected behavior
Based on the documentation this should generate docs for only MyProject.Server.Config

It seems like the excludes are taking precedence over the includes.

Context (please complete the following information):

  • OS: Windows 10 Pro
  • Docfx version: 2.73.1+1d7b96c23465e14eafbcb0dd765029a87b5312d4
@groogiam groogiam added the bug A bug to fix label Nov 8, 2023
@yufeih yufeih added the dotnet: api-filter Filter APIs for .NET API reference docs label Nov 9, 2023
@groogiam
Copy link
Author

Is there any update on this?

@filzrev
Copy link
Contributor

filzrev commented Jan 24, 2024

It seems to be resolved by adding type: Type restriction to the exclude rule.

apiRules:
- include:
    uidRegex: ^MyProject\.Server\.Config
- exclude:
    uidRegex: ^MyProject\.Server
    type: Type

Background
Filter rules are evaluated by ConfigFilterRule::CanVisitCore method
Based on the order defined at `filterConfig.yml'.

But It also checking symbol.ContainingSymbol recursively

If MyProject\.Server namespace is excluded by filter config without type restriction.
Then IncludeAttributeDefault method return false for symbol that expected to be included.

I thought it need to fix documentation
or need to change type check logics when type is not specified.

@groogiam
Copy link
Author

@filzrev That fixes the issue for me as well. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix dotnet: api-filter Filter APIs for .NET API reference docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants