[TIMOB-7419] Tooling: docgen.py Add support for inheriting individual fields from parent
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-06-15T09:42:14.000+0000 |
Affected Version/s | Release 2.0.1 |
Fix Version/s | Release 2.1.0, Sprint 2012-12 Core |
Components | Tooling |
Labels | core |
Reporter | Arthur Evans |
Assignee | Bill Dawson |
Created | 2012-01-26T09:03:27.000+0000 |
Updated | 2012-06-15T16:19:44.000+0000 |
Description
This is a feature request that came up during documentation work.
When overriding a method in an inherited object, we currently need to recreate the entire method description in order to update a single field. It would be helpful to be able to inherit these descriptions. Something like:
- name: someMethod
summary: @inherit
description: |
Makes the view rotate 360 degrees then turn purple.
parameters: @inherit
returns: true
Or alternately:
- name: someMethod
inherit-docs: true
description: |
Makes the view rotate 360 degrees then turn purple.
This would be a time-saver and prevent some copy & paste errors, but it doesn't give us anything we can't do today, so not a top priority.
We need this for events and properties too.
Do you guys think we even need special syntax? I was thinking maybe we can make it such that you only specify the fields you want to change, and no need to put any other type of special syntax indicating that you want inheritence. Validate would then need to be changed to not ding you if you don't put a required field, of course.
So, I'm not sure we need a special syntax. Not having the special syntax would make a little more work up front, but less work later. Let me explain: We currently have a bunch of places where we've repeated methods, properties, etc., that are actually inherited, in order to modify the platform tags, etc. We can't know for sure whether adding the partial inheritance is going to modify the doc for any of these members. So ideally, we'd want a flag like --warn-inherited that prints a warning message when "filling in" an inherited field for an API member. So if Hickey has method:
And DooHickey redeclares it thus:
We'd get a message something like this:
Is that practical? Thanks, -Arthur
Agreed, I like the flag idea.
Testing Notes
* Open apidoc/Titanium/Media/VideoPlayer.yml * Find the "click" event documentation. * Delete everything from the click event documentation except "description", and make the description be "Click event test for VideoPlayer." So the complete click event documentation will look like:* Run
python apidoc/docgen.py --warn-inherited
. As its generated, you should see warnings for documentation properties that are being inherited from the documentation of super types. * When docgen is finished, open dist/apidoc/index.html in the browser, and navigate to the titanium.Media.VideoPlayer documentation. Make sure the documentation for the click event looks right (has its summary, etc.) and shows a description as you entered it above. * Runpython apidoc/validate.py
-- you should get no errors related to the VideoPlayer.PR ready: https://github.com/appcelerator/titanium_mobile/pull/2393