lint: src/node/hooks/express/openapi.js

This commit is contained in:
John McLear 2021-01-21 21:06:52 +00:00 committed by Richard Hansen
parent 18ebf7b69a
commit 2f9a3ec655

View file

@ -1,3 +1,5 @@
'use strict';
/** /**
* node/hooks/express/openapi.js * node/hooks/express/openapi.js
* *
@ -31,7 +33,9 @@ const OPENAPI_VERSION = '3.0.2'; // Swagger/OAS version
const info = { const info = {
title: 'Etherpad API', title: 'Etherpad API',
description: description:
'Etherpad is a real-time collaborative editor scalable to thousands of simultaneous real time users. It provides full data export capabilities, and runs on your server, under your control.', 'Etherpad is a real-time collaborative editor scalable to thousands of simultaneous ' +
'real time users. It provides full data export capabilities, and runs on your server, ' +
'under your control.',
termsOfService: 'https://etherpad.org/', termsOfService: 'https://etherpad.org/',
contact: { contact: {
name: 'The Etherpad Foundation', name: 'The Etherpad Foundation',
@ -80,7 +84,9 @@ const resources = {
listSessions: { listSessions: {
operationId: 'listSessionsOfGroup', operationId: 'listSessionsOfGroup',
summary: '', summary: '',
responseSchema: {sessions: {type: 'array', items: {$ref: '#/components/schemas/SessionInfo'}}}, responseSchema: {
sessions: {type: 'array', items: {$ref: '#/components/schemas/SessionInfo'}},
},
}, },
list: { list: {
operationId: 'listAllGroups', operationId: 'listAllGroups',
@ -109,7 +115,9 @@ const resources = {
listSessions: { listSessions: {
operationId: 'listSessionsOfAuthor', operationId: 'listSessionsOfAuthor',
summary: 'returns all sessions of an author', summary: 'returns all sessions of an author',
responseSchema: {sessions: {type: 'array', items: {$ref: '#/components/schemas/SessionInfo'}}}, responseSchema: {
sessions: {type: 'array', items: {$ref: '#/components/schemas/SessionInfo'}},
},
}, },
// We need an operation that return a UserInfo so it can be picked up by the codegen :( // We need an operation that return a UserInfo so it can be picked up by the codegen :(
getName: { getName: {
@ -153,7 +161,8 @@ const resources = {
create: { create: {
operationId: 'createPad', operationId: 'createPad',
description: description:
'creates a new (non-group) pad. Note that if you need to create a group Pad, you should call createGroupPad', 'creates a new (non-group) pad. Note that if you need to create a group Pad, ' +
'you should call createGroupPad',
}, },
getText: { getText: {
operationId: 'getText', operationId: 'getText',
@ -607,7 +616,7 @@ exports.expressCreateServer = (hookName, args, cb) => {
if (createHTTPError.isHttpError(err)) { if (createHTTPError.isHttpError(err)) {
// pass http errors thrown by handler forward // pass http errors thrown by handler forward
throw err; throw err;
} else if (err.name == 'apierror') { } else if (err.name === 'apierror') {
// parameters were wrong and the api stopped execution, pass the error // parameters were wrong and the api stopped execution, pass the error
// convert to http error // convert to http error
throw new createHTTPError.BadRequest(err.message); throw new createHTTPError.BadRequest(err.message);