Handle other status codes

Reviewed all current docs to find all documented 400- and 500- errors.
Updated help text in the migrate script.

Change-Id: I1a31a5b1953063842b4ce84ae002854aaa11cfaa
This commit is contained in:
Anne Gentle 2016-01-12 10:30:34 -06:00 committed by Anne Gentle
parent 877a0877d3
commit 6b45654a76
2 changed files with 25 additions and 25 deletions

View File

@ -577,14 +577,13 @@ class WADLHandler(xml.sax.ContentHandler):
def response_schema_description(self, content, **kwargs):
status_code = self.search_stack_for('response')['status']
if ' ' in status_code:
status_codes = status_code.split(' ')
if '200' in status_codes:
status_code = '200'
elif '201' in status_codes:
status_code = '201'
# TODO(arrsim) need to do something with the other status
# codes
recognized_codes = ['200', '201', '202', '204', '300', '400', '401',
'403', '404', '405', '409', '413', '415',
'422', '500', '501', '503']
if status_code not in recognized_codes:
log.warning("Found the status code %s in a WADL, " +
"but it is not a valid HTTP status code.",
status_code)
param = self.search_stack_for('param')
style = STYLE_MAP[param['style']]
name = param['name']
@ -732,12 +731,13 @@ class WADLHandler(xml.sax.ContentHandler):
if self.search_stack_for('response') is not None:
type = 'response'
status_code = self.search_stack_for('response')['status']
if ' ' in status_code:
status_codes = status_code.split(' ')
if '200' in status_codes:
status_code = '200'
# TODO(arrsim) need to do something with the other
# status codes
recognized_codes = ['200', '201', '202', '204', '300', '400',
'401', '403', '404', '405', '409', '413',
'415', '422', '500', '501', '503']
if status_code not in recognized_codes:
log.warning("Found the status code %s in a WADL, " +
"but it is not a valid HTTP status code.",
status_code)
elif self.search_stack_for('request') is not None:
type = 'request'
else:
@ -830,13 +830,13 @@ class WADLHandler(xml.sax.ContentHandler):
if self.on_top_tag_stack('response', 'representation', 'param'):
parameters = self.current_api['parameters']
status_code = self.attr_stack[-3]['status']
if ' ' in status_code:
status_codes = status_code.split(' ')
if '200' in status_codes:
status_code = '200'
elif '201' in status_codes:
status_code = '201'
# TODO(arrsim) need to do something with the other status codes
recognized_codes = ['200', '201', '202', '204', '300', '400',
'401', '403', '404', '405', '409', '413',
'415', '422', '500', '501', '503']
if status_code not in recognized_codes:
log.warning("Found the status code %s in a WADL, " +
"but it is not a valid HTTP status code.",
status_code)
name = attrs['name']
parameter = create_parameter(
name=name,

View File

@ -13,9 +13,9 @@ function usage {
echo " -d, --debug Run tests with testtools instead of testr. This allows you to use PDB"
echo " --docs-only Only generate docs"
echo " --verbose-docs Verbose logging of document generation"
echo " --docbkx2json Only perform docbookx to json conversion"
echo " --wadl2swagger Only perform wadl to swagger conversion"
echo " --wadl2swaggervalid Only perform wadl to swagger valid conversion"
echo " --docbkx2json Only perform docbook to json conversion"
echo " --wadl2swagger Only perform wadl to swagger-ish conversion"
echo " --wadl2swaggervalid Only perform wadl to valid swagger conversion"
echo " --swagger2rst Only perform swagger to rst conversion"
}
@ -147,4 +147,4 @@ if [ -z $docs_only ]; then
install_api_site
fi
migrate_docbkx
migrate_docbkx