docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Exclude System.ObsoleteAttribute

Open bouboup opened this issue 9 years ago • 5 comments

Hi,

I wanted to exclude members with [Obsolete] attribute.

Here is my filter config :

apiRules:
- exclude:
    hasAttribute:
      uid: System.ObsoleteAttribute
    type: Member

It's not working, [Obsolete] methode are still in my Api Documentation.

I am missing something ?

Many thanks!

bouboup avatar May 11 '17 16:05 bouboup

@ansyral according to http://dotnet.github.io/docfx/tutorial/howto_filter_out_unwanted_apis_attributes.html, should we use attributeRules instead of apiRules to filter out ObseloteAttribute?

attributeRules:
- exclude:
    uidRegex: System\.ObsoleteAttribute$
    type: Type

hellosnow avatar May 12 '17 01:05 hellosnow

@hellosnow

  • apiRules filters API.
  • attributeRules filters attribute.

I wanted to exclude members with [Obsolete] attribute.

So apiRules is correct.

vwxyzh avatar May 12 '17 02:05 vwxyzh

@vwxyzh yes you're right, I misunderstood the requirement

hellosnow avatar May 12 '17 02:05 hellosnow

@bouboup , I tested locally and cannot repro. Could you give us more info about how you added your filter config? Was it put in the metadata section? And How did your code use Obsolete attribute? Your filter config could only filter apis wrapped by [Obsolote], namely the one with no ctor arguments.

ansyral avatar May 12 '17 02:05 ansyral

I was using [Obsolete] attribute with argument : [Obsolete("Use PublicLiveCommentFactory instead.")]

If i use it with no ctor argument, it's work ! [Obsolete]

Many thanks for your help @ansyral ;)

bouboup avatar May 12 '17 09:05 bouboup