Closed Bug 566714 Opened 14 years ago Closed 14 years ago

update api-utils.md to apidocs format

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: fiveinchpixie, Assigned: fiveinchpixie)

Details

Attachments

(1 file, 2 obsolete files)

currently in simple markdown format, moving to apidocs format.
Comment on attachment 446066 [details] [diff] [review]
api utils doc to apidocs format 

Myk, can you make sure that I did the patch process correctly before I have Drew review it?
Attachment #446066 - Flags: review?(myk)
Comment on attachment 446066 [details] [diff] [review]
api utils doc to apidocs format 

In the spirit of pitching in with reviews as mentioned in today's meeting, I can look at this.
Attachment #446066 - Flags: review?(myk) → review?(adw)
Comment on attachment 446066 [details] [diff] [review]
api utils doc to apidocs format 

Thanks Noelle, this looks good, just a few things.

>+<!-- contributed by Drew Willcoxon [adw@mozilla.com]  -->
>+<!-- edited by Noelle Murata [fiveinchpixie@gmail.com]  -->
> The `api-utils` module provides some helpers useful to Jetpack's high-level API

Please add a blank line between the comments and this first sentence to increase readability.

>+<api name="publicConstructor">
>+@method
>+Returns a function C that creates an instance of `privateCtor`. *C*

C is emphasized with asterisks (e.g., *C*, like the second use in this sentence and elsewhere), so the first use in this sentence also needs asterisks.

>+@param [options] {object} The options dictionary to validate.  It's not 
>+modified. If it's null or otherwise falsey, an empty object is assumed.
>+@param [requirements] {object} An object whose keys are the expected keys in 
>+*`options`*. Any key in *`options`* that is not present in *`requirements`* is 
>+ignored.  Each value in *`requirements`* is itself an object describing the 
>+requirements of its key.
>+@prop [map] {function} A function that's passed the value of the key in the 
>+*`options`*. `map`'s return value is taken as the key's value in the final 
>+validated options, `is`, and `ok`. If `map` throws an exception it is caught and 
>+discarded, and the key's value is it's value in `options`.

it's -> its

>+@prop [is] {array} An array containing the number of `typeof` type names. If the 
>+key's value is none of these types it fails validation. Arrays and nulls are 
>+identified by the special type names "array" and "null"; "object" will not match 
>+either. No type coercion is done.
>+@prop [ok] {function} A function that is passed the key's value. If it returns 
>+false, the value fails validation.
>+@prop [msg] {string} If the key's value fails validation, an exception is
>+thrown. This string will be used as it's message. If undefined, a generic

it's -> its

>+message is used, unless `is` is defined, in which case the message will state
>+that the value needs to be one of the given types. 
>+</api>

It's difficult to read these lines in the markdown.  Since there's no spacing or indentation, they all kind of run together.  Could you come up with a nice way of making this kind of text more readable?

Nit: Many of the lines have an unnecessary space at the end of them.  It's not a big deal, but could you remove those spaces if possible?
Attachment #446066 - Flags: review?(adw) → review-
Attached patch with requested fixes per adw (obsolete) — Splinter Review
Attachment #446066 - Attachment is obsolete: true
Attachment #446105 - Flags: review?(adw)
This looks good, thanks.  One thing I just noticed that I should have mentioned before is, with these changes it's no longer clear that the @props of the requirements object are all optional.  (It's also no longer clear that the @props are @props at all, or how they are connected to the requirements object.  But that's probably more of a problem with the stylesheet.  Or maybe the type of requirements param should be {options dictionary} or something.  What do you think?)

So, this patch should be updated to make it clear that the @props are optional.  I can make the change if you want, or you can attach a new patch, let me know.
Basically, the difference is really subtle. Required @params are indicated in the apidocs format as being contained by square brackets and displayed as italic text. We can revisit the style sheet at another point. I'll file a bug.
Attachment #446105 - Attachment is obsolete: true
Attachment #446127 - Flags: review?(adw)
Attachment #446105 - Flags: review?(adw)
Comment on attachment 446127 [details] [diff] [review]
with requested fixes per adw

Thanks Noelle.  Actually `requirements` is a required param, just its props aren't.  I'll go ahead and add brackets around it since it's a small change and push your patch.

(In reply to comment #7)
> Basically, the difference is really subtle. Required @params are indicated in
> the apidocs format as being contained by square brackets and displayed as
> italic text. We can revisit the style sheet at another point. I'll file a bug.

Yeah, that's subtle.  You're probably already planning for it, but a "conventions used in these docs" page would be really helpful -- once all docs are following some conventions of course. :)  Or in this case maybe just tiny "Optional" text next to the names.  Also, just offering this as some feedback, but in other contexts where brackets are used to indicate that something is required or not (e.g., command-line programs), they usually indicate *not*, i.e., that whatever they contain is optional.  (That might be a point I should raise with Brian I guess, since he wrote the doc parser?)
Attachment #446127 - Flags: review?(adw) → review+
Pushed: http://hg.mozilla.org/labs/jetpack-sdk/rev/09fb4f0aed00
Status: NEW → RESOLVED
Closed: 14 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: -- → 0.4
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: