Skip to content

Commit

Permalink
fix(api-generation): api generation package now uses WIldduck Joi and…
Browse files Browse the repository at this point in the history
… does not depend on fixed joi version ZMS-126 (#639)

* restifyapi generate transformed into a class and uses the passed Joi and dirname

* remove joi dependency from .ncurc.js
  • Loading branch information
NickOvt authored Feb 29, 2024
1 parent f6f5f5e commit 9f704f7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
5 changes: 1 addition & 4 deletions .ncurc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ module.exports = {

// esm only
'chai',
'unixcrypt',

// temporary
'joi'
'unixcrypt'
]
};
6 changes: 4 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ const settingsRoutes = require('./lib/api/settings');
const healthRoutes = require('./lib/api/health');
const { SettingsHandler } = require('./lib/settings-handler');

const restifyApiGenerate = require('restifyapigenerate');
const { RestifyApiGenerate } = require('restifyapigenerate');
const Joi = require('joi');
const restifyApiGenerateConfig = require('./config/apigeneration.json');
const restifyApiGenerate = new RestifyApiGenerate(Joi, __dirname);

let userHandler;
let mailboxHandler;
Expand Down Expand Up @@ -578,7 +580,7 @@ module.exports = done => {
);
}

server.pre(restifyApiGenerate(server, restifyApiGenerateConfig));
server.pre(restifyApiGenerate.restifyApiGenerate(server, restifyApiGenerateConfig));

server.on('error', err => {
if (!started) {
Expand Down
2 changes: 1 addition & 1 deletion config/apigeneration.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@
}
},
"security": [{ "AccessTokenAuth": [] }],
"docsPath": "/../../openapidocs.json"
"docsPath": "/openapidocs.json"
}
11 changes: 4 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"restify-cors-middleware2": "2.2.1",
"restify-errors": "8.0.2",
"restify-logger": "2.0.1",
"restifyapigenerate": "1.1.0",
"restifyapigenerate": "1.2.0",
"search-string": "3.1.0",
"seq-index": "1.1.0",
"smtp-server": "3.13.2",
Expand Down

0 comments on commit 9f704f7

Please sign in to comment.