File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,37 @@ class DefinitionGenerator {
6868 description : documentation ?. description || '' ,
6969 version : documentation ?. version || uuid ( ) ,
7070 }
71+
72+ if ( documentation . termsOfService )
73+ info . termsOfService = documentation . termsOfService
74+
75+ if ( documentation . contact ) {
76+ const contactObj = { }
77+ contactObj . name = documentation . contact . name || ''
78+
79+ if ( documentation . contact . url )
80+ contactObj . url = documentation . contact . url
81+
82+ contactObj . email = documentation . contact . email || ''
83+ Object . assign ( info , { contact : contactObj } )
84+ }
85+
86+ if ( documentation . license && documentation . license . name ) {
87+ const licenseObj = { }
88+ licenseObj . name = documentation . license . name || ''
89+
90+ if ( documentation . license . url )
91+ licenseObj . url = documentation . license . url || ''
92+
93+ Object . assign ( info , { license : licenseObj } )
94+ }
95+
96+ for ( const key of Object . keys ( documentation ) ) {
97+ if ( / ^ [ x \- ] / i. test ( key ) ) {
98+ Object . assign ( info , { [ key ] : documentation [ key ] } )
99+ }
100+ }
101+
71102 Object . assign ( this . openAPI , { info} )
72103 }
73104
You can’t perform that action at this time.
0 commit comments