This page gives the specifications for documenting your code, so that it is compatible with our API Description Generator.
The docstring for each method-less class should be formatted as follows:
def class:
"""
Class description line1
[Class description line2]
Attributes:
name: type: [description]
name: type: [description]
"""
Everything in square brackets is optional.
The docstring for each http method should be formatted as follows:
def httpMethod:
"""
Description line1
[Description line2]
Args:
name: type: [description]
name: type: [description]
Bindings:
name: type: description: binding type
name: type: description: binding type
Returns:
name: type: [description]
Exceptions:
errorcode1: [cause]
errorcode2: [cause]
"""
Note the following:
Again, everything in square brackets is optional.
Note: The category labels (Args, Bindings, Returns, and Exceptions) are mandatory. Please ensure they are given as shown above, even if the category is not applicable.
Optional: Bindings and exceptions can be left blank if desired.
For an example of docstring format see the sample application at https://github.com/chatkeon/cs263.
An API description is valid if it satisfies the following conditions:
Note: The above conditions allow for many information (fields) to be left out from an API specification. For instance all the description fields, error fields, and header fields can be left out. Also all the non-functional fields such as license, community and tags can be left out from an API specification. [1]
The following are the valid primitive data types:
In addition to these, any instances of defined classes are considered to be valid. All other data types will invalidate the API description.
Based on the above specifications for a valid API description the following errors will be detected and displayed:
The first two errors listed above probably indicate that you have not clicked through all the possible paths in your app.
Footnotes
[1] | Hiranya Jayathilaka, RACE Lab, Department of Computer Science, UCSB - API Validation guidelines |