Skip to content

Commit 73acbca

Browse files
committed
- Fixed formatting of models (comma vs semicolumn)
- Fixed issue ferdikoomen#867 where nullable prop would not have correct type
1 parent 63f59e6 commit 73acbca

File tree

5 files changed

+288
-101
lines changed

5 files changed

+288
-101
lines changed

src/openApi/v3/parser/getModelProperties.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema,
2929
isDefinition: false,
3030
isReadOnly: property.readOnly === true,
3131
isRequired: propertyRequired,
32-
isNullable: property.nullable === true,
32+
isNullable: model.isNullable || property.nullable === true,
3333
format: property.format,
3434
maximum: property.maximum,
3535
exclusiveMaximum: property.exclusiveMaximum,
@@ -62,7 +62,7 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema,
6262
isDefinition: false,
6363
isReadOnly: property.readOnly === true,
6464
isRequired: propertyRequired,
65-
isNullable: property.nullable === true,
65+
isNullable: model.isNullable || property.nullable === true,
6666
format: property.format,
6767
maximum: property.maximum,
6868
exclusiveMaximum: property.exclusiveMaximum,

src/templates/partials/typeInterface.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*/
88
{{/if}}
99
{{#if ../parent}}
10-
{{>isReadOnly}}{{{name}}}{{>isRequired}}: {{>type parent=../parent}},
10+
{{>isReadOnly}}{{{name}}}{{>isRequired}}: {{>type parent=../parent}};
1111
{{else}}
12-
{{>isReadOnly}}{{{name}}}{{>isRequired}}: {{>type}},
12+
{{>isReadOnly}}{{{name}}}{{>isRequired}}: {{>type}};
1313
{{/if}}
1414
{{/each}}
1515
}{{>isNullable}}

0 commit comments

Comments
 (0)