Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated docs with Symbolgraph includes internal extensions #1291

Closed
esteluk opened this issue Nov 22, 2021 · 5 comments · Fixed by #1293
Closed

Generated docs with Symbolgraph includes internal extensions #1291

esteluk opened this issue Nov 22, 2021 · 5 comments · Fixed by #1293
Labels

Comments

@esteluk
Copy link
Contributor

esteluk commented Nov 22, 2021

When using Jazzy to generate documentation with --swift-build-tool symbolgraph I'm finding that the output contains a number of extensions to module internal classes.

I can see that the additional symbols are included in the output of swift symbolgraph-extract if I pass in -minimum-access-level private, but excluded (as expected) with -minimum-access-level public.

This is clearly the explicit intended behaviour: https://github.com/realm/jazzy/blob/master/lib/jazzy/symbol_graph.rb#L57-L60 but I'm not sure what the reason behind this was?
If it fits in more broadly, I'd be happy to open a PR with a change that allows the minimum-access-level to be passed in as a build-tool-argument. It seems possible that there might have been a change in behaviour since Swift 5.3 that introduced this issue.

@johnfairh johnfairh added the bug label Nov 22, 2021
@johnfairh
Copy link
Collaborator

Can you add a bit more detail on the code structure that's going wrong for you?

If I do:

class Fred {}

extension Fred {
   func barney() {}
 }

... then I don't see an extension. But If I change Fred to struct then an extension adding a Sendable conformance pops up, which is definitely a bug. Is this the kind of problem you're seeing?

Jazzy is asking symbolgraph for everything it knows, then sorting out and reporting on the ACL implications at its level. I think this was mostly for feature parity with the SourceKit version, and maybe some special case to do with (ironically) protocol conformances.

Debugging, the bug looks to be here where module_name is coming out as something unexpected like /var/folders/8z/q79t2yr53l37ff1vyz082y600000gn/T/d20211122-55582-emwyj0/TestMod -- I don't think Ruby's Dir changed, more likely I just messed this up. If I hack this to be TestMod on master then it works properly.

@esteluk
Copy link
Contributor Author

esteluk commented Nov 23, 2021

I suspect it's similar, the protocol conformances that I'm seeing are all of the form:

extension ViewController : CVarArg, CustomDebugStringConvertible, CustomStringConvertible, Equatable, Hashable, NSCoding, NSExtensionRequestHandling, NSObjectProtocol, ReactiveCompatible, UIActivityItemsConfigurationProviding, UIAppearanceContainer, UIContentContainer, UIFocusEnvironment, UIPasteConfigurationSupporting, UIResponderStandardEditActions, UIStateRestoring, UITextFieldDelegate, UITraitEnvironment, UIUserActivityRestoring

@esteluk
Copy link
Contributor Author

esteluk commented Nov 29, 2021

Thanks for looking into this so quickly!

@stonko1994
Copy link

It looks like this issue is back.

In our use case, we have an internal class where we create an extension with a public protocol. And this extension does show up in the generated documentation (not the class)

Env:

  • jazzy: 0.14.3
  • Xcode: 14.3.1

I'm happy to create a new issue if preferred.

@johnfairh
Copy link
Collaborator

Yes, open a new issue with your example & how you're driving jazzy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants