You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YUIDoc doesn't really have a notion of functions/values that aren't associated to a class, and its own notion of modules and namespaces don't align with ES2015 modules. If I were to pass this through the doc parser, I'd wind up with output like this:
Today, yuidoc-to-jsonapi would drop those items on the ground in the conversion, since they don't correspond to a class. Note that, since there is a file associated with each classitem, we can still tell which module they originated from.
In the Ember codebase today, functions like Ember.String.underscore are modeled as being part of a @staticString class, and the doc viewer specially presents static classes as "namespaces" (distinct from the YUIDoc notion of the word). With RFC 176 moving from presenting things like Ember.String.htmlSafe to import { htmlSafe } from '@ember/string', though, this starts to feel less natural.
Meanwhile, in ember-cli-addon-docs we're working on making it as easy as possible for addon authors to set up rich documentation for their projects, and part of that is having an API reference. It doesn't feel ideal to have to propose "invent a name for an invisible static class" as the best practice for documenting ES2015 modules.
Fundamentally it feels like YUIDoc may be missing a primitive here, but the project seems relatively stagnant at this point, so adding new concepts there may or may not be in the cards.
Given all that, I'd love to start a conversation about what the ideal way is to model top-level module items, both from the author's perspective and in terms of how it's represented in the JSON API data.
As a strawman, I could imagine introducing a new file resource type that gathers up the class-less functions and properties in each file as attributes, the same way classes do. Files could also have a classes relationship to link up with everything that is associated with a class.
Suppose I'm writing an ES2015 module with some top level exports. I could (incompletely) document it roughly along these lines:
YUIDoc doesn't really have a notion of functions/values that aren't associated to a class, and its own notion of
modules
andnamespaces
don't align with ES2015 modules. If I were to pass this through the doc parser, I'd wind up with output like this:Today,
yuidoc-to-jsonapi
would drop those items on the ground in the conversion, since they don't correspond to a class. Note that, since there is afile
associated with each classitem, we can still tell which module they originated from.In the Ember codebase today, functions like
Ember.String.underscore
are modeled as being part of a@static
String
class, and the doc viewer specially presents static classes as "namespaces" (distinct from the YUIDoc notion of the word). With RFC 176 moving from presenting things likeEmber.String.htmlSafe
toimport { htmlSafe } from '@ember/string'
, though, this starts to feel less natural.Meanwhile, in ember-cli-addon-docs we're working on making it as easy as possible for addon authors to set up rich documentation for their projects, and part of that is having an API reference. It doesn't feel ideal to have to propose "invent a name for an invisible static class" as the best practice for documenting ES2015 modules.
Fundamentally it feels like YUIDoc may be missing a primitive here, but the project seems relatively stagnant at this point, so adding new concepts there may or may not be in the cards.
Given all that, I'd love to start a conversation about what the ideal way is to model top-level module items, both from the author's perspective and in terms of how it's represented in the JSON API data.
/cc @sivakumar-kailasam
The text was updated successfully, but these errors were encountered: