DocC and @_exported

With latest on main it appears that symbols from other modules that are exported using @_exported are now appearing in the documentation for a module. Is this an intentional change? I guess it kind of makes sense.

I am not using the docc command plugin as I want documentation for multiple targets. My workflow consists of running

swift build \
    -Xswiftc -emit-symbol-graph \
    -Xswiftc -emit-symbol-graph-dir -Xswiftc $SG_FOLDER

Then copying the symbol graph files for the modules I want to document into a separate folder $MY_SG_FOLDER and then running

docc convert MyDocs.docc \
    --additional-symbol-graph-dir $MY_SG_FOLDER \
    etc

Yes, this is intentional, because the exported symbols are part of the module's interface. This change has been present since Swift 5.7.

There's been discussion here regarding adding a way to filter these out, so if you're interested in that, I'd suggest continuing the conversation there.

1 Like

It makes sense. Will possibly push some library authors to be a little less generous with the symbols they export which is probably a good thing. Documentation is always a good way to find issues in your public APIs. I found I was exporting a whole NIO module through this.

No I'm happy with the status quo.

5 Likes