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

In Flutter docs, classes are listed multiple times #1158

Closed
Hixie opened this issue May 4, 2016 · 8 comments
Closed

In Flutter docs, classes are listed multiple times #1158

Hixie opened this issue May 4, 2016 · 8 comments
Labels
customer-flutter Issues originating from important to Flutter P1 A high priority bug; for example, a single project is unusable or has many test failures type-enhancement A request for a change that isn't a bug

Comments

@Hixie
Copy link
Contributor

Hixie commented May 4, 2016

When a library exports another library, but both libraries are being docced together, the result is that each class that is exported by both libraries is listed twice.

We should only list classes as coming from the package that they actually come from, and not mention them in packages that re-export them, if we are including that package in the docs.

See also:

cc @devoncarew

@devoncarew devoncarew added the customer-flutter Issues originating from important to Flutter label May 4, 2016
@devoncarew
Copy link
Member

also adding @keertip

@Hixie Hixie added type-enhancement A request for a change that isn't a bug P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jun 16, 2016
@keertip keertip modified the milestone: hackathon Jul 20, 2016
@abarth
Copy link
Contributor

abarth commented Oct 18, 2016

As an example, the BoxDecoration class has four different URLs:

https://docs.flutter.io/flutter/painting/BoxDecoration-class.html
https://docs.flutter.io/flutter/rendering/BoxDecoration-class.html
https://docs.flutter.io/flutter/widgets/BoxDecoration-class.html
https://docs.flutter.io/flutter/material/BoxDecoration-class.html

It's not obvious that these are the same class. If there was a canonical URL that all the re-exports linked to, that would make that much clearer.

@Hixie Hixie added P0 A serious issue requiring immediate resolution and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Oct 18, 2016
@sethladd sethladd added P1 A high priority bug; for example, a single project is unusable or has many test failures and removed P0 A serious issue requiring immediate resolution labels Nov 21, 2016
@astashov
Copy link
Contributor

astashov commented Jan 4, 2017

I will look at it.

@astashov
Copy link
Contributor

astashov commented Jan 4, 2017

We should only list classes as coming from the package that they actually come from, and not mention them in packages that re-export them, if we are including that package in the docs.

Hmm, how do we know what's the "canonical" library? I.e. library foo and library bar both export lib/src/blah.dart with foobar function, what library docs will contain that foobar function? foo or bar?

It's not obvious that these are the same class. If there was a canonical URL that all the re-exports linked to, that would make that much clearer.

Yeah, we can do that, the question is - how do we know which one is canonical? Just the first one encountered during parsing?

@abarth
Copy link
Contributor

abarth commented Jan 4, 2017

That isn't what's happening here. What's happening here is:

  1. A defines Foo.
  2. Foo doesn't appear in the docs for A because A is a private library, i.e., in lib/src/../a.dart
  3. B exports Foo from A.
  4. Foo appears in the docs for B.
  5. C exports Foo from B.
  6. Foo appears in the docs for C.

The issue is at step (6) above. Specifically, Foo shouldn't appear in the docs for C (or at least should be de-emphasized in some way) because Foo was exported from B and B already has docs.

@astashov
Copy link
Contributor

astashov commented Jan 4, 2017

Aha, I see, thanks.

@keertip
Copy link
Collaborator

keertip commented Jan 4, 2017

From the example above, since C does export Foo, Foo will appear in the docs for C, and that's the way it should be, as Foo is now part of the public api for C. The issue here is that Foo is defined in B, so maybe we can we have some indication that Foo is from B, or as abarth@ mentioned, de-emphasize it in the UI.

@Hixie
Copy link
Contributor Author

Hixie commented Jan 4, 2017

For Flutter, what we want is that Foo is hidden (or at least dramatically de-emphasised, including not appearing in the search and not having its own page) from the public API of C in the docs. It's fine if the docs for it in the context of B say that they're also exported from C.

astashov added a commit to astashov/dartdoc that referenced this issue Jan 8, 2017
@Hixie noticed, that when a library exports another library, but both
libraries are being docced together, the result is that each class that
is exported by both libraries is listed twice.

We should still list classes and other symbols in the libraries that
reexport them (since they still part of public API of those libs), but
we only gonna show "canonical" symbols in Search, and also we won't
create duplicate HTML pages for reexported symbols.

We define the reexported symbols in the following way:

1. A defines Foo.
2. Foo doesn't appear in the docs for A because A is a private library,
   i.e., in lib/src/../a.dart
3. B exports Foo from A.
4. Foo appears in the docs for B.
5. C exports Foo from B.
6. Foo appears in the docs for C.

So, Foo of lib C shouldn't have its own page and also shouldn't appear
in Search, because Foo was exported from B and B already has docs. All
links to Foo from HTML docs of C should point to the Foo of B.

To solve that, we build directed "export graph", where we track what
libs export what libs. Then, to find the "canonical" lib, we go up the
graph until we find first documented lib - that's going to be the
canonical one.

Then, we filter out non-canonical libs when building the search index,
and also use canonical lib in `.href` getters, this way ensuring we
always link to symbols in canonical libs and don't create HTML files for
symbols from non-canonical libs.

Testing: Unit tests, also built test docs (`testing/test_package_docs`),
made sure we don't create files for non-canonical stuff (i.e. we create
`fake/Cool` files, but not `ex/Cool`). Also, built Flutter docs, ensured
we don't create `material/BoxDecoration`, `rendering/BoxDecoration` and
`widgets/BoxDecoration`, and only create `painting/BoxDecoration` files,
and all the links point to `painting/BoxDecoration`.
astashov added a commit to astashov/dartdoc that referenced this issue Jan 9, 2017
@Hixie noticed, that when a library exports another library, but both
libraries are being docced together, the result is that each class that
is exported by both libraries is listed twice.

We should still list classes and other symbols in the libraries that
reexport them (since they still part of public API of those libs), but
we only gonna show "canonical" symbols in Search, and also we won't
create duplicate HTML pages for reexported symbols.

We define the reexported symbols in the following way:

1. A defines Foo.
2. Foo doesn't appear in the docs for A because A is a private library,
   i.e., in lib/src/../a.dart
3. B exports Foo from A.
4. Foo appears in the docs for B.
5. C exports Foo from B.
6. Foo appears in the docs for C.

So, Foo of lib C shouldn't have its own page and also shouldn't appear
in Search, because Foo was exported from B and B already has docs. All
links to Foo from HTML docs of C should point to the Foo of B.

To solve that, we build directed "export graph", where we track what
libs export what libs. Then, to find the "canonical" lib, we go up the
graph until we find first documented lib - that's going to be the
canonical one.

Then, we filter out non-canonical libs when building the search index,
and also use canonical lib in `.href` getters, this way ensuring we
always link to symbols in canonical libs and don't create HTML files for
symbols from non-canonical libs.

Testing: Unit tests, also built test docs (`testing/test_package_docs`),
made sure we don't create files for non-canonical stuff (i.e. we create
`fake/Cool` files, but not `ex/Cool`). Also, built Flutter docs, ensured
we don't create `material/BoxDecoration`, `rendering/BoxDecoration` and
`widgets/BoxDecoration`, and only create `painting/BoxDecoration` files,
and all the links point to `painting/BoxDecoration`.
astashov added a commit to astashov/dartdoc that referenced this issue Jan 9, 2017
@Hixie noticed, that when a library exports another library, but both
libraries are being docced together, the result is that each class that
is exported by both libraries is listed twice.

We should still list classes and other symbols in the libraries that
reexport them (since they still part of public API of those libs), but
we only gonna show "canonical" symbols in Search, and also we won't
create duplicate HTML pages for reexported symbols.

We define the reexported symbols in the following way:

1. A defines Foo.
2. Foo doesn't appear in the docs for A because A is a private library,
   i.e., in lib/src/../a.dart
3. B exports Foo from A.
4. Foo appears in the docs for B.
5. C exports Foo from B.
6. Foo appears in the docs for C.

So, Foo of lib C shouldn't have its own page and also shouldn't appear
in Search, because Foo was exported from B and B already has docs. All
links to Foo from HTML docs of C should point to the Foo of B.

To solve that, we build directed "export graph", where we track what
libs export what libs. Then, to find the "canonical" lib, we go up the
graph until we find first documented lib - that's going to be the
canonical one.

Then, we filter out non-canonical libs when building the search index,
and also use canonical lib in `.href` getters, this way ensuring we
always link to symbols in canonical libs and don't create HTML files for
symbols from non-canonical libs.

Testing: Unit tests, also built test docs (`testing/test_package_docs`),
made sure we don't create files for non-canonical stuff (i.e. we create
`fake/Cool` files, but not `ex/Cool`). Also, built Flutter docs, ensured
we don't create `material/BoxDecoration`, `rendering/BoxDecoration` and
`widgets/BoxDecoration`, and only create `painting/BoxDecoration` files,
and all the links point to `painting/BoxDecoration`.
keertip pushed a commit that referenced this issue Jan 10, 2017
* Deemphasize reexported symbols [#1158]

@Hixie noticed, that when a library exports another library, but both
libraries are being docced together, the result is that each class that
is exported by both libraries is listed twice.

We should still list classes and other symbols in the libraries that
reexport them (since they still part of public API of those libs), but
we only gonna show "canonical" symbols in Search, and also we won't
create duplicate HTML pages for reexported symbols.

We define the reexported symbols in the following way:

1. A defines Foo.
2. Foo doesn't appear in the docs for A because A is a private library,
   i.e., in lib/src/../a.dart
3. B exports Foo from A.
4. Foo appears in the docs for B.
5. C exports Foo from B.
6. Foo appears in the docs for C.

So, Foo of lib C shouldn't have its own page and also shouldn't appear
in Search, because Foo was exported from B and B already has docs. All
links to Foo from HTML docs of C should point to the Foo of B.

To solve that, we build directed "export graph", where we track what
libs export what libs. Then, to find the "canonical" lib, we go up the
graph until we find first documented lib - that's going to be the
canonical one.

Then, we filter out non-canonical libs when building the search index,
and also use canonical lib in `.href` getters, this way ensuring we
always link to symbols in canonical libs and don't create HTML files for
symbols from non-canonical libs.

Testing: Unit tests, also built test docs (`testing/test_package_docs`),
made sure we don't create files for non-canonical stuff (i.e. we create
`fake/Cool` files, but not `ex/Cool`). Also, built Flutter docs, ensured
we don't create `material/BoxDecoration`, `rendering/BoxDecoration` and
`widgets/BoxDecoration`, and only create `painting/BoxDecoration` files,
and all the links point to `painting/BoxDecoration`.

* Add some docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-flutter Issues originating from important to Flutter P1 A high priority bug; for example, a single project is unusable or has many test failures type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants