-
Notifications
You must be signed in to change notification settings - Fork 57
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
Update for enjoi and tape packages, change dev dependencies. #97
base: master
Are you sure you want to change the base?
Conversation
…age-lock.json file
…ow a test case catch a path parameter
lib/buildroutes.js
Outdated
/* eslint-disable global-require */ | ||
/* eslint-disable no-use-before-define */ | ||
/* eslint-disable prefer-const */ | ||
/* eslint-disable max-len */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are those exceptions really needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm agree with you, the changes have been done.
utils.verbs.forEach((verb) => { | ||
let route; let pathnames; let operation; let | ||
validators; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some of these variables can be const, and also can you use a line per declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if one of them need to be let
, can you declare it previous to first assignation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I applied your suggestion using const
and let
.
lib/buildroutes.js
Outdated
|
||
route.handler && routes.push(route); | ||
let api; let routes; let handlers; let defaulthandler; let | ||
validator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you verify if is it possible to use const for these variables?
package.json
Outdated
@@ -17,24 +17,28 @@ | |||
}, | |||
"bugs": "http://github.com/krakenjs/swaggerize-builder/issues", | |||
"engines": { | |||
"node": "<=4.x" | |||
"node": ">=10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be >=12
?
latest version of Joi requires node 12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the change is done.
lib/validator.js
Outdated
fragment = typeof fragment === 'object' && fragment[paths[i]]; | ||
} | ||
// eslint-disable-next-line no-plusplus | ||
for (let i = 1; i < paths.length && fragment; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (let i = 1; i < paths.length && fragment; i++) { | |
for (let i = 1; i < paths.length && fragment; i+=1) { |
We could use the i += 1
expression or we could add the "allowForLoopAfterthoughts": true
rule to the eslint config file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, the change is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solves issue 94 - please update that issue, bring it to the creator's attention
@@ -1,3 +1,9 @@ | |||
### 1.0.12 | |||
|
|||
- Update to node v10, add `package-lock.json` file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be v12?
Might also want to make a bigger version jump if we are ruling out old node versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on Node 12. Maybe it can be changed to node 10+.
Curious, is package-lock.json for unit tests? Shouldn't unit tests always run on the latest dependency versions?
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "swaggerize-routes", | |||
"version": "1.0.11", | |||
"version": "1.0.12", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is node 12 minimum a point release?
@dlobregon I've published |
@@ -435,7 +429,7 @@ test('named validation', function (t) { | |||
t.plan(numErrorDetails + 1); | |||
t.ok(error, 'error.'); | |||
error.details.forEach(function (detail) { | |||
t.ok(detail.path === parameterName, 'Expected error.details.path to equal ' + parameterName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was it failing earlier? what changed?
looks good to me. |
👍 |
- "4" | ||
- "6" | ||
- "8" | ||
- "12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add 14
|
||
if (thing.isString(dir)) { | ||
assert.ok(fs.existsSync(dir), 'Specified or default \'handlers\' directory does not exist.'); | ||
let handlers; let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why not let handlers, obj;
?
@@ -1,3 +1,9 @@ | |||
### 1.0.12 | |||
|
|||
- Update to node v10, add `package-lock.json` file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on Node 12. Maybe it can be changed to node 10+.
Curious, is package-lock.json for unit tests? Shouldn't unit tests always run on the latest dependency versions?
makeAll: function (validators, route) { | ||
var self = this; | ||
makeAll(validators, route) { | ||
const self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is not needed now, as we are using arrow function.
detail.path = [parameter.name]; | ||
}); | ||
utils.debuglog('%s', result.error.message); | ||
return callback(result.error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is using callback
, should we avoid potentially returning a value in validate function?
i.e. change this to
callback(result.error); return;
return callback(result.error); | ||
} | ||
|
||
return callback(null, result.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is using callback
, should we avoid potentially returning a value in validate function?
i.e. change this to
callback(null, result.value);
@@ -149,130 +140,134 @@ module.exports = function validator(options) { | |||
* @returns {*} | |||
*/ | |||
function refresolver(schemas, value) { | |||
var id, refschema, path, fragment, paths; | |||
let id; let refschema; let path; let fragment; let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This IMO is weird from readability. Should we instead define all as one let
or define them in separate lines?
Few minor comments. Otherwise looks good for semver major. |
Is anyone able to merge this? Would be nice to get a resolution to: #94 |
No description provided.