js-doc-parse icon indicating copy to clipboard operation
js-doc-parse copied to clipboard

property's summary gets assigned to the property's value

Open wkeese opened this issue 12 years ago • 4 comments

dijit/form/TextBox's module level summary is:

var TextBox = declare("dijit.form.TextBox", [_FormValueWidget, _TextBoxMixin], {
    // summary:
    //      A base class for textbox form inputs

However, it's appearing in the API viewer (and presumably the details.xml) as the summary from a property of InlineEditBox whose value is TextBox:

    // editor: String|Function
    //      MID (ex: "dijit/form/TextBox") or constructor for editor widget
    editor: TextBox,

wkeese avatar Jul 11 '12 13:07 wkeese

i just came across this same issue... when generateMetaData handles 'Property' types, if the property happens to be for a value that already has metatdata then we mixin/override the summary of the existing metadata with the one from the property.

as an example, the following snippet wrongly redefines the summary for SimpleQueryEngine because the value is a reference to SimpleQueryEngine.

// queryEngine: Function
//      Defines the query engine to use for querying the data store
queryEngine: SimpleQueryEngine,

i traced it to propertyValue = read(property.value); which will return a reference to the SimpleQueryEngine value that then gets passed to generateMetadata which then updates the summary. i wonder if it would hurt anything if we changed it to propertyValue = read(property.value, { asIdentifier: true });.

neonstalwart avatar Mar 24 '13 05:03 neonstalwart

i wonder if it would hurt anything if we changed it to propertyValue = read(property.value, { asIdentifier: true });.

it does hurt... very badly - so that might not be the answer :smiley:

neonstalwart avatar Mar 24 '13 05:03 neonstalwart

by default, a property's metadata is a copy of the value's metadata but in generateMetadata we have enough context to know when a property's metadata should override the value's metadata. so that's what i've done with #84.

@wkeese this really makes a big difference to dojo's docs - you might want to try it out. i think you'll like it :smiley:

neonstalwart avatar Mar 24 '13 19:03 neonstalwart

@neonstalwart Yes I'd love to integrate all your fixes, that's why I'm disappointed that you're working against csnover's branch and forcing me to merge.

wkeese avatar Mar 25 '13 00:03 wkeese