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

Accept json schema #35

Merged
merged 4 commits into from
Sep 7, 2019
Merged

Accept json schema #35

merged 4 commits into from
Sep 7, 2019

Conversation

kobik
Copy link
Collaborator

@kobik kobik commented Sep 6, 2019

Closes #36

@coveralls
Copy link

coveralls commented Sep 6, 2019

Pull Request Test Coverage Report for Build 285

  • 16 of 16 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 98.155%

Totals Coverage Status
Change from base Build 267: 0.02%
Covered Lines: 507
Relevant Lines: 509

💛 - Coveralls

@kobik kobik requested a review from kibertoad September 6, 2019 18:25
@kobik kobik changed the title Accept json schema WIP: Accept json schema Sep 7, 2019
@kobik kobik changed the title WIP: Accept json schema Accept json schema Sep 7, 2019
@kobik kobik requested a review from idanto September 7, 2019 11:29
src/index.js Outdated
}

function getJsonSchema(pathOrSchema) {
if (pathOrSchema instanceof Object) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it easier to check if pathOrSchema is string? Judging by Lodash implementation, check is not that simple and there might be edge cases (https://github.com/lodash/lodash/blob/master/isObject.js)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

const yaml = require('js-yaml');
const fs = require('fs');

const schemaValidatorGenerator = require('../../../src/index');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't index at the end redundant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

@kobik kobik merged commit cbdd528 into master Sep 7, 2019
@kobik kobik deleted the accept-json-schema-in-contsructor branch September 7, 2019 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Accept JSON schema in init function
3 participants