Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arrays cause the UI to fail if items aren't present in the schema #666

Closed
paulhill opened this issue Oct 16, 2014 · 2 comments
Closed

arrays cause the UI to fail if items aren't present in the schema #666

paulhill opened this issue Oct 16, 2014 · 2 comments

Comments

@paulhill
Copy link
Contributor

This function throws a null pointer error if items isn't present for an array type.

var Property = function(name, obj, required) {
  this.schema = obj;
  this.required = required;
  if(obj['$ref']) {
    var refType = obj['$ref'];
    refType = refType.indexOf('#/definitions') === -1 ? refType : refType.substring('#/definitions').length;
    this['$ref'] = refType;
  }
  else if (obj.type === 'array') {
    if(obj.items['$ref'])
      this['$ref'] = obj.items['$ref'];
    else
      obj = obj.items;
  }
  this.name = name;
  this.obj = obj;
  this.optional = true;
  this.example = obj.example || null;
}

But json schema does not require items:
http://json-schema.org/latest/json-schema-validation.html#anchor36

Is this a case of swagger-ui does require it, or just a bug?

@fehguy
Copy link
Contributor

fehguy commented Oct 17, 2014

We definitely need items if it's an array, we're not supporting anonymous inner types. Granted an error isn't the right way to handle it.

Btw you filed bug #666. Nice job :-/

@fehguy
Copy link
Contributor

fehguy commented Dec 29, 2014

Please track this here:

swagger-api/swagger-js#190

@fehguy fehguy closed this as completed Dec 29, 2014
maryscar added a commit to maryscar/swagger-ui that referenced this issue May 10, 2018
…ccessibility color contrast threshold.
maryscar added a commit to maryscar/swagger-ui that referenced this issue May 10, 2018
…on_Model_properties_#4539

Update inline style from swagger-api#999 to swagger-api#666 to meet accessibility color con…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants