Skip to content

Commit 3d3bcbe

Browse files
authored
Merge pull request #95 from kedashoe/x-nullable
support "x-nullable" property
2 parents 22eff03 + 027cdc1 commit 3d3bcbe

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

demo/swagger.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ definitions:
819819
type: string
820820
pattern: "^\\+(?:[0-9]-?){6,14}[0-9]$"
821821
example: +1-202-555-0192
822+
x-nullable: true
822823
userStatus:
823824
description: User status
824825
type: integer

lib/components/JsonSchema/_json-schema-common.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ $sub-schema-offset: ($bullet-size / 2) + $bullet-margin;
6363
font-weight: bold;
6464
}
6565

66+
.param-nullable {
67+
vertical-align: middle;
68+
line-height: $param-name-height;
69+
color: #3195a6;
70+
font-size: 12px;
71+
font-weight: bold;
72+
}
73+
6674
.param-type {
6775
vertical-align: middle;
6876
line-height: $param-name-height;

lib/components/JsonSchema/json-schema.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
7171
</span>
7272
<span *ngIf="prop._required" class="param-required">Required</span>
73+
<span *ngIf="prop._nullable" class="param-nullable">Nullable</span>
7374
<div *ngIf="prop.default">Default: {{prop.default | json}}</div>
7475
<div *ngIf="prop.enum && !prop.isDiscriminator" class="param-enum">
7576
<span *ngFor="let enumItem of prop.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>

lib/services/schema-helper.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export class SchemaHelper {
229229
propertySchema._pointer = null;
230230
}
231231
propertySchema._required = !!requiredMap[propName];
232+
propertySchema._nullable = !!propertySchema['x-nullable'];
232233
propertySchema.isDiscriminator = (schema.discriminator === propName);
233234
return propertySchema;
234235
});

0 commit comments

Comments
 (0)