This repository was archived by the owner on Sep 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
src/serializers/swagger/v2.0
testing/e2e/internal-swagger2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -463,18 +463,12 @@ methods.getSchemaFromResponse = (response) => {
463463 * @returns {SwaggerResponseObject } the corresponding swagger response object.
464464 */
465465methods . convertResponseRecordToResponseObject = ( store , { key, value } ) => {
466- const response = { }
467-
468- if ( value . get ( 'description' ) ) {
469- response . description = value . get ( 'description' )
470- }
471- else {
472- response . description = 'no description was provided for this response'
466+ const response = {
467+ description : value . get ( 'description' ) || '' ,
468+ headers : methods . getHeadersFromResponse ( store , value ) ,
469+ schema : methods . getSchemaFromResponse ( value )
473470 }
474471
475- response . headers = methods . getHeadersFromResponse ( store , value )
476- response . schema = methods . getSchemaFromResponse ( value )
477-
478472 return {
479473 key,
480474 value : response
@@ -1123,7 +1117,7 @@ methods.getResponsesFromRequest = (store, request) => {
11231117 if ( Object . keys ( responses ) . length === 0 ) {
11241118 return {
11251119 default : {
1126- description : 'no response description was provided for this operation '
1120+ description : ''
11271121 }
11281122 }
11291123 }
Original file line number Diff line number Diff line change @@ -653,7 +653,7 @@ describe('serializers/swagger/v2.0/Serializer.js', () => {
653653 }
654654
655655 const expectedValue = {
656- description : 'no description was provided for this response ' ,
656+ description : '' ,
657657 headers : {
658658 userId : { type : 'string' } ,
659659 petId : { type : 'number' }
@@ -1703,21 +1703,21 @@ describe('serializers/swagger/v2.0/Serializer.js', () => {
17031703 get : {
17041704 responses : {
17051705 default : {
1706- description : 'no response description was provided for this operation '
1706+ description : ''
17071707 }
17081708 }
17091709 } ,
17101710 post : {
17111711 responses : {
17121712 default : {
1713- description : 'no response description was provided for this operation '
1713+ description : ''
17141714 }
17151715 }
17161716 } ,
17171717 put : {
17181718 responses : {
17191719 default : {
1720- description : 'no response description was provided for this operation '
1720+ description : ''
17211721 }
17221722 }
17231723 }
Original file line number Diff line number Diff line change @@ -81,8 +81,7 @@ describe('internal -> swagger v2', () => {
8181 }
8282 catch ( e ) {
8383 console . error ( e . stack )
84- expect ( true ) . toEqual ( false )
85- done ( )
84+ done ( new Error ( 'unexpected error' ) )
8685 }
8786 /* eslint-enable no-console */
8887 } )
Original file line number Diff line number Diff line change 2929 ],
3030 "responses" : {
3131 "default" : {
32- "description" : " no response description was provided for this operation "
32+ "description" : " "
3333 }
3434 },
3535 "security" : [
5555 ],
5656 "responses" : {
5757 "default" : {
58- "description" : " no response description was provided for this operation "
58+ "description" : " "
5959 }
6060 }
6161 }
6767 ],
6868 "responses" : {
6969 "200" : {
70- "description" : " no description was provided for this response " ,
70+ "description" : " " ,
7171 "schema" : {
7272 "$ref" : " #/definitions/AnotherEntry"
7373 }
8181 ],
8282 "responses" : {
8383 "200" : {
84- "description" : " no description was provided for this response " ,
84+ "description" : " " ,
8585 "schema" : {
8686 "type" : " object"
8787 }
109109 ],
110110 "responses" : {
111111 "default" : {
112- "description" : " no response description was provided for this operation "
112+ "description" : " "
113113 }
114114 },
115115 "security" : [
129129 ],
130130 "responses" : {
131131 "default" : {
132- "description" : " no response description was provided for this operation "
132+ "description" : " "
133133 }
134134 }
135135 }
142142 ],
143143 "responses" : {
144144 "200" : {
145- "description" : " no description was provided for this response " ,
145+ "description" : " " ,
146146 "schema" : {
147147 "$ref" : " #/definitions/SongsLib.Song"
148148 }
You can’t perform that action at this time.
0 commit comments