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

Add PHP API documentation to developer manual #578

Merged
merged 10 commits into from
Dec 5, 2017
Merged

Add PHP API documentation to developer manual #578

merged 10 commits into from
Dec 5, 2017

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Oct 18, 2017

This is the first step for #509 to add a API reference to the developer manual.

For the purpose i've written a small tool called phpdoc-to-rst that will generate sphinxcontrib-phpdomain based rst files out phpDoc annotated source code.

Here is a preview of the current state:
https://bitgrid.net/~jus/nextcloud-api/com/api.html

New features:

  • References to classes/methods/... are possible from within our developer manual
  • Any element has a link to the source code on github.
  • Each interface also shows a list of classes that implement it. This might be quite useful when you want to check how something is actually implemented.

The current state is that both lib/public/ and lib/private/ are scanned, so we can have nice linking to classes that implement interfaces from the \OCP namespace.

I welcome any feedback, especially in terms of readability.

Todo:

@nickvergessen
Copy link
Member

Looks promising 😎

@juliushaertl
Copy link
Member Author

@nickvergessen Good points. The linking issue might need some fixes in sphinxcontrib-phpdomain. I'll have a look.

Does source always link to master? Or does it link to the respective stable* branch?
Right now, only to master, but of course it should link to the according branch.

@skjnldsv
Copy link
Member

I like it a lot!!!

@juliushaertl
Copy link
Member Author

Deprecation should be more prominent (is there a way to correctly link to another method? example https://bitgrid.net/~jus/nextcloud-api/com/api/OCP/Activity/IManager.html#OCP\Activity\IManager::publishActivity )

I've added styles so that deprecated methods are crossed out. The correct way according to the phpDoc reference is to add a @see tag. That one will be linked automatically. http://docs.phpdoc.org/references/phpdoc/tags/deprecated.html

Multi type definitions are not linked: https://bitgrid.net/~jus/nextcloud-api/com/api/OCP/Activity/IEventMerger.html#OCP\Activity\IEventMerger::mergeEvents

Fixed as well.

Does source always link to master? Or does it link to the respective stable* branch?

The branch can now be specified in build/generateApiDoc.php

The preview URL has been updated as well.

@skjnldsv
Copy link
Member

skjnldsv commented Nov 4, 2017

So, where we at here? :)

@tflidd
Copy link
Contributor

tflidd commented Dec 3, 2017

@nickvergessen can you have a look again?

.drone.yml Outdated
@@ -2,4 +2,5 @@ pipeline:
documentation:
image: nextcloudci/documentation:documentation-4
commands:
- make api-docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best would be to include "api-docs" in "all", because we also use that on our docs system deployment. 😉 Let me have a look into this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even better: Include it in "make dev-html" ;) Then it's just at the right spot.

@MorrisJobke
Copy link
Member

@juliushaertl Any idea regarding this:

PHP Notice:  Undefined index: opts in /drone/src/github.com/nextcloud/documentation/build/vendor/juliushaertl/phpdoc-to-rst/src/Builder/NamespaceIndexBuilder.php on line 171

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@juliushaertl Please have a look at my commit.

@MorrisJobke
Copy link
Member

Should we keep that task as an on-demand step or better check the computed stuff in? (like we do for the config sample as well - see https://github.com/nextcloud/documentation/commits/master/admin_manual/configuration_server/config_sample_php_parameters.rst)

@juliushaertl
Copy link
Member Author

juliushaertl commented Dec 5, 2017

@MorrisJobke The commit looks good.

Should we keep that task as an on-demand step or better check the computed stuff in?

I see no real benefit in committing the computed files. It may lead to some confusion when people start to fix something right in the rst files, which get's overwritten later by the automated documentation generation.

PHP Notice: Undefined index: opts in /drone/src/github.com/nextcloud/documentation/build/vendor/juliushaertl/phpdoc-to-rst/src/Builder/NamespaceIndexBuilder.php on line 171

I'll have a look. juliushaertl/phpdoc-to-rst#13

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants