@ -151,6 +151,13 @@ class MatrixUnits(Units):
# assign value expected for this param
# assign value expected for this param
val_type = param . get ( " type " ) # integer/string
val_type = param . get ( " type " ) # integer/string
if param . get ( " enum " ) :
val_type = " enum "
desc + = (
" One of: %s " % json . dumps ( param . get ( " enum " ) )
)
refType = Units . prop ( param , " schema/$ref/ " ) # Error,Event
refType = Units . prop ( param , " schema/$ref/ " ) # Error,Event
schemaFmt = Units . prop ( param , " schema/format " ) # bytes e.g. uploads
schemaFmt = Units . prop ( param , " schema/format " ) # bytes e.g. uploads
if not val_type and refType :
if not val_type and refType :
@ -255,7 +262,7 @@ class MatrixUnits(Units):
res_type = Units . prop ( good_response , " schema/type " )
res_type = Units . prop ( good_response , " schema/type " )
if res_type and res_type not in [ " object " , " array " ] :
if res_type and res_type not in [ " object " , " array " ] :
# response is a raw string or something like that
# response is a raw string or something like that
endpoint[ " res_tables " ] . append ( {
good_table = {
" title " : None ,
" title " : None ,
" rows " : [ {
" rows " : [ {
" key " : good_response [ " schema " ] . get ( " name " , " " ) ,
" key " : good_response [ " schema " ] . get ( " name " , " " ) ,
@ -263,7 +270,16 @@ class MatrixUnits(Units):
" desc " : res . get ( " description " , " " ) ,
" desc " : res . get ( " description " , " " ) ,
" req_str " : " "
" req_str " : " "
} ]
} ]
} )
}
if good_response . get ( " headers " ) :
for ( header_name , header ) in good_response . get ( " headers " ) . iteritems ( ) :
good_table [ " rows " ] . append ( {
" key " : header_name ,
" type " : " Header< " + header [ " type " ] + " > " ,
" desc " : header [ " description " ] ,
" req_str " : " "
} )
endpoint [ " res_tables " ] . append ( good_table )
elif res_type and Units . prop ( good_response , " schema/properties " ) :
elif res_type and Units . prop ( good_response , " schema/properties " ) :
# response is an object:
# response is an object:
schema = good_response [ " schema " ]
schema = good_response [ " schema " ]
@ -328,7 +344,7 @@ class MatrixUnits(Units):
self . log ( " Reading swagger API: %s " % filename )
self . log ( " Reading swagger API: %s " % filename )
with open ( os . path . join ( path , filename ) , " r " ) as f :
with open ( os . path . join ( path , filename ) , " r " ) as f :
# strip .yaml
# strip .yaml
group_name = filename [ : - 5 ]
group_name = filename [ : - 5 ] . replace ( " - " , " _ " )
api = yaml . load ( f . read ( ) )
api = yaml . load ( f . read ( ) )
api [ " __meta " ] = self . _load_swagger_meta ( api , group_name )
api [ " __meta " ] = self . _load_swagger_meta ( api , group_name )
apis [ group_name ] = api
apis [ group_name ] = api