@@ -94,6 +94,7 @@ describe('parseOpenApiDocument', () => {
9494 description : 'Schema Description' ,
9595 schemaName : 'SimpleSchema' ,
9696 fileName : 'simple-schema' ,
97+ nullable : false ,
9798 schema : {
9899 type : 'string'
99100 } ,
@@ -102,6 +103,58 @@ describe('parseOpenApiDocument', () => {
102103 ] ) ;
103104 } ) ;
104105
106+ it ( 'parses simple object persisted schema with nullable' , async ( ) => {
107+ const components : OpenAPIV3 . ComponentsObject = {
108+ schemas : {
109+ SimpleSchema : {
110+ description : 'Schema Description' ,
111+ type : 'object' ,
112+ nullable : true ,
113+ properties : {
114+ prop1 : { type : 'string' }
115+ }
116+ }
117+ }
118+ } ;
119+
120+ const document : OpenAPIV3 . Document = getDocument (
121+ getResponse ( 'SimpleSchema' ) ,
122+ components
123+ ) ;
124+
125+ const parsed = await parseOpenApiDocument (
126+ document ,
127+ { directoryName : 'myService' } as ServiceOptions ,
128+ options
129+ ) ;
130+ expect ( parsed . schemas ) . toStrictEqual ( [
131+ {
132+ description : 'Schema Description' ,
133+ schemaName : 'SimpleSchema' ,
134+ fileName : 'simple-schema' ,
135+ schema : {
136+ additionalProperties : {
137+ type : 'any'
138+ } ,
139+ properties : [
140+ {
141+ description : undefined ,
142+ name : 'prop1' ,
143+ nullable : false ,
144+ required : false ,
145+ schema : {
146+ type : 'string'
147+ } ,
148+ schemaProperties : { }
149+ }
150+ ]
151+ } ,
152+ nullable : true ,
153+ schemaProperties : { }
154+ }
155+ ] ) ;
156+ } ) ;
157+
105158 it ( "escapes 'index' as file name, but not as schema name" , async ( ) => {
106159 const input : OpenAPIV3 . Document = {
107160 ...emptyDocument ,
0 commit comments