dotnet / dotnet/docfx

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

Open
#8,150 3 comments 1 reaction 0 assignees View on GitHub
dotnet dotnet: api-filter
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 11m
Merged PRs (30d)
10

Description

**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](https://user-images.githubusercontent.com/46478044/187136935-5934cc72-f1af-455b-8276-c0fabd001949.png)

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.