I’ve had a bit of think about this, and looked back at how I handled dictionaries when I was doing a load of API docs. I think having them on a separate page makes sense for sure if you need to reference them from multiple documents.
BUT …
I think we need to weigh up “absolute correctness” versus ease of use of the documentation.
For example, take my doc on the Fetch API Request interface constructor:
https://developer.mozilla.org/en-US/docs/Web/API/Request/Request
This lists the optional init object as being an object containing options you may want to pass when creating this object instance. The examples section below it shows an explicit usage example to make it absolutely clear how to use this.
But I don’t mention that it is a RequestInit dictionary, as I don’t think many developers need this level of explicit detail thrown at them. If developers really want to know exactly what type of init object it is, they can go to the spec link (
https://fetch.spec.whatwg.org/#dom-request), then look up the RequestInit link in the WebIDL (
https://fetch.spec.whatwg.org/#requestinit)
But I don’t think most developers want or need this.
If I did add this level of detail to my Request doc, then I’d have to create another 12 pages of documentation just for this dictionary, and then every time a reader wanted to look up how to write one of these dictionary objects, they’d have to do an extra navigation to the dictionary page, and then an extra navigation to each of the object property pages.
Which seems like a step too far to me, just to look up details on a constructor parameter.
Having an extra page for the dictionary object makes perfect sense when it is used in multiple places — repeating that information multiple times would make no sense. But in cases where we have to do this, should we just make dictionary definitions single pages containing all the property info?
Have I got a point here, or am I just being a slacker? I’m not sure ;-)
Chris Mills
Senior tech writer || Mozilla
developer.mozilla.org || MDN
cmi...@mozilla.com || @chrisdavidmills
> _______________________________________________
> dev-mdc mailing list
>
dev...@lists.mozilla.org
>
https://lists.mozilla.org/listinfo/dev-mdc
> MDN contributor guide:
http://bit.ly/ContributorGuide
> Doc project Trello board:
https://trello.com/b/HAhl54zz/status