Added deprecated API indication in the API doc (#6545)

* Added deprecated command indication as (D) in the API doc

* Fixed line allignment
This commit is contained in:
Harikrishna 2022-07-13 15:34:46 +05:30 committed by GitHub
parent 7a1401a111
commit 12ecfa88cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

View File

@ -214,9 +214,11 @@ public class ApiXmlDocWriter {
}
boolean isAsync = ReflectUtil.isCmdClassAsync(clas, new Class<?>[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
apiCommand.setAsync(isAsync);
boolean isDeprecated = clas.getAnnotation(Deprecated.class) != null;
apiCommand.setDeprecated(isDeprecated);
Set<Field> fields = ReflectUtil.getAllFieldsForClass(clas, new Class<?>[] {BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
request = setRequestFields(fields);

View File

@ -32,6 +32,7 @@ public class Command implements Serializable{
private String sinceVersion = null;
private ArrayList<Argument> request;
private ArrayList<Argument> response;
private boolean isDeprecated;
public Command(String name, String description) {
this.name = name;
@ -114,4 +115,12 @@ public class Command implements Serializable{
public void setUsage(String usage) {
this.usage = usage;
}
public boolean isDeprecated() {
return isDeprecated;
}
public void setDeprecated(boolean deprecated) {
isDeprecated = deprecated;
}
}

View File

@ -234,6 +234,7 @@ for f in sys.argv:
dom = minidom.parse(data)
name = dom.getElementsByTagName('name')[0].firstChild.data
isAsync = dom.getElementsByTagName('isAsync')[0].firstChild.data
isDeprecated = dom.getElementsByTagName('isDeprecated')[0].firstChild.data
category = choose_category(fn)
if category not in categories:
categories[category] = []
@ -241,6 +242,7 @@ for f in sys.argv:
'name': name,
'dirname': dirname_to_dirname[dirname],
'async': isAsync == 'true',
'deprecated': isDeprecated == 'true',
'user': dirname_to_user[dirname],
})
except ExpatError as e:
@ -252,9 +254,10 @@ for f in sys.argv:
def xml_for(command):
name = command['name']
isAsync = command['async'] and ' (A)' or ''
isDeprecated = command['deprecated'] and ' (D)' or ''
dirname = command['dirname']
return '''<xsl:if test="name=\'%(name)s\'">
<li><a href="%(dirname)s/%(name)s.html"><xsl:value-of select="name"/>%(isAsync)s</a></li>
<li><a href="%(dirname)s/%(name)s.html"><xsl:value-of select="name"/>%(isAsync)s %(isDeprecated)s</a></li>
</xsl:if>
''' % locals()

View File

@ -66,5 +66,6 @@ version="1.0">
<span>Commands available through the developer API URL and the integration API URL.</span>
<div class="api_legends">
<p><span class="api_legends_async">(A)</span> implies that the command is asynchronous.</p>
<p><span class="api_legends_async">(D)</span> implies that the command is deprecated.</p>
<p>(*) implies element has a child.</p>
</div>