docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Include only APIs that match the hasAttribute property in filter. Exclude all the rest of APIs

Open chaitanyamalik opened this issue 2 years ago • 2 comments

Operating System: Windows

DocFX Version Used: 2.59.3.0

Template used: default

Steps to Reproduce:

  1. Initiate docfx in code using docfx init -q --apiGlobPattern spec/**.csproj --apiSourceFolder .. -o unitTests
  2. 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: image

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..

chaitanyamalik avatar Aug 29 '22 06:08 chaitanyamalik

With disableDefaultFilter set to false, you are really not in control here.

paulushub avatar Aug 29 '22 07:08 paulushub

With disableDefaultFilter set to false, 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

chaitanyamalik avatar Aug 29 '22 09:08 chaitanyamalik

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.

mahenry00 avatar Jan 11 '23 23:01 mahenry00