ShaoHe Feng has posted comments on this change.
Change subject: Detect optional parameter syntax errors in JSON schema
......................................................................
Patch Set 2:
(5 comments)
....................................................
Commit Message
Line 3: AuthorDate: 2012-12-28 00:27:20 +0800
Line 4: Commit: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Line 5: CommitDate: 2012-12-28 14:30:30 +0800
Line 6:
Line 7: check the syntaxs of optional parameters in json schema
Done
Line 8:
Line 9: There are so many syntaxs error of optional parameters define in
Line 10: json schema
Line 11: This patch can both check the descrption errors of optional parameters
Line 8:
Line 9: There are so many syntaxs error of optional parameters define in
Line 10: json schema
Line 11: This patch can both check the descrption errors of optional parameters
Line 12: missing #optional and the define error of optional parameters missing *
Done
Line 13:
Line 14: Change-Id: I94f92459ee8787780a54a510b6f8cc074fb2a235
....................................................
File vdsm_api/process-schema.py
Line 23: import re
Line 24: import vdsmapi
Line 25: try:
Line 26: from collections import OrderedDict
Line 27: OrderedDict # make pyflakes happy
A good idea. check other vdsm code, they do the same way.
If we can fix pyflakes, it is more better.
Line 28: except ImportError:
Line 29: from ordereddict import OrderedDict
Line 30:
Line 31: html_escape_table = {
Line 151: # check optional parameters
Line 152: if desc.startswith('#optional'):
Line 153: assert ('*' + name in
symbol['data'].keys()), \
Line 154: ('Define of %s optional parameter error:\n\t%s
should '
Line 155: 'start with *' % (symbol['name'],
name))
Done
Line 156: if isinstance(symbol['data'], OrderedDict):
Line 157: if '*' + name in symbol['data'].keys():
Line 158: assert desc.startswith('#optional'), \
Line 159: ('Description of %s optional parameter
error:\n\t'
Line 158: assert desc.startswith('#optional'), \
Line 159: ('Description of %s optional parameter
error:\n\t'
Line 160: 'The description of optional parameter
"%s" '
Line 161: 'should start with "#optional"'
%
Line 162: (symbol['name'], name))
Done
Line 163: else:
Line 164: # Just append it to the last one we added
Line 165: symbol[mode][last_arg] += ' ' + line
Line 166: elif mode == 'info_return':
--
To view, visit
http://gerrit.ovirt.org/10446
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I94f92459ee8787780a54a510b6f8cc074fb2a235
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Adam Litke <agl(a)us.ibm.com>
Gerrit-Reviewer: Better Saggi <bettersaggi(a)gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes