Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to jam this gross description in there #151

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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