x-nullable support for non-object schemas

This commit is contained in:
Roman Hotsiy 2016-08-31 22:45:59 +03:00
parent 40c40cd327
commit b649d52c39
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 3 additions and 3 deletions

View File

@ -21,6 +21,7 @@
title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}}
<span class="param-range" *ngIf="schema._range"> {{schema._range}} </span>
</span>
<span *ngIf="prop['x-nullable']" class="param-nullable">Nullable</span>
<div *ngIf="schema.enum" class="param-enum">
<span *ngFor="let enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div>
@ -70,7 +71,7 @@
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
</span>
<span *ngIf="prop._required" class="param-required">Required</span>
<span *ngIf="prop._nullable" class="param-nullable">Nullable</span>
<span *ngIf="prop['x-nullable']" class="param-nullable">Nullable</span>
<div *ngIf="prop.default">Default: {{prop.default | json}}</div>
<div *ngIf="prop.enum && !prop.isDiscriminator" class="param-enum">
<span *ngFor="let enumItem of prop.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>

View File

@ -163,7 +163,7 @@ const injectors = {
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
} else if (propertySchema.maxLength) {
range = '<= ' + propertySchema.maxLength;
} else if (propertySchema.minimum) {
} else if (propertySchema.minLength) {
range = '>= ' + propertySchema.minLength;
}
@ -229,7 +229,6 @@ export class SchemaHelper {
propertySchema._pointer = null;
}
propertySchema._required = !!requiredMap[propName];
propertySchema._nullable = !!propertySchema['x-nullable'];
propertySchema.isDiscriminator = (schema.discriminator === propName);
return propertySchema;
});