File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,12 @@ function convertType(swaggerType, swagger) {
6161 _ . forEach ( swaggerType . properties , function ( propertyType , propertyName ) {
6262 var property = convertType ( propertyType ) ;
6363 property . name = propertyName ;
64+
65+ property . optional = true ;
66+ if ( swaggerType . required && swaggerType . required . indexOf ( propertyName ) !== - 1 ) {
67+ property . optional = false ;
68+ }
69+
6470 typespec . properties . push ( property ) ;
6571 } ) ;
6672 }
@@ -79,4 +85,3 @@ function convertType(swaggerType, swagger) {
7985}
8086
8187module . exports . convertType = convertType ;
82-
Original file line number Diff line number Diff line change 44<%#isRef%><%target%><%/isRef%><%!
55%><%#isAtomic%><%&tsType%><%/isAtomic%><%!
66%><%#isObject%>{ <% #properties%>
7- ' <%name%>' : <%> type%><% /properties%>
7+ ' <%name%>' <% #optional %> ? <% /optional %> : <%> type%><% /properties%>
88} <%/isObject%><%!
99%><%#isArray%>Array<<%#elementType%><%>type%><%/elementType%>>|<%#elementType%><%>type%><%/elementType%><%/isArray%>
1010<%={ { } }=%>
11- { {/tsType} }
11+ { {/tsType} }
You can’t perform that action at this time.
0 commit comments