added check for schema

This commit is contained in:
Tony Tam
2014-10-02 15:29:26 -07:00
parent 5823358e73
commit 4d2ad25a10
6 changed files with 67 additions and 17 deletions

View File

@@ -97,7 +97,7 @@ class OperationView extends Backbone.View
type = param.type || param.dataType
if typeof type is 'undefined'
schema = param.schema
if schema['$ref']
if schema and schema['$ref']
ref = schema['$ref']
if ref.indexOf('#/definitions/') is 0
type = ref.substring('#/definitions/'.length)

View File

@@ -12,7 +12,7 @@ class ParameterView extends Backbone.View
if typeof type is 'undefined'
schema = @model.schema
if schema['$ref']
if schema and schema['$ref']
ref = schema['$ref']
if ref.indexOf('#/definitions/') is 0
type = ref.substring('#/definitions/'.length)