[
http://opencast.jira.com/browse/MH-6375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=23380#action_23380
]
Kenneth Lui commented on MH-6375:
---------------------------------
Here is how we are doing REST documentation now. I will use the annotation-impl
as an example.
In a very brief sense, every *RestService class has a method called
generateDocs() which return a html string. This method is called when the
service is activated. The result of generateDocs() is stored in a String in
that class and whenever a user goes to "http://something/something/doc" (e.g.
http://localhost:8080/annotation/docs), that String of HTML is returned.
Here are the details, basically the generateDocs() contains all information in
the documentation. Each "documentation page" is represented by a DocRestData
object containing a list of RestEndPoint objects. Each RestEndPoint object
stores information about a REST endpoint such as HTTP method to use, parameters
list, etc. So all the documentation goes here when we instantiate a
RestEndPoint object with these info.
After these instantiate an object for each endpoint. It calls
DocUtil.generate() to get the HTML string. DocUtil contains some methods to
load a template (template.xhtml from
/matterhorn-common/src/main/resources/ui/restdocs) and use that template to
transform our DocRestData object to HTML for our nice docs page.
The inconvenient part of this approach is that the documentation of all
endpoints is located inside of generateDocs() method instead of near the method
serving each endpoint.
p.s.
DocUtil is in org.opencastproject.util
DocRestData, RestEndPoint and other related classes are in
org.opencastproject.util.doc
> Update rest documentation method to be similar to the one in Sakai
> ------------------------------------------------------------------
>
> Key: MH-6375
> URL: http://opencast.jira.com/browse/MH-6375
> Project: Matterhorn Project
> Issue Type: Task
> Components: Architecture & Services
> Affects Versions: 1.2
> Reporter: Christopher Brooks
> Assignee: Kenneth Lui
> Fix For: 1.2
>
>
> The Sakai project uses a system similar to ours for building their rest
> endpoint docs, but they use attributes instead of code. This has some huge
> readability benefits. Check out how they do it and provide an example with
> this ticket, including an example of how we do it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opencast.jira.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
Matterhorn mailing list
[email protected]
http://lists.opencastproject.org/mailman/listinfo/matterhorn
To unsubscribe please email
[email protected]
_______________________________________________