docfx
docfx copied to clipboard
Include only APIs that match the hasAttribute property in filter. Exclude all the rest of APIs
Operating System: Windows
DocFX Version Used: 2.59.3.0
Template used: default
Steps to Reproduce:
- Initiate docfx in code using
docfx init -q --apiGlobPattern spec/**.csproj --apiSourceFolder .. -o unitTests - Change directory to unitTests and generate metadata using
docfx metadata --filter filter-config.yml
docfx.json:
{ "metadata": [ { "src": [ { "files": [ "spec/**.csproj" ], "src": ".." } ], "dest": "api", "disableGitFeatures": false, "disableDefaultFilter": false } ], "build": { "content": [ { "files": [ "api/**.yml", "api/index.md" ] }, { "files": [ "articles/**.md", "articles/**/toc.yml", "toc.yml", "*.md" ] } ], "resource": [ { "files": [ "images/**" ] } ], "overwrite": [ { "files": [ "apidoc/**.md" ], "exclude": [ "obj/**", "_site/**" ] } ], "dest": "_site", "globalMetadataFiles": [], "fileMetadataFiles": [], "template": [ "default" ], "postProcessors": [], "markdownEngineName": "markdig", "noLangKeyword": false, "keepFileLink": false, "cleanupCacheHistory": false, "disableGitFeatures": false } }
filter-config.yml:

Expected Behavior: It should only include the APIs which have an Attribute of Xunit.FactAttribute or Xunit.TheoryAttribute and remove the rest.
Actual Behavior:
It generates metadata for all the APIs "including" Fact and Theory Attribute, but not excluding the rest.
When replacing the include with exclude, it does what it's supposed to do, and removes all APIs with Fact or Theory attribute.
I've also tried putting this at the end of the includes but it doesn't work..
-exclude: uidRegex: .*
This just removes everything..
With disableDefaultFilter set to false, you are really not in control here.
With
disableDefaultFilterset tofalse, you are really not in control here.
I've set it to true now. But still it doesn't exclude the rest. Even adds a bit more redundant APIs
I've run into this same problem trying to do the same thing - explicitly control what APIs are included via an attribute. Near as I can tell, the hasAttribute option is ignored on includes.