Skip to content

Commit

Permalink
x-nullable support for non-object schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Aug 31, 2016
1 parent 40c40cd commit b649d52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/components/JsonSchema/json-schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
3 changes: 1 addition & 2 deletions lib/services/schema-helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
});
Expand Down

0 comments on commit b649d52

Please sign in to comment.