Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/serializers/swagger/v2.0/Serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,18 +463,12 @@ methods.getSchemaFromResponse = (response) => {
* @returns {SwaggerResponseObject} the corresponding swagger response object.
*/
methods.convertResponseRecordToResponseObject = (store, { key, value }) => {
const response = {}

if (value.get('description')) {
response.description = value.get('description')
}
else {
response.description = 'no description was provided for this response'
const response = {
description: value.get('description') || '',
headers: methods.getHeadersFromResponse(store, value),
schema: methods.getSchemaFromResponse(value)
}

response.headers = methods.getHeadersFromResponse(store, value)
response.schema = methods.getSchemaFromResponse(value)

return {
key,
value: response
Expand Down Expand Up @@ -1123,7 +1117,7 @@ methods.getResponsesFromRequest = (store, request) => {
if (Object.keys(responses).length === 0) {
return {
default: {
description: 'no response description was provided for this operation'
description: ''
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/serializers/swagger/v2.0/__tests__/Serializer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ describe('serializers/swagger/v2.0/Serializer.js', () => {
}

const expectedValue = {
description: 'no description was provided for this response',
description: '',
headers: {
userId: { type: 'string' },
petId: { type: 'number' }
Expand Down Expand Up @@ -1703,21 +1703,21 @@ describe('serializers/swagger/v2.0/Serializer.js', () => {
get: {
responses: {
default: {
description: 'no response description was provided for this operation'
description: ''
}
}
},
post: {
responses: {
default: {
description: 'no response description was provided for this operation'
description: ''
}
}
},
put: {
responses: {
default: {
description: 'no response description was provided for this operation'
description: ''
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions testing/e2e/internal-swagger2/e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ describe('internal -> swagger v2', () => {
}
catch (e) {
console.error(e.stack)
expect(true).toEqual(false)
done()
done(new Error('unexpected error'))
}
/* eslint-enable no-console */
})
Expand Down
14 changes: 7 additions & 7 deletions testing/e2e/internal-swagger2/test-case-1/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
"responses": {
"default": {
"description": "no response description was provided for this operation"
"description": ""
}
},
"security": [
Expand All @@ -55,7 +55,7 @@
],
"responses": {
"default": {
"description": "no response description was provided for this operation"
"description": ""
}
}
}
Expand All @@ -67,7 +67,7 @@
],
"responses": {
"200": {
"description": "no description was provided for this response",
"description": "",
"schema": {
"$ref": "#/definitions/AnotherEntry"
}
Expand All @@ -81,7 +81,7 @@
],
"responses": {
"200": {
"description": "no description was provided for this response",
"description": "",
"schema": {
"type": "object"
}
Expand Down Expand Up @@ -109,7 +109,7 @@
],
"responses": {
"default": {
"description": "no response description was provided for this operation"
"description": ""
}
},
"security": [
Expand All @@ -129,7 +129,7 @@
],
"responses": {
"default": {
"description": "no response description was provided for this operation"
"description": ""
}
}
}
Expand All @@ -142,7 +142,7 @@
],
"responses": {
"200": {
"description": "no description was provided for this response",
"description": "",
"schema": {
"$ref": "#/definitions/SongsLib.Song"
}
Expand Down